Win32Window.h

Go to the documentation of this file.
00001 #ifndef WIN32WINDOW_H
00002 #define WIN32WINDOW_H
00003 
00004 #include "MercuryWindow.h"
00005 
00006 #include <windows.h>
00007 #include "MercuryString.h"
00008 
00010 class Win32Window : public MercuryWindow
00011 {
00012 public:
00013     Win32Window();
00014     virtual ~Win32Window();
00015     virtual bool MakeWindow(const char* title, int width, int height, int bits, bool fullscreen);
00016     virtual bool MakeRender(const char* title, int width, int height, int bits, bool fullscreenflag, RendererType brt );
00017     virtual void DestroyWindowAndRender();
00018     virtual bool RestoreDevice();
00019     virtual void DestroyWindow();
00020     virtual bool MakeRenderCurrent();
00021     virtual bool Update(const float dTime);
00022     virtual bool HasFocus();
00023     virtual unsigned char * GetBackDirectBuffer();  //For use only with SW renderer
00024 protected:
00025     virtual void SwapBuffersInternal();
00026 private:
00027     RendererType m_brt;
00028     WNDCLASS m_win;
00029     DWORD m_extendedStyle;
00030     DWORD m_style;  
00031     RECT m_rect;                            // Window rectangle?
00032     HGLRC m_hRC;                            // Rendering context (dont destroy unless wer are finished)
00033     HDC m_hDC;                              // Device
00034     HINSTANCE m_hInstance;                  // Instance
00035     MSG m_message;
00036 
00037     unsigned char * m_BackBuffer;
00038     HDC m_compatDC;
00039     HBITMAP m_hbm;
00040 };
00041 
00042 #endif
00043 
00044 /* Much thanks to the NeHe lesson one tutorial for explaining how to create
00045  * and set up an OpenGL window for Windows.
00046  * http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01
00047  *
00048  * 
00049  * Copyright (c) 2005-2006, Joshua Allen
00050  * All rights reserved.
00051  *
00052  * Redistribution and use in source and binary forms, with or
00053  * without modification, are permitted provided that the following
00054  * conditions are met:
00055  *  -   Redistributions of source code must retain the above
00056  *      copyright notice, this list of conditions and the following disclaimer.
00057  *  -   Redistributions in binary form must reproduce the above copyright
00058  *      notice, this list of conditions and the following disclaimer in
00059  *      the documentation and/or other materials provided with the distribution.
00060  *  -   Neither the name of the Mercury Engine nor the names of its
00061  *      contributors may be used to endorse or promote products derived from
00062  *      this software without specific prior written permission.
00063  *
00064  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00065  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00066  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00067  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
00068  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00069  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00070  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00071  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00072  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00073  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00074  */
00075 
00076 

Hosted by SourceForge.net Logo