mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
More hacking on Widgets.
This commit is contained in:
parent
aee66e0119
commit
f337616741
15 changed files with 135 additions and 19 deletions
|
@ -12,6 +12,19 @@ EventLoopSDL::~EventLoopSDL()
|
|||
{
|
||||
}
|
||||
|
||||
static inline MouseButton toMouseButton(byte sdlButton)
|
||||
{
|
||||
printf("sdlbutton = %u\n", sdlButton);
|
||||
if (sdlButton == 1)
|
||||
return MouseButton::Left;
|
||||
if (sdlButton == 2)
|
||||
return MouseButton::Middle;
|
||||
if (sdlButton == 3)
|
||||
return MouseButton::Right;
|
||||
ASSERT_NOT_REACHED();
|
||||
return MouseButton::None;
|
||||
}
|
||||
|
||||
void EventLoopSDL::waitForEvent()
|
||||
{
|
||||
SDL_Event sdlEvent;
|
||||
|
@ -30,6 +43,9 @@ void EventLoopSDL::waitForEvent()
|
|||
case SDL_MOUSEMOTION:
|
||||
postEvent(&AbstractScreen::the(), make<MouseEvent>(Event::MouseMove, sdlEvent.motion.x, sdlEvent.motion.y));
|
||||
return;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
postEvent(&AbstractScreen::the(), make<MouseEvent>(Event::MouseDown, sdlEvent.button.x, sdlEvent.button.y, toMouseButton(sdlEvent.button.button)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue