new widgets

This commit is contained in:
IlyaShurupov 2024-06-19 22:17:18 +03:00
parent 3dce41ea39
commit 8f62c8f387
18 changed files with 373 additions and 43 deletions

View file

@ -43,6 +43,7 @@ void EventHandler::processEvent() {
switch (eventData.type) {
case InputEvent::Type::MOUSE_POS:
{
mPointerPrev = mPointer;
mPointer = eventData.mouseEvent;
mEventQueue.popFront();
break;
@ -77,6 +78,8 @@ void EventHandler::processEvent() {
const Vec2F& EventHandler::getPointer() const { return mPointer; }
const Vec2F& EventHandler::getPointerPrev() const { return mPointerPrev; }
bool EventHandler::isPressed(InputID id) const {
return mInputStates[(int) id].mCurrentState == InputState::State::PRESSED;
}
@ -92,4 +95,6 @@ bool EventHandler::isDown(InputID id) const {
mInputStates[(int) id].mCurrentState == InputState::State::HOLD;
}
halnf EventHandler::getScrollY() const { return 0; }
halnf EventHandler::getScrollY() const { return 0; }
Vec2F EventHandler::getPointerDelta() const { return mPointer - mPointerPrev; }

View file

@ -23,6 +23,17 @@ void Application::run() {
bool redrawNeeded = false;
// proc first frame by default
{
mWindow->processEvents();
processFrame(eventHandler);
mGraphics->drawBegin();
drawFrame(mGraphics->getCanvas());
mGraphics->drawEnd();
mWindow->draw();
}
while (!mWindow->shouldClose()) {
if (mProcTimer.isTimeout()) {