minecraft-pi-reborn/media-layer/core/src/base.cpp

39 lines
656 B
C++
Raw Normal View History

2021-02-21 19:53:17 +00:00
#include <vector>
#include <SDL/SDL.h>
2024-05-12 01:14:14 +00:00
#include <libreborn/libreborn.h>
2021-06-17 21:32:24 +00:00
2024-10-20 05:19:08 +00:00
#include "media.h"
2021-02-21 19:53:17 +00:00
// SDL Is Replaced With GLFW
2024-10-20 05:19:08 +00:00
int media_SDL_Init(__attribute__((unused)) uint32_t flags) {
2021-02-21 19:53:17 +00:00
return 0;
}
// Event Queue
static std::vector<SDL_Event> queue;
2024-10-20 05:19:08 +00:00
int media_SDL_PollEvent(SDL_Event *event) {
2021-06-17 21:32:24 +00:00
// Handle External Events
2024-10-20 05:19:08 +00:00
_media_handle_media_SDL_PollEvent();
2021-06-17 21:32:24 +00:00
// Poll Event
2021-02-21 19:53:17 +00:00
int ret;
if (queue.size() > 0) {
*event = queue[0];
queue.erase(queue.begin());
ret = 1;
} else {
ret = 0;
}
return ret;
}
2024-10-20 05:19:08 +00:00
int media_SDL_PushEvent(SDL_Event *event) {
2021-02-21 19:53:17 +00:00
queue.push_back(*event);
return 1;
}