Skip to content
박상희 (Alex Park) edited this page Jan 28, 2019 · 1 revision

Table of Content

GameWindow

Wow, That's a lot of function to document.....
That's alotta DAM-AGE for me.
Well, Here we go again.

GameWindow

s_pCurrentGameWindow

window pointer used by static WndProc to call the actual window process

m_bActive

bool

whether window is Active or Not

m_bFullScr

bool

whether window is fullscreen or Not

m_hWnd

HWND

Window Handler

m_width

int

width of window

m_height

int

height of window

WndProc

(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)

static WndProc entry

Create

(bool bCreateFullScr, int width, int height)

Creates GameWindow size of width and height and sets the property (WindowRect.left, WindowRect.right, WindowRect.top, WindowRect.bottom, m_bFullScr, m_width, m_height) of GameWindow

if bCreateFullScr, clears memory, ChangeDisplaySettings with the system, if failed, returns false.

if bCreateFullScr, adjust Window with WS_EX_APPWINDOW and WS_POPUP. else, adjust Window with WS_EX_APPWINDOW|WS_EX_WINDOWEDGE and WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX.

Create Window with CreateWindowEx, with class MyGameWindowClass and set the title depending on _TRIAL flag. (_TRIAL : true.東方怪綺談 ~ Mystic Square ver 0.01 / false.東方怪綺談 ~ Mystic Square ver 1.00) with Window setting declared at above.

Create new CGLContext (delete if it is not NULL) as m_pGLContext, and call m_pGLContext->MakeCurrent()

set the glViewPort to the Window and set it as foreground window and give window a focus.

Destroy

()

DestroyWindow(m_hWnd) and unregister class

ToggleFullScreen

()

Basically Toggles Full Screen

WindowProc

(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM, lParam)

The Process of the Window
Function of this function depends on which uMsg was sent,
if WM_PAINT, if it is not Active, it calls game->OnPaintInactivate()

if WM_ACTIVATE,
if wParam's LOW-Order is WA_INACTIVE,
Show Minimized Window if fullscreen flag is active.
execute Game->Deactivate() is activated if it is not WA_INACTIVE,
showWindow with hWnd, Create Window with dmScreenSettings(DEVMODE)
and set the m_bActive = true and call Game->OnActivate();
-> Needs to be transcribed to human-readable documentation.

if WM_SYSCOMMAND,
disables screensaver and monitor powersave

if WM_COMMAND, if wParam's LOW-Order is 0,
call ToggleFullScreen();

if WM_CLOSE,
call PostQuitMessage(0); return 0

everything without return 0 is processed DefWindowProc() afterwards.