Files
libakgl/include/sdl3game/game.h

58 lines
1.1 KiB
C
Raw Normal View History

#ifndef _GAME_H_
#define _GAME_H_
#include <SDL3_mixer/SDL_mixer.h>
#include "tilemap.h"
#define GAME_AUDIO_TRACK_BGM 1
#define GAME_AUDIO_MAX_TRACKS 64
#define TIME_ONESEC_NS 1000000000
#define TIME_ONESEC_MS 1000000
/* ==================== GAME STATE VARIABLES =================== */
typedef struct {
float w;
float h;
SDL_Texture *texture;
} GAME_frame;
typedef struct {
int flags;
} GameState;
typedef struct {
char name[256];
char version[32];
char uri[256];
int screenwidth;
int screenheight;
GameState state;
int fps;
SDL_Time gameStartTime;
SDL_Time lastIterTime;
SDL_Time lastFPSTime;
int framesSinceUpdate;
MIX_Mixer *mixer;
MIX_Track *tracks[GAME_AUDIO_MAX_TRACKS];
} Game;
extern SDL_Window *window;
extern SDL_Renderer *renderer;
extern tilemap gamemap;
extern MIX_Audio *bgm;
extern SDL_FRect camera;
extern Game game;
#define BITMASK_HAS(x, y) (x & y) == y
#define BITMASK_ADD(x, y) x |= y
#define BITMASK_DEL(x, y) x &= ~(y)
#define BITMASK_CLEAR(x) x = 0;
akerr_ErrorContext AKERR_NOIGNORE *GAME_init();
void GAME_updateFPS();
#endif //_GAME_H_