mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-06-12 11:29:29 +00:00
35c86ad6bf
Result of running IWYU (https://include-what-you-use.org/) and applying most of the suggestions about unncessary includes and forward declarations. Was motivated by observing that <thread> was being included in ppcopcodes.cpp even though it was unused (found while researching the use of threads), but seems generally good to help with build times and correctness.
90 lines
2.4 KiB
C++
90 lines
2.4 KiB
C++
/*
|
|
DingusPPC - The Experimental PowerPC Macintosh emulator
|
|
Copyright (C) 2018-23 divingkatae and maximum
|
|
(theweirdo) spatium
|
|
|
|
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <core/hostevents.h>
|
|
#include <core/coresignal.h>
|
|
#include <cpu/ppc/ppcemu.h>
|
|
#include <SDL.h>
|
|
|
|
EventManager* EventManager::event_manager;
|
|
|
|
void EventManager::poll_events()
|
|
{
|
|
SDL_Event event;
|
|
|
|
while (SDL_PollEvent(&event)) {
|
|
events_captured++;
|
|
|
|
switch (event.type) {
|
|
case SDL_QUIT:
|
|
power_on = false;
|
|
break;
|
|
|
|
case SDL_WINDOWEVENT: {
|
|
WindowEvent we;
|
|
we.sub_type = event.window.event;
|
|
we.window_id = event.window.windowID;
|
|
this->_window_signal.emit(we);
|
|
}
|
|
break;
|
|
|
|
case SDL_KEYDOWN:
|
|
key_downs++;
|
|
break;
|
|
|
|
case SDL_KEYUP:
|
|
key_ups++;
|
|
break;
|
|
|
|
case SDL_MOUSEMOTION: {
|
|
MouseEvent me;
|
|
me.xrel = event.motion.xrel;
|
|
me.yrel = event.motion.yrel;
|
|
me.flags = MOUSE_EVENT_MOTION;
|
|
this->_mouse_signal.emit(me);
|
|
}
|
|
break;
|
|
|
|
case SDL_MOUSEBUTTONDOWN: {
|
|
MouseEvent me;
|
|
me.buttons_state = 1;
|
|
me.flags = MOUSE_EVENT_BUTTON;
|
|
this->_mouse_signal.emit(me);
|
|
}
|
|
break;
|
|
|
|
case SDL_MOUSEBUTTONUP: {
|
|
MouseEvent me;
|
|
me.buttons_state = 0;
|
|
me.flags = MOUSE_EVENT_BUTTON;
|
|
this->_mouse_signal.emit(me);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
unhandled_events++;
|
|
}
|
|
}
|
|
|
|
// perform post-processing
|
|
this->_post_signal.emit();
|
|
}
|