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.
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
; }
19 /// This class represents the OS's main window for the Cafu client.
20 class ClientMainWindowT
: public cf::glfwWindowT
25 ClientMainWindowT(const GameInfoT
& GameInfo
, int width
, int height
, const char* title
, GLFWmonitor
* monitor
=0);
30 void Init(cf::CompositeConsoleT
& CC
, const std::string
& ConsoleText
, MainWindowT
& MainWin
);
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
);
46 enum LastMousePosT
{ IN_CLIENT_3D_GUI
, IN_OTHER_2D_GUI
};
48 void TakeScreenshot() const;
50 const GameInfoT
& m_GameInfo
;
51 ResourcesT
* m_Resources
;
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
;