diff examples/example-cursor/example-cursor.c @ 459:541cb950997b

examples: add libmlk-example library
author David Demelier <markand@malikania.fr>
date Sun, 26 Feb 2023 19:44:47 +0100
parents 773a082f0b91
children 5729efd23286
line wrap: on
line diff
--- a/examples/example-cursor/example-cursor.c	Fri Feb 24 22:14:42 2023 +0100
+++ b/examples/example-cursor/example-cursor.c	Sun Feb 26 19:44:47 2023 +0100
@@ -73,18 +73,18 @@
 }
 
 static void
-handle(struct state *st, const union event *ev)
+handle(struct state *st, const union mlk_event *ev)
 {
 	(void)st;
 
 	switch (ev->type) {
-	case EVENT_KEYDOWN:
+	case MLK_EVENT_KEYDOWN:
 		switch (ev->key.key) {
-		case KEY_LEFT:
+		case MLK_KEY_LEFT:
 			if (cursor > 0)
 				change(--cursor);
 			break;
-		case KEY_RIGHT:
+		case MLK_KEY_RIGHT:
 			if (cursor + 1 < WINDOW_CURSOR_LAST)
 				change(++cursor);
 			break;
@@ -94,8 +94,8 @@
 
 
 		break;
-	case EVENT_QUIT:
-		game_quit();
+	case MLK_EVENT_QUIT:
+		mlk_game_quit();
 		break;
 	default:
 		break;
@@ -107,10 +107,10 @@
 {
 	(void)st;
 
-	painter_set_color(0xebede9ff);
-	painter_clear();
+	mlk_painter_set_color(0xebede9ff);
+	mlk_painter_clear();
 	label_draw(&help);
-	painter_present();
+	mlk_painter_present();
 }
 
 static void
@@ -123,9 +123,9 @@
 
 	change(cursor);
 
-	game_init(states, UTIL_SIZE(states));
-	game_push(&state);
-	game_loop();
+	mlk_game_init(states, UTIL_SIZE(states));
+	mlk_game_push(&state);
+	mlk_game_loop();
 }
 
 static void