From André Garneau, Implementation osg GraphicsWindowWin32
This commit is contained in:
parent
65e1a5cda3
commit
3ce53da0e1
@ -1 +1,3 @@
|
|||||||
PRODUCER_ICON ICON DISCARDABLE "../../icons/osg.ico"
|
PRODUCER_ICON ICON DISCARDABLE "../../icons/osg.ico"
|
||||||
|
OSG_ICON ICON DISCARDABLE "osg.ico"
|
||||||
|
|
||||||
|
@ -1 +1,4 @@
|
|||||||
PRODUCER_ICON ICON DISCARDABLE "osg.ico"
|
PRODUCER_ICON ICON DISCARDABLE "osg.ico"
|
||||||
|
|
||||||
|
OSG_ICON ICON DISCARDABLE "osg.ico"
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <osgDB/ReadFile>
|
#include <osgDB/ReadFile>
|
||||||
#include <osgUtil/Optimizer>
|
#include <osgUtil/Optimizer>
|
||||||
#include <osg/CoordinateSystemNode>
|
#include <osg/CoordinateSystemNode>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@ -21,6 +21,11 @@
|
|||||||
|
|
||||||
#include <osgViewer/GraphicsWindow>
|
#include <osgViewer/GraphicsWindow>
|
||||||
|
|
||||||
|
#ifndef _WIN32_WINNT
|
||||||
|
#define _WIN32_WINNT 0x0500
|
||||||
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
namespace osgViewer
|
namespace osgViewer
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -28,21 +33,9 @@ class GraphicsWindowWin32 : public osgViewer::GraphicsWindow
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GraphicsWindowWin32(osg::GraphicsContext::Traits* traits):
|
GraphicsWindowWin32(osg::GraphicsContext::Traits* traits);
|
||||||
_valid(false),
|
|
||||||
_initialized(false),
|
~GraphicsWindowWin32();
|
||||||
_realized(false)
|
|
||||||
{
|
|
||||||
_traits = traits;
|
|
||||||
|
|
||||||
init();
|
|
||||||
|
|
||||||
if (valid())
|
|
||||||
{
|
|
||||||
setState( new osg::State );
|
|
||||||
getState()->setContextID( osg::GraphicsContext::createNewContextID() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool valid() const { return _valid; }
|
virtual bool valid() const { return _valid; }
|
||||||
|
|
||||||
@ -75,16 +68,47 @@ class GraphicsWindowWin32 : public osgViewer::GraphicsWindow
|
|||||||
|
|
||||||
/** Get focus on if the pointer is in this window.*/
|
/** Get focus on if the pointer is in this window.*/
|
||||||
virtual void grabFocusIfPointerInWindow();
|
virtual void grabFocusIfPointerInWindow();
|
||||||
|
|
||||||
|
/** Handle a native (Win32) windowing event as received from the system */
|
||||||
|
virtual LRESULT handleNativeWindowingEvent( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
void registerWindowClass();
|
||||||
|
|
||||||
|
HWND createWindow();
|
||||||
|
void destroyWindow( bool deleteNativeWindow = true );
|
||||||
|
|
||||||
|
bool determineWindowPositionAndStyle( bool decorated, int& x, int& y, unsigned int& w, unsigned int& h, unsigned int& style, unsigned int& extendedStyle );
|
||||||
|
|
||||||
|
bool setPixelFormat();
|
||||||
|
|
||||||
|
void adaptKey( WPARAM wParam, LPARAM lParam, int& keySymbol, unsigned int& modifierMask );
|
||||||
|
|
||||||
void transformMouseXY(float& x, float& y);
|
void transformMouseXY(float& x, float& y);
|
||||||
|
|
||||||
bool _valid;
|
HWND _hwnd;
|
||||||
|
HDC _hdc;
|
||||||
|
HGLRC _hglrc;
|
||||||
|
|
||||||
|
double _timeOfLastCheckEvents;
|
||||||
|
|
||||||
|
int _screenOriginX;
|
||||||
|
int _screenOriginY;
|
||||||
|
unsigned int _screenWidth;
|
||||||
|
unsigned int _screenHeight;
|
||||||
|
|
||||||
|
int _windowOriginXToRealize;
|
||||||
|
int _windowOriginYToRealize;
|
||||||
|
unsigned int _windowWidthToRealize;
|
||||||
|
unsigned int _windowHeightToRealize;
|
||||||
|
|
||||||
bool _initialized;
|
bool _initialized;
|
||||||
|
bool _valid;
|
||||||
bool _realized;
|
bool _realized;
|
||||||
|
bool _destroying;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user