window.cpp

Go to the documentation of this file.
00001 /*
00002     RenderStack  Support library for OpenGL 3+
00003     Copyright (C) 2010  Timo Suoranta
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 */
00019 
00027 #include "renderstack/window.hpp"
00028 
00029 namespace renderstack {
00030 
00031 window::window()
00032 {
00033     ::memset(&m_window_low, 0, sizeof(struct ::rs_window));
00034 }
00035 
00036 window::~window()
00037 {
00038     ::rs_window_destroy(&m_window_low);
00039 }
00040 
00041 void window::fullscreen(int &width, int &height)
00042 {
00043     ::rs_window_fullscreen(&width, &height);
00044 }
00045 
00046 void window::realize()
00047 {
00048     m_window_low.client_area.x      = m_client_area.x();
00049     m_window_low.client_area.y      = m_client_area.y();
00050     m_window_low.client_area.width  = m_client_area.width();
00051     m_window_low.client_area.height = m_client_area.height();
00052 
00053     m_window_low.window_frame.x      = m_window_frame.x();
00054     m_window_low.window_frame.y      = m_window_frame.y();
00055     m_window_low.window_frame.width  = m_window_frame.width();
00056     m_window_low.window_frame.height = m_window_frame.height();
00057 
00058     int res = ::rs_window_create(&m_window_low);
00059     if(res != 0)
00060     {
00061         throw realize_failed_exception();
00062     }
00063 
00064     m_client_area.set_x     (m_window_low.client_area.x     );
00065     m_client_area.set_y     (m_window_low.client_area.y     );
00066     m_client_area.set_width (m_window_low.client_area.width );
00067     m_client_area.set_height(m_window_low.client_area.height);
00068 
00069     m_window_frame.set_x     (m_window_low.window_frame.x     );
00070     m_window_frame.set_y     (m_window_low.window_frame.y     );
00071     m_window_frame.set_width (m_window_low.window_frame.width );
00072     m_window_frame.set_height(m_window_low.window_frame.height);
00073 }
00074 
00075 void window::show()
00076 {
00077     ::rs_window_show(&m_window_low);
00078 }
00079 
00080 void window::hide()
00081 {
00082     ::rs_window_hide(&m_window_low);
00083 }
00084 
00085 void window::swap_buffers()
00086 {
00087     ::rs_window_swap_buffers(&m_window_low);
00088 }
00089 
00090 void window::reshape()
00091 {
00092     ::rs_window_reshape(&m_window_low);
00093 }
00094 
00095 void window::make_current()
00096 {
00097     int res = ::rs_window_make_current(&m_window_low);
00098 
00099     if(res != 1)
00100     {
00101         throw make_current_failed_exception();
00102     }
00103 }
00104 
00105 }
00106 
Generated on Sun Apr 11 12:23:09 2010 for RenderStack by  doxygen 1.6.3