- Quatre mamonaes que he fet en el portatil
This commit is contained in:
6
main.cpp
6
main.cpp
@@ -172,6 +172,12 @@ int main(int argc, char *argv[])
|
|||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
if (e.type == SDL_QUIT) { zx_system::shutdown(); break; }
|
if (e.type == SDL_QUIT) { zx_system::shutdown(); break; }
|
||||||
|
if (e.type == SDL_JOYDEVICEADDED) {
|
||||||
|
printf("JOYSTICK CONECTAT: %i\n", e.jdevice.which);
|
||||||
|
}
|
||||||
|
if (e.type == SDL_JOYDEVICEREMOVED) {
|
||||||
|
printf("JOYSTICK DESCONECTAT: %i\n", e.jdevice.which);
|
||||||
|
}
|
||||||
if (e.type == SDL_MOUSEBUTTONDOWN) result = ui::window::sendEvent(e.button.windowID, &e);
|
if (e.type == SDL_MOUSEBUTTONDOWN) result = ui::window::sendEvent(e.button.windowID, &e);
|
||||||
if (e.type == SDL_MOUSEBUTTONUP) result = ui::window::sendEvent(e.button.windowID, &e);
|
if (e.type == SDL_MOUSEBUTTONUP) result = ui::window::sendEvent(e.button.windowID, &e);
|
||||||
if (e.type == SDL_MOUSEMOTION) result = ui::window::sendEvent(e.motion.windowID, &e);
|
if (e.type == SDL_MOUSEMOTION) result = ui::window::sendEvent(e.motion.windowID, &e);
|
||||||
|
|||||||
18
ui.cpp
18
ui.cpp
@@ -30,6 +30,8 @@ namespace ui
|
|||||||
|
|
||||||
bool clicked = false;
|
bool clicked = false;
|
||||||
|
|
||||||
|
void (*dialog)(void) = nullptr;
|
||||||
|
|
||||||
SDL_Texture * createtexture(SDL_Renderer *renderer)
|
SDL_Texture * createtexture(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, SDL_LoadBMP("font.bmp"));
|
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, SDL_LoadBMP("font.bmp"));
|
||||||
@@ -131,4 +133,20 @@ namespace ui
|
|||||||
return clicked;
|
return clicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setDialog(void(*dialog)(void))
|
||||||
|
{
|
||||||
|
ui:dialog = dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasDialog()
|
||||||
|
{
|
||||||
|
return dialog != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void callDialog()
|
||||||
|
{
|
||||||
|
if (dialog) dialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user