update examples with the refactor file structure and its features

This commit is contained in:
2026-10-06 12:31:00 +02:00
parent 5ad2d899fe
commit cc00883a57
3 changed files with 18 additions and 8 deletions
+7 -3
View File
@@ -1,4 +1,6 @@
#include "engine.h" #include <dangerzone/engine.h>
#include <dangerzone/render/misc.h>
#include <dangerzone/render/text.h>
// polling events every frame // polling events every frame
void void
@@ -28,8 +30,8 @@ client_update_framebuffer()
// single green demo pixel // single green demo pixel
game_state->framebuffer[0] = 0x00FF00; game_state->framebuffer[0] = 0x00FF00;
put_rect(0, 0, 1100, 200, 0xFFFF00); clear_framebuffer(0xFFFF00);
put_string("Hello, traveller. You have come\nto the right place!", put_string("Welcome to the most\n*DANGEROUS* 2048 game!",
20, 20, 2, 2, 3, 0x000000, 0xFFFF00 20, 20, 2, 2, 3, 0x000000, 0xFFFF00
); );
} }
@@ -39,6 +41,8 @@ main()
{ {
// initialize the engine // initialize the engine
if (engine_init( if (engine_init(
500, 500,
"Dangerous 2048",
client_poll_event, client_poll_event,
client_update_framebuffer client_update_framebuffer
)) { )) {
+4 -4
View File
@@ -1,8 +1,8 @@
#add_executable(snake snake.c) add_executable(game_snake snake.c)
#target_link_libraries(snake PRIVATE dangerzone_engine) target_link_libraries(game_snake PRIVATE dangerzone_engine)
#add_executable(game_2048 2048.c) add_executable(game_2048 2048.c)
#target_link_libraries(game_2048 PRIVATE dangerzone_engine) target_link_libraries(game_2048 PRIVATE dangerzone_engine)
add_executable(game_window window.c) add_executable(game_window window.c)
target_link_libraries(game_window PRIVATE dangerzone_engine) target_link_libraries(game_window PRIVATE dangerzone_engine)
+7 -1
View File
@@ -1,4 +1,8 @@
#include "engine.h" #include <dangerzone/engine.h>
#include <dangerzone/render/rect.h>
#include <dangerzone/render/text.h>
#include <dangerzone/render/misc.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
@@ -331,6 +335,8 @@ main()
// initialize the engine // initialize the engine
if (engine_init( if (engine_init(
500, 500,
"Dangerous Snake",
client_poll_event, client_poll_event,
client_update_framebuffer client_update_framebuffer
)) { )) {