Crazy Eddie's GUI System  ${CEGUI_VERSION}
CEGuiGLFWSharedBase.h
1 /***********************************************************************
2  created: 12/2/2012
3  author: Paul D Turner
4 *************************************************************************/
5 /***************************************************************************
6 * Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 ***************************************************************************/
27 #ifndef _CEGuiGLFWSharedBase_h_
28 #define _CEGuiGLFWSharedBase_h_
29 
30 #include "CEGuiBaseApplication.h"
31 #include "CEGUI/MouseCursor.h"
32 #include <GL/glfw.h>
33 
35 
37 {
38 public:
41 
42 protected:
43  // implementation of base class abstract functions.
44  void run();
45  void destroyWindow();
46  void beginRendering(const float elapsed);
47  void endRendering();
48 
49  /*************************************************************************
50  Implementation Methods
51  *************************************************************************/
52  static void initGLFW();
53  static void createGLFWWindow();
54  static void setGLFWAppConfiguration();
55 
56  void drawFrame();
57 
58  static void GLFWCALL glfwKeyCallback(int key, int action);
59  static void GLFWCALL glfwCharCallback(int character, int action);
60  static void GLFWCALL glfwMouseButtonCallback(int key, int action);
61  static void GLFWCALL glfwMouseWheelCallback(int position);
62  static void GLFWCALL glfwMousePosCallback(int x, int y );
63 
64  static int GLFWCALL glfwWindowCloseCallback(void);
65  static void GLFWCALL glfwWindowResizeCallback(int width, int height);
66 
67  static CEGUI::Key::Scan GlfwToCeguiKey(int glfwKey);
68  static CEGUI::MouseButton GlfwToCeguiMouseButton(int glfwButton);
69 
70  /*************************************************************************
71  Data fields
72  *************************************************************************/
73  static CEGuiGLFWSharedBase* d_appInstance;
74  static double d_frameTime;
75  static int d_modifiers;
76 
77  static bool d_windowSized;
78  static int d_newWindowWidth;
79  static int d_newWindowHeight;
80 
81  static bool d_mouseLeftWindow;
82  static bool d_mouseDisableCalled;
83  static int d_oldMousePosX;
84  static int d_oldMousePosY;
85 };
86 
87 
88 #endif // end of guard _CEGuiGLFWSharedBase_h_
89 
Definition: CEGuiGLFWSharedBase.h:36
MouseButton
Enumeration of mouse buttons.
Definition: cegui/include/CEGUI/InputEvent.h:209
void destroyWindow()
The abstract function for destroying the renderer and the window.
Definition: CEGuiGLFWSharedBase.cpp:105
void endRendering()
Implementation function to perform required post-render operations.
Definition: CEGuiGLFWSharedBase.cpp:117
void run()
The abstract function for initialising and running the application.
Definition: CEGuiGLFWSharedBase.cpp:67
This is a base class that is intended to be used for all sample applications. Here we take care of co...
Definition: SamplesFrameworkBase.h:42
Base application abstract base class.
Definition: CEGuiBaseApplication.h:67
void beginRendering(const float elapsed)
Implementation function to perform required pre-render operations.
Definition: CEGuiGLFWSharedBase.cpp:111