Fix issue in Rocket.lua script.
[cafu-Engine.git] / Ca3DE / ClientMainWindow.hpp
blob1a1e0006dd405f9cb3dd497e618386a81350ee02
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
7 #ifndef CAFU_CLIENT_MAIN_WINDOW_HPP_INCLUDED
8 #define CAFU_CLIENT_MAIN_WINDOW_HPP_INCLUDED
10 #include "MainWindow/glfwWindow.hpp"
11 #include "Util/Util.hpp"
12 #include "Resources.hpp"
15 namespace cf { class CompositeConsoleT; }
16 class GameInfoT;
19 /// This class represents the OS's main window for the Cafu client.
20 class ClientMainWindowT : public cf::glfwWindowT
22 public:
24 /// The constructor.
25 ClientMainWindowT(const GameInfoT& GameInfo, int width, int height, const char* title, GLFWmonitor* monitor=0);
27 /// The destructor.
28 ~ClientMainWindowT();
30 void Init(cf::CompositeConsoleT& CC, const std::string& ConsoleText, MainWindowT& MainWin);
31 void runFrame();
33 void FramebufferSizeEvent(int width, int height) override;
34 void KeyEvent(int key, int scancode, int action, int mods) override;
35 void CharEvent(unsigned int codepoint) override;
36 void MouseMoveEvent(double xpos, double ypos) override;
37 void MouseButtonEvent(int button, int action, int mods) override;
38 void MouseScrollEvent(double xoffset, double yoffset) override;
40 static int getCaKey(int glfwKey);
41 static int getGlfwKey(int caKey);
44 private:
46 enum LastMousePosT { IN_CLIENT_3D_GUI, IN_OTHER_2D_GUI };
48 void TakeScreenshot() const;
50 const GameInfoT& m_GameInfo;
51 ResourcesT* m_Resources;
52 TimerT m_Timer;
53 double m_TotalTime;
54 LastMousePosT m_LastMousePos; ///< Used to prevent unwanted changes to the player's heading and pitch when we're switching back from a 2D GUI to the 3D client view.
55 double m_LastMousePosX;
56 double m_LastMousePosY;
59 #endif