1 // Copyright Timothy Goya 2007.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 #include <unison/video/Window.hpp>
7 #include <unison/video/Surface.hpp>
8 #include <unison/video/Texture.hpp>
9 #include <unison/video/Renderers.hpp>
10 #include <unison/video/backend/Renderer.hpp>
11 #include <unison/video/backend/Window.hpp>
22 icon(Surface(Area(1, 1))),
35 // FIXME: fix init order more naturally
41 void Window::set_logical_size(const Area &logical_size)
43 this->logical_size = logical_size;
46 std::vector<Surface> surfaces = Texture::save_textures();
47 open(get_size(), is_fullscreen());
48 Texture::load_textures(surfaces);
52 Area Window::get_logical_size() const
57 void Window::open(const Area &size, bool fullscreen)
59 std::vector<Surface> surfaces = Texture::save_textures();
60 if(logical_size.x == 0 || logical_size.y == 0)
65 window = Renderers::get().get_renderer().create_window(size, logical_size, fullscreen);
67 Texture::load_textures(surfaces);
68 window->set_title(title);
69 window->set_icon(icon);
73 void Window::take_screenshot(const std::string &filename) const
76 window->take_screenshot(filename);
94 void Window::set_title(const std::string &title)
99 window->set_title(title);
103 void Window::set_icon(const Surface &icon)
105 this->icon = icon.get_size() == Area() ? Surface(Area(1, 1)) : icon;
108 window->set_icon(icon);
112 Area Window::get_size() const
115 return window->get_size();
118 bool Window::is_fullscreen() const
121 return window->is_fullscreen();
124 bool Window::is_open() const