📄 soguigameviewer.h
字号:
#ifndef SOGUI_GAME_VIEWER_H#define SOGUI_GAME_VIEWER_H/*****************************************************************************\ * * SoGuiGameViewer.h * * So???RenderArea derived GUI window with advanced mouse handling * (delta mouse mode). * * When delta mode is activated, SoLocationEvent does not contain absolute * mouse coordinates, but deltas from previous SoLocationEvent. * Such deltas can be used for easy realization of mouse-look and so on. * * * Authors: PCJohn (peciva AT fit.vutbr.cz) * Contributors: * * ---------------------------------------------------------------------------- * * THIS SOFTWARE IS NOT COPYRIGHTED * * This source code is offered for use in the public domain. * You may use, modify or distribute it freely. * * This source code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * If you find the source code useful, authors will kindly welcome * if you give them credit and keep their names with their source code, * but do not feel forced to do so. *\*****************************************************************************///// Implementation notes: SoWin seems a little bit "unfinished" with several// known bugs. As a result, implementation and especially message handling// routines are polluted by workarounds and debugging outputs.// Some commented out code was left there since it may be useful when SoWin// gets improved. PCJohn 2005-08-27//// SoQt implementation is completely missing. However, it shall be _MUCH_// easier to implement it than it was for SoWin. PCJohn 2005-08-28//#if defined(__WIN32__) || defined(_WIN32)#include <Inventor/Win/SoWinRenderArea.h>#define SoGuiParentClass SoWinRenderArea#define SOGUI_OBJECT_HEADER SOWIN_OBJECT_HEADER#define WIDGET HWND#else#include <Inventor/Qt/SoQtRenderArea.h>#define SoGuiParentClass SoQtRenderArea#define SOGUI_OBJECT_HEADER SOQT_OBJECT_HEADER#define WIDGET QWidget*#error "Just Windows implementation exists at the present time."#error "Qt implementation shall be pretty easy. It shall be based on #error "QCursor class (http://doc.trolltech.com/4.0/qcursor.html).#error "To compile it anyway (mouse-look functionality will be disabled,"#error "comment out these lines. If it does not work, feel free to send bug-fix."#endifclass SoCamera;class SoGuiGameViewer : public SoGuiParentClass { SOGUI_OBJECT_HEADER(SoGuiGameViewer, SoGuiParentClass);public: enum MouseMode { DISABLED, SCENE_GRAPH, DELTA_TO_SCENE_GRAPH, CAMERA, CAMERA_AND_SCENE_GRAPH }; SoGuiGameViewer(WIDGET parent = NULL, const char *name = NULL, SbBool embed = TRUE, MouseMode mouseMode = CAMERA); ~SoGuiGameViewer(); virtual void setMouseMode(MouseMode mode); MouseMode getMouseMode() const; void setMouseSensitivity(const SbVec2f &sensitivity); SbVec2f getMouseSensitivity() const; virtual void setCamera(SoCamera *camera); SoCamera* getCamera() const; enum ClipMode { NO_CLIP, CLIP, CLIP_RELEASE_ONLY }; void setClipMode(ClipMode m); ClipMode getClipMode() const; virtual void setSceneGraph(SoNode *node);private: class SoGuiGameViewerP *pimpl; friend class SoGuiGameViewerP;};#undef SoGuiParentClass#undef SOGUI_OBJECT_HEADER#endif /* SOGUI_GAME_VIEWER_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -