summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Maiolino <[email protected]>2025-11-29 18:49:34 +0100
committerCarlos Maiolino <[email protected]>2025-11-29 18:49:34 +0100
commite6bb80a1aa60681992dba22823100900a4f22201 (patch)
tree4931fc5849e3744e107ed85208acb53fcca5d255
parent4242664fcd5d2c3e0fe24ffec038c3767276f3e5 (diff)
Add a couple macros to set screen center
Signed-off-by: Carlos Maiolino <[email protected]>
-rw-r--r--src/include/rb.h7
-rw-r--r--src/rb.c2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/include/rb.h b/src/include/rb.h
index abbeb0e..0752bc2 100644
--- a/src/include/rb.h
+++ b/src/include/rb.h
@@ -3,8 +3,10 @@
#include <allegro5/allegro5.h>
-#define RB_WIDTH 640
-#define RB_HEIGHT 480
+#define RB_WIDTH 1600
+#define RB_HEIGHT 900
+#define RB_X_CENTER (RB_WIDTH / 2)
+#define RB_Y_CENTER (RB_HEIGHT / 2)
#define RB_FPS (1.0 / 80.0) /* 1 sec divided by 30 frames */
struct rb {
@@ -17,6 +19,5 @@ struct rb {
ALLEGRO_FONT *font;
};
-struct display_struct *display;
#endif /* RB_H */
diff --git a/src/rb.c b/src/rb.c
index 0307d57..a478671 100644
--- a/src/rb.c
+++ b/src/rb.c
@@ -175,7 +175,7 @@ start_game(struct rb *rb)
case ALLEGRO_EVENT_MOUSE_AXES:
dx += event.mouse.dx * 0.1;
dy += event.mouse.dy * 0.1;
- al_set_mouse_xy(rb->display, 320, 240);
+ al_set_mouse_xy(rb->display, RB_X_CENTER, RB_Y_CENTER);
break;
case ALLEGRO_EVENT_KEY_DOWN: