Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Renamed Window::Update to Window::Handle_Events.
Browse files Browse the repository at this point in the history
Removed Window::Clear.
Added Window::Show_Cursor/Hide_Cursor.
Added On_Resized event.
  • Loading branch information
dewyatt committed Jun 12, 2010
1 parent b5e4ed3 commit 381873f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
5 changes: 3 additions & 2 deletions EXCLUDE/GLTSF/include/Window.hpp
Expand Up @@ -24,10 +24,11 @@ class Window
void Show();
void Hide();

void Update();
void Handle_Events();
void Display();

void Clear();
void Show_Cursor();
void Hide_Cursor();

private:
static const wchar_t *Window_Class_Name;
Expand Down
2 changes: 1 addition & 1 deletion EXCLUDE/GLTSF/include/Window_Listener.hpp
Expand Up @@ -5,10 +5,10 @@ class Window_Listener
{
public:
virtual void On_Close(){}

virtual void On_Key_Down(int Key){}
virtual void On_Key_Up(int Key){}
virtual void On_Char(unsigned int Char){}
virtual void On_Resized(unsigned int Width, unsigned int Height){}
};

#endif
15 changes: 12 additions & 3 deletions EXCLUDE/GLTSF/src/Window.cpp
Expand Up @@ -17,6 +17,7 @@ Window::Window() : my_Handle(0),
Window::~Window()
{
Finalize();
Show_Cursor();
}

void Window::Initialize(const std::wstring &Title, const Video_Mode &Mode, bool Fullscreen)
Expand Down Expand Up @@ -219,6 +220,9 @@ LRESULT Window::Handle_Message(HWND Handle, UINT Message, WPARAM wParam, LPARAM
{
switch (Message)
{
case WM_SIZE:
Call_Listener(On_Resized(LOWORD(lParam), HIWORD(lParam)));
break;
case WM_CLOSE:
Call_Listener(On_Close());
break;
Expand Down Expand Up @@ -250,7 +254,7 @@ void Window::Hide()
ShowWindow(my_Handle, SW_HIDE);
}

void Window::Update()
void Window::Handle_Events()
{
MSG Message = {0};
while (PeekMessageW(&Message, NULL, 0, 0, PM_REMOVE))
Expand All @@ -266,7 +270,12 @@ void Window::Display()
SwapBuffers(my_Device_Context);
}

void Window::Clear()
void Window::Show_Cursor()
{
ShowCursor(TRUE);
}

void Window::Hide_Cursor()
{
glClear(GL_COLOR_BUFFER_BIT);
ShowCursor(FALSE);
}

0 comments on commit 381873f

Please sign in to comment.