sculpto
windows_window.h
Go to the documentation of this file.
1/*!****************************************************************//*!*
2 * \file window.h
3 * \brief Window window_handle definition module.
4 *
5 * \author Sabitov Kirill
6 * \date 18 June 2022
7 *********************************************************************/
8
9#pragma once
10
12#include "windows_input.h"
13
14namespace scl
15{
16 class windows_window: public window
17 {
18 private:
19 HINSTANCE InstanceHandle {};
20 int MouseWheel {};
21 RECT FullscreenRect {};
22
23 // Initialisation timer need to call resize callback after all application is beeing initialised in application constructor,
24 // because resiz windows resize message passed immedeatly after window creation, before windows_window contructor ended.
25 // Timer callback called only when application run function is called.
26 UINT InitialisationTimer {};
27
28 private:
29 static LRESULT WIN32 WinProc(window_handle hWnd, u32 Msg,
30 WPARAM wParam, LPARAM lParam);
31
32 private:
35 // Window messages
36 bool OnCreate(window_handle WindowHandle, CREATESTRUCT *CS);
37 void OnSize(window_handle WindowHandle, u32 State, int W, int H);
38 bool OnClose(window_handle WindowHandle);
39 void OnDestroy(window_handle WindowHandle);
40 void OnActivate(window_handle WindowHandle, u32 Reason, HWND hWndActDeact, bool IsMinimized);
41 void OnTimer(window_handle WindowHandle, UINT id);
42
43 // Window draw messages
44 bool OnEraseBackground(window_handle WindowHandle, HDC hDC);
45 void OnPaint(window_handle WindowHandle);
46
47 // Mouse messages
48 void OnMMove(HWND hwnd, int x, int y, u32 keyFlags);
49 void OnMWheel(window_handle WindowHandle, int X, int Y, int Z, u32 Keys);
50 void OnMButDown(window_handle WindowHandle, bool IsDblClick, int X, int Y, u32 Keys);
51 void OnMButUp(window_handle WindowHandle, int X, int Y, u32 Keys);
52
53 // Keyboard messages
54 void OnKey(HWND hwnd, u32 vk, bool fDown, int cRepeat, u32 flags);
55
56 /*!*
57 * Window creation function.
58 *
59 * \param None.
60 * \return None.
61 */
62 void Create();
63
64 public:
65 /*!*
66 * Windows OS specific window construcotor.
67 * Initialise window, but don't shows it and don't start message loop.
68 * If initialisation successful 'IsStartupSuccess' would be set to true
69 * and then window message loop could be started.
70 *
71 * \param Width - Width of the creating window in pixels.
72 * \param Height - Height of creating window in pixels.
73 * \param Name - Title of the creating window.
74 * \param VSync - vertical syncrosination enabling flag.
75 */
76 windows_window(int Width, int Height, const std::string &Title);
77
78 /*!*
79 * Window update function.
80 *
81 * \param None.
82 * \return None.
83 */
84 void Update() override;
85
86 /*!*
87 * Woggle window display mode (fullscreen/windowed) function.
88 *
89 * \param None.
90 * \return None.
91 */
92 void FlipFullscreen() override;
93
94 /*!*
95 * Change window title to specified.
96 *
97 * \param NewTitle - new window title.
98 * \return None.
99 */
100 void ChangeTitle(const std::string &NewTitle) override;
101
102 /*!*
103 * Window shut down function. Closes window and create window close event.
104 *
105 * \param None.
106 * \return None.
107 */
108 void ShutDown() override;
109 };
110}
void ShutDown() override
void FlipFullscreen() override
void ChangeTitle(const std::string &NewTitle) override
windows_window(int Width, int Height, const std::string &Title)
void Update() override
Definition: base.h:33
uint32_t u32
Definition: math_common.h:21
int window_handle
Definition: base.h:55
Abstract, platform independent class definition module.
Input window_handle definition module.