- [WIP] nova UI
This commit is contained in:
1 parent
6c205fb014
commit
dedd6b6285
4 files changed
+57
-2
No files matched your search
+40
-1
@@ -26,16 +26,55 @@ namespace ui
|
||||
bool Window::HandleEvents(SDL_Event *e)
|
||||
{
|
||||
switch (e->type) {
|
||||
case SDL_EVENT_WINDOW_EXPOSED:
|
||||
case SDL_EVENT_WINDOW_SHOWN:
|
||||
this->Update();
|
||||
break;
|
||||
|
||||
case SDL_EVENT_MOUSE_MOTION:
|
||||
input.mouse.x = e->motion.x;
|
||||
input.mouse.y = e->motion.y;
|
||||
this->Update();
|
||||
break;
|
||||
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
||||
input.mouse.buttons[e->button.button-1] = mbsDown;
|
||||
this->Update();
|
||||
input.mouse.buttons[e->button.button-1] = mbsPressed;
|
||||
break;
|
||||
|
||||
case SDL_EVENT_MOUSE_BUTTON_UP:
|
||||
input.mouse.buttons[e->button.button-1] = mbsUp;
|
||||
this->Update();
|
||||
input.mouse.buttons[e->button.button-1] = mbsReleased;
|
||||
break;
|
||||
|
||||
// ...
|
||||
case SDL_EVENT_MOUSE_WHEEL:
|
||||
input.mouse.wheel = e->wheel.integer_y;
|
||||
this->Update();
|
||||
input.mouse.wheel = 0;
|
||||
break;
|
||||
|
||||
case SDL_EVENT_KEY_DOWN:
|
||||
input.keyboard.keyDown = e->key.scancode;
|
||||
this->Update();
|
||||
input.keyboard.keyDown = 0;
|
||||
break;
|
||||
|
||||
case SDL_EVENT_KEY_UP:
|
||||
input.keyboard.keyUp = e->key.scancode;
|
||||
this->Update();
|
||||
input.keyboard.keyUp = 0;
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void Window::Update()
|
||||
{
|
||||
this->context->Clear(0xff1e1e1e);
|
||||
}
|
||||
|
||||
/* MÈTODES ESTATICS */
|
||||
/* ================ */
|
||||
|
||||
Reference in new issue
Block a user