Commit f5b33292 authored by dewyatt's avatar dewyatt

Renamed Window::Update to Window::Handle_Events.

Removed Window::Clear.
Added Window::Show_Cursor/Hide_Cursor.
Added On_Resized event.
parent fca96b4c
...@@ -24,10 +24,11 @@ public: ...@@ -24,10 +24,11 @@ public:
void Show(); void Show();
void Hide(); void Hide();
void Update(); void Handle_Events();
void Display(); void Display();
void Clear(); void Show_Cursor();
void Hide_Cursor();
private: private:
static const wchar_t *Window_Class_Name; static const wchar_t *Window_Class_Name;
......
...@@ -5,10 +5,10 @@ class Window_Listener ...@@ -5,10 +5,10 @@ class Window_Listener
{ {
public: public:
virtual void On_Close(){} virtual void On_Close(){}
virtual void On_Key_Down(int Key){} virtual void On_Key_Down(int Key){}
virtual void On_Key_Up(int Key){} virtual void On_Key_Up(int Key){}
virtual void On_Char(unsigned int Char){} virtual void On_Char(unsigned int Char){}
virtual void On_Resized(unsigned int Width, unsigned int Height){}
}; };
#endif #endif
...@@ -17,6 +17,7 @@ Window::Window() : my_Handle(0), ...@@ -17,6 +17,7 @@ Window::Window() : my_Handle(0),
Window::~Window() Window::~Window()
{ {
Finalize(); Finalize();
Show_Cursor();
} }
void Window::Initialize(const std::wstring &Title, const Video_Mode &Mode, bool Fullscreen) void Window::Initialize(const std::wstring &Title, const Video_Mode &Mode, bool Fullscreen)
...@@ -219,6 +220,9 @@ LRESULT Window::Handle_Message(HWND Handle, UINT Message, WPARAM wParam, LPARAM ...@@ -219,6 +220,9 @@ LRESULT Window::Handle_Message(HWND Handle, UINT Message, WPARAM wParam, LPARAM
{ {
switch (Message) switch (Message)
{ {
case WM_SIZE:
Call_Listener(On_Resized(LOWORD(lParam), HIWORD(lParam)));
break;
case WM_CLOSE: case WM_CLOSE:
Call_Listener(On_Close()); Call_Listener(On_Close());
break; break;
...@@ -250,7 +254,7 @@ void Window::Hide() ...@@ -250,7 +254,7 @@ void Window::Hide()
ShowWindow(my_Handle, SW_HIDE); ShowWindow(my_Handle, SW_HIDE);
} }
void Window::Update() void Window::Handle_Events()
{ {
MSG Message = {0}; MSG Message = {0};
while (PeekMessageW(&Message, NULL, 0, 0, PM_REMOVE)) while (PeekMessageW(&Message, NULL, 0, 0, PM_REMOVE))
...@@ -266,7 +270,12 @@ void Window::Display() ...@@ -266,7 +270,12 @@ void Window::Display()
SwapBuffers(my_Device_Context); SwapBuffers(my_Device_Context);
} }
void Window::Clear() void Window::Show_Cursor()
{
ShowCursor(TRUE);
}
void Window::Hide_Cursor()
{ {
glClear(GL_COLOR_BUFFER_BIT); ShowCursor(FALSE);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment