|
|
|
#ifndef _DEFGAME
|
|
|
|
#define _DEFGAME
|
|
|
|
|
|
|
|
#include "environment.h"
|
|
|
|
#include "datastructures/datatypes.h"
|
|
|
|
#include "vect.h"
|
|
|
|
#include "controlscheme.h"
|
|
|
|
#include "c-colours/colours.h"
|
|
|
|
#include "types.h"
|
|
|
|
#include "draw.h"
|
|
|
|
|
|
|
|
extern GlobWorld world;
|
|
|
|
extern int level;
|
|
|
|
extern bool in_game;
|
|
|
|
extern int quality;
|
|
|
|
|
|
|
|
|
|
|
|
struct draw_watcher {
|
|
|
|
long best_time;
|
|
|
|
bool finish_level;
|
|
|
|
bool goto_level;
|
|
|
|
bool high_contrast_mode;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct ui_state {
|
|
|
|
struct textbox_info *currently_bound_textbox;
|
|
|
|
int goto_new_level;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum TextBoxId {
|
|
|
|
TB_LEVEL_CHOOSER = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct textbox_info {
|
|
|
|
enum TextBoxId id;
|
|
|
|
bool capture_input_text_field;
|
|
|
|
char text_input[32];
|
|
|
|
int text_input_bufpos;
|
|
|
|
void (*close_callback)(struct textbox_info *textbox, void*callback);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct draw_watcher draw_watch;
|
|
|
|
extern struct textbox_info* texboxes;
|
|
|
|
extern struct ui_state gameui;
|
|
|
|
|
|
|
|
|
|
|
|
void handle_input_event(SDL_Event event);
|
|
|
|
|
|
|
|
// add a motor to the world
|
|
|
|
void add_motor(Body *thing, double x, double y);
|
|
|
|
|
|
|
|
bool get_motor_active(Body *thing, int i);
|
|
|
|
|
|
|
|
/* temporary storage variable *n should be initialised to the seed value */
|
|
|
|
int get_rand(int *n);
|
|
|
|
|
|
|
|
void next_level(int lvl);
|
|
|
|
|
|
|
|
int step(void);
|
|
|
|
|
|
|
|
struct sg_times_list {
|
|
|
|
long *times;
|
|
|
|
int size;
|
|
|
|
int capacity;
|
|
|
|
void (*sort)(void);
|
|
|
|
char *filename;
|
|
|
|
};
|
|
|
|
|
|
|
|
int load_score_times(char *filename);
|
|
|
|
|
|
|
|
|
|
|
|
/* array of all the things in the world and their kinds */
|
|
|
|
|
|
|
|
extern struct sg_times_list save_times_lst;
|
|
|
|
int add_time(long time);
|
|
|
|
int write_times(void);
|
|
|
|
extern void startgame(SDL_Renderer * ren) ;
|
|
|
|
extern void process_keydown(SDL_Keysym key);
|
|
|
|
extern void process_keyup(SDL_Keysym key);
|
|
|
|
extern player_st player;
|
|
|
|
extern long level_time;
|
|
|
|
extern bool game_paused;
|
|
|
|
#endif
|