Nebula
Loading...
Searching...
No Matches
win32displaydevice.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
13
14//------------------------------------------------------------------------------
15namespace Win32
16{
18{
21public:
25 virtual ~Win32DisplayDevice();
26
28 virtual bool Open();
30 virtual void Close();
32 virtual void Reopen();
34 virtual void ProcessWindowMessages();
35
37 virtual void PostEvent(const Win32::Win32Event& winEvent);
38
40 HWND GetHwnd() const;
41
42protected:
44 static LRESULT CALLBACK WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
46 virtual bool WindowOpen();
48 virtual void CloseWindow();
50 virtual bool EmbedWindow();
52 virtual void OnMinimized();
54 virtual void OnRestored();
56 virtual bool OnSetCursor();
58 virtual void OnPaint();
60 virtual void OnSetFocus();
62 virtual void OnKillFocus();
64 virtual void OnCloseRequested();
66 virtual void OnToggleFullscreenWindowed();
68 virtual void OnResize(WORD width, WORD height);
70 virtual void OnKeyDown(LPARAM lParam, WPARAM wParam);
72 virtual void OnKeyUp(LPARAM lParam, WPARAM wParam);
74 virtual void OnChar(WPARAM wParam);
76 virtual void OnMouseButton(UINT uMsg, LPARAM lParam);
78 virtual void OnMouseMove(LPARAM lParam);
80 virtual void OnMouseWheel(WPARAM wParam);
82 Input::Key::Code TranslateKeyCode(LPARAM lParam, WPARAM wParam) const;
86 Math::float2 ComputeAbsMousePos(LPARAM lParam) const;
88 Math::float2 ComputeNormMousePos(const Math::float2& absMousePos) const;
89
90 HINSTANCE hInst;
91 HWND hWnd;
93 HACCEL hAccel;
97
98 enum
99 {
101 };
102};
103
104//------------------------------------------------------------------------------
107inline HWND
109{
110 return this->hWnd;
111}
112
113} // namespace CoreGraphics
114//------------------------------------------------------------------------------
115
116
A DisplayDevice object represents the display where the RenderDevice presents the rendered frame.
Definition displaydevicebase.h:29
Describe a fullscreen display mode or window dimensions.
Definition displaymode.h:19
Code
key codes
Definition key.h:25
Win32 implementation of DisplayDevice class.
Definition win32displaydevice.h:18
virtual void OnResize(WORD width, WORD height)
called when WM_SIZE gets propagated
Definition win32displaydevice.cc:413
virtual ~Win32DisplayDevice()
destructor
Definition win32displaydevice.cc:44
virtual void OnKeyUp(LPARAM lParam, WPARAM wParam)
called on WM_KEYUP
Definition win32displaydevice.cc:435
virtual void Close()
close the display
Definition win32displaydevice.cc:80
__DeclareSingleton(Win32DisplayDevice)
DWORD fullscreenStyle
Definition win32displaydevice.h:95
HACCEL hAccel
Definition win32displaydevice.h:93
Math::float2 ComputeAbsMousePos(LPARAM lParam) const
compute absolute mouse position from lParam
Definition win32displaydevice.cc:458
virtual void OnRestored()
called on WM_SIZE when window is restored
Definition win32displaydevice.cc:342
virtual void OnPaint()
called on WM_PAINT
Definition win32displaydevice.cc:366
virtual void OnCloseRequested()
called on WM_CLOSE to request if window should be closed
Definition win32displaydevice.cc:395
virtual void PostEvent(const Win32::Win32Event &winEvent)
posts an event sent from an external source (useful for embedded windows)
Definition win32displaydevice.cc:848
virtual void OnKillFocus()
called on WM_KILLFOCUS
Definition win32displaydevice.cc:385
virtual void OnMouseMove(LPARAM lParam)
called on WM_MOUSEMOVE
Definition win32displaydevice.cc:542
HWND hWnd
Definition win32displaydevice.h:91
Math::float2 ComputeNormMousePos(const Math::float2 &absMousePos) const
compute normalized mouse position from absolute mouse pos
Definition win32displaydevice.cc:467
virtual bool OnSetCursor()
called on WM_SETCURSOR
Definition win32displaydevice.cc:357
virtual void OnMouseButton(UINT uMsg, LPARAM lParam)
called on mouse button event
Definition win32displaydevice.cc:488
virtual void OnSetFocus()
called on WM_SETFOCUS
Definition win32displaydevice.cc:375
__DeclareClass(Win32DisplayDevice)
HINSTANCE hInst
Definition win32displaydevice.h:90
virtual void Reopen()
reopens the display
Definition win32displaydevice.cc:91
virtual void OnMinimized()
called on WM_SIZE when window is minimized
Definition win32displaydevice.cc:332
Input::Key::Code TranslateKeyCode(LPARAM lParam, WPARAM wParam) const
translate a Windows virtual key code into a Nebula key code
Definition win32displaydevice.cc:691
virtual CoreGraphics::DisplayMode ComputeAdjustedWindowRect()
adjust window size taking client area into account
Definition win32displaydevice.cc:302
DWORD childWindowStyle
Definition win32displaydevice.h:96
@ AccelToggleFullscreen
Definition win32displaydevice.h:100
HWND parentHwnd
Definition win32displaydevice.h:92
virtual void OnKeyDown(LPARAM lParam, WPARAM wParam)
called on WM_KEYDOWN
Definition win32displaydevice.cc:422
HWND GetHwnd() const
get the application window HWND
Definition win32displaydevice.h:108
virtual bool WindowOpen()
open the application window
virtual void ProcessWindowMessages()
process window system messages, call this method once per frame
Definition win32displaydevice.cc:127
virtual void CloseWindow()
close the application window
Definition win32displaydevice.cc:273
virtual bool Open()
open the display
Definition win32displaydevice.cc:57
virtual void OnChar(WPARAM wParam)
called on WM_CHAR
Definition win32displaydevice.cc:448
DWORD windowedStyle
Definition win32displaydevice.h:94
virtual void OnToggleFullscreenWindowed()
called when Alt-Enter is pressed
Definition win32displaydevice.cc:404
virtual bool EmbedWindow()
opens the window embedded
Definition win32displaydevice.cc:247
static LRESULT CALLBACK WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
the WinProc
Definition win32displaydevice.cc:571
Win32DisplayDevice()
constructor
Definition win32displaydevice.cc:28
virtual void OnMouseWheel(WPARAM wParam)
called on WM_MOUSEWHEEL
Definition win32displaydevice.cc:553
Win32 implementation of an event synchronization object.
Definition win32event.h:18
[TODO: Describe Win32 subsystem]
Definition scalar.h:58