- [FIX] estaven mal els opcodes LDH i els nous ADD sp,e8 i LD hl,sp+e8
- [NEW] Modul sm83dis per a mostrar el desensamblat del codi completat - [NEW] Afegits moduls ui, ui_menu i ui_window, i el font.bmp, quasi tal qual des del projecte z80
This commit is contained in:
33
ui_window.cpp
Normal file
33
ui_window.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "ui_window.h"
|
||||
#include <vector>
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace window
|
||||
{
|
||||
struct window_t
|
||||
{
|
||||
Uint32 window;
|
||||
bool (*callback)(SDL_Event*);
|
||||
};
|
||||
std::vector<window_t> windows;
|
||||
|
||||
void registerWindow(Uint32 window, bool(*callback)(SDL_Event*))
|
||||
{
|
||||
for (auto win : windows) if (win.window == window) return;
|
||||
windows.push_back((window_t){window, callback});
|
||||
}
|
||||
|
||||
void unregisterWindow(Uint32 window)
|
||||
{
|
||||
for (auto win = windows.begin(); win != windows.end(); win++) if ((*win).window == window) { windows.erase(win); return; }
|
||||
}
|
||||
|
||||
bool sendEvent(Uint32 window, SDL_Event *e)
|
||||
{
|
||||
for (auto win : windows) if (win.window == window) return win.callback(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user