[nostalgia] Add implementation of single tile sprites on OpenGL

This commit is contained in:
2023-01-03 03:37:51 -06:00
parent cf6c05f4c6
commit bb643bce42
11 changed files with 312 additions and 99 deletions
+7 -9
View File
@@ -32,15 +32,13 @@ ox::Error run(Context *ctx) noexcept {
while (!glfwWindowShouldClose(id->window)) {
glfwPollEvents();
const auto ticks = ticksMs(ctx);
if (id->eventHandler) {
if (id->wakeupTime <= ticks) {
sleepTime = id->eventHandler(ctx);
if (sleepTime >= 0) {
id->wakeupTime = ticks + static_cast<unsigned>(sleepTime);
} else {
id->wakeupTime = ~uint64_t(0);
}
}
if (id->wakeupTime <= ticks) {
sleepTime = id->eventHandler(ctx);
if (sleepTime >= 0) {
id->wakeupTime = ticks + static_cast<unsigned>(sleepTime);
} else {
id->wakeupTime = ~uint64_t(0);
}
} else {
sleepTime = 10;
}
+1 -1
View File
@@ -11,7 +11,7 @@ namespace nostalgia::core {
struct GlfwImplData {
struct GLFWwindow *window = nullptr;
int64_t startTime = 0;
UpdateHandler eventHandler = nullptr;
UpdateHandler eventHandler = [](Context*) -> int {return 0;};
KeyEventHandler keyEventHandler = nullptr;
uint64_t wakeupTime = 0;
uint64_t keysDown = 0;