first commit

This commit is contained in:
2019-08-23 10:54:57 +08:00
parent 9790a5757c
commit f768bbec4b
65 changed files with 5551 additions and 0 deletions

66
src/Window.cpp Normal file
View File

@@ -0,0 +1,66 @@
#include<hgl/platform/Window.h>
namespace hgl
{
void Window::ProcKeyDown(KeyboardButton kb)
{
if(key_push[kb])
ProcKeyPress(kb);
else
key_push[kb]=true;
SafeCallEvent(OnKeyDown,(kb));
}
void Window::ProcKeyUp(KeyboardButton kb)
{
key_push[kb]=false;
SafeCallEvent(OnKeyUp,(kb));
}
void Window::ProcResize(uint w,uint h)
{
if(w==width&&height==h)
return;
width=w;
height=h;
if(w==0||h==0)
{
is_min=true;
}
else
{
is_min=false;
}
SafeCallEvent(OnResize,(w,h));
}
void Window::ProcActive(bool a)
{
active=a;
SafeCallEvent(OnActive,(a));
}
void Window::ProcClose()
{
is_close=true;
SafeCallEvent(OnClose,());
}
bool Window::Update()
{
while(MessageProc());
if(is_close)
return(false);
if(!active||is_min)
this->WaitMessage();
return(true);
}
}//namespace hgl