ports/doom: Update to new LibGUI interface

This commit is contained in:
Bananymous 2025-05-07 16:35:39 +03:00
parent 0380c68f89
commit 92d26f2216
3 changed files with 8 additions and 6 deletions

View File

@ -5,7 +5,7 @@ VERSION='git'
DOWNLOAD_URL="https://github.com/ozkl/doomgeneric.git#613f870b6fa83ede448a247de5a2571092fa729d" DOWNLOAD_URL="https://github.com/ozkl/doomgeneric.git#613f870b6fa83ede448a247de5a2571092fa729d"
configure() { configure() {
: make --directory doomgeneric clean
} }
build() { build() {

View File

@ -79,7 +79,7 @@ new file mode 100644
index 0000000..9161771 index 0000000..9161771
--- /dev/null --- /dev/null
+++ b/doomgeneric/doomgeneric_banan_os.cpp +++ b/doomgeneric/doomgeneric_banan_os.cpp
@@ -0,0 +1,138 @@ @@ -0,0 +1,139 @@
+extern "C" +extern "C"
+{ +{
+#include "doomgeneric.h" +#include "doomgeneric.h"
@ -166,9 +166,10 @@ index 0000000..9161771
+ +
+void DG_DrawFrame() +void DG_DrawFrame()
+{ +{
+ auto& texture = s_window->texture();
+ for (size_t y = 0; y < DOOMGENERIC_RESY; y++) + for (size_t y = 0; y < DOOMGENERIC_RESY; y++)
+ for (size_t x = 0; x < DOOMGENERIC_RESX; x++) + for (size_t x = 0; x < DOOMGENERIC_RESX; x++)
+ s_window->set_pixel(x, y, 0xFF000000 | DG_ScreenBuffer[y * DOOMGENERIC_RESX + x]); + texture.set_pixel(x, y, 0xFF000000 | DG_ScreenBuffer[y * DOOMGENERIC_RESX + x]);
+ s_window->invalidate(); + s_window->invalidate();
+ s_window->poll_events(); + s_window->poll_events();
+} +}

View File

@ -25,20 +25,21 @@ diff --git a/doomgeneric/doomgeneric_banan_os.cpp b/doomgeneric/doomgeneric_bana
index d00c30d..9d13b43 100644 index d00c30d..9d13b43 100644
--- a/doomgeneric/doomgeneric_banan_os.cpp --- a/doomgeneric/doomgeneric_banan_os.cpp
+++ b/doomgeneric/doomgeneric_banan_os.cpp +++ b/doomgeneric/doomgeneric_banan_os.cpp
@@ -80,13 +80,13 @@ void DG_Init() @@ -80,14 +80,13 @@ void DG_Init()
s_key_write_index = (s_key_write_index + 1) % s_key_queue_size; s_key_write_index = (s_key_write_index + 1) % s_key_queue_size;
} }
); );
+ +
+ ASSERT(DG_ScreenBuffer == nullptr); + ASSERT(DG_ScreenBuffer == nullptr);
+ DG_ScreenBuffer = s_window->pixels().data(); + DG_ScreenBuffer = s_window->texture().pixels().data();
} }
void DG_DrawFrame() void DG_DrawFrame()
{ {
- auto& texture = s_window->texture();
- for (size_t y = 0; y < DOOMGENERIC_RESY; y++) - for (size_t y = 0; y < DOOMGENERIC_RESY; y++)
- for (size_t x = 0; x < DOOMGENERIC_RESX; x++) - for (size_t x = 0; x < DOOMGENERIC_RESX; x++)
- s_window->set_pixel(x, y, 0xFF000000 | DG_ScreenBuffer[y * DOOMGENERIC_RESX + x]); - texture.set_pixel(x, y, 0xFF000000 | DG_ScreenBuffer[y * DOOMGENERIC_RESX + x]);
s_window->invalidate(); s_window->invalidate();
s_window->poll_events(); s_window->poll_events();
} }