modularization: main, game, balls, c_index, spaceship, gravity

This commit is contained in:
Antonio Carzaniga
2021-12-11 21:32:48 +01:00
parent 1fec301126
commit 9028f1af74
13 changed files with 587 additions and 437 deletions

31
game.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef GAME_H_INCLUDED
#define GAME_H_INCLUDED
#include <gtk/gtk.h>
/* simulation/game framework
*/
extern double delta; /* simulation time delta in seconds */
#define DEFAULT_DELTA 0.01
extern unsigned int width; /* game canvas width */
extern unsigned int height; /* game canvas height */
#define DEFAULT_WIDTH 800
#define DEFAULT_HEIGHT 800
extern GtkWidget * canvas; /* game canvas object */
#if 0
extern void game_init (); /* implemented by the application */
/* game frame function to be provided by the game application */
extern gboolean game_draw_frame (GtkWidget * widget, cairo_t * cr, gpointer data);
extern void set_game_resize_callback (gboolean (*game_resize) ());
extern void set_game_keyboard_input_callback (gint (*keyboard_input)(GtkWidget *, GdkEventKey *));
extern void set_game_mouse_scroll_callback (gboolean (*mouse_scroll)(GtkWidget *, GdkEvent *, gpointer));
#endif
#endif