blues/sys.h

68 lines
1.9 KiB
C
Raw Normal View History

2018-07-08 16:08:53 +02:00
#ifndef SYS_H__
#define SYS_H__
#include "intern.h"
#define INPUT_DIRECTION_LEFT (1 << 0)
#define INPUT_DIRECTION_RIGHT (1 << 1)
#define INPUT_DIRECTION_UP (1 << 2)
#define INPUT_DIRECTION_DOWN (1 << 3)
#define SYS_AUDIO_FREQ 22050
2018-12-16 15:28:52 +01:00
#define RENDER_SPR_GAME 0 /* player sprites */
#define RENDER_SPR_LEVEL 1 /* level sprites */
#define RENDER_SPR_FG 2 /* foreground tiles */
2018-07-08 16:08:53 +02:00
struct input_t {
2018-07-16 14:43:34 +02:00
uint8_t direction;
bool quit;
bool escape;
bool space;
2018-12-16 13:34:03 +01:00
bool digit1, digit2, digit3;
2018-07-08 16:08:53 +02:00
};
typedef void (*sys_audio_cb)(void *, uint8_t *data, int len);
2018-07-12 13:21:15 +02:00
struct sys_rect_t {
int x, y;
int w, h;
};
2018-08-12 14:27:20 +02:00
enum sys_transition_e {
TRANSITION_SQUARE,
TRANSITION_CURTAIN
};
2018-07-08 16:08:53 +02:00
struct sys_t {
struct input_t input;
int (*init)();
void (*fini)();
2018-07-16 14:43:34 +02:00
void (*set_screen_size)(int w, int h, const char *caption, int scale, const char *filter, bool fullscreen);
2018-12-16 13:34:03 +01:00
void (*set_screen_palette)(const uint8_t *colors, int offset, int count, int depth);
2018-07-13 14:34:11 +02:00
void (*set_palette_amiga)(const uint16_t *colors, int offset);
2018-07-08 16:08:53 +02:00
void (*set_copper_bars)(const uint16_t *data);
2018-12-16 13:34:03 +01:00
void (*set_palette_color)(int i, const uint8_t *colors);
2018-07-08 16:08:53 +02:00
void (*fade_in_palette)();
void (*fade_out_palette)();
void (*update_screen)(const uint8_t *p, int present);
2018-08-12 14:27:20 +02:00
void (*transition_screen)(enum sys_transition_e type, bool open);
2018-07-08 16:08:53 +02:00
void (*process_events)();
void (*sleep)(int duration);
uint32_t (*get_timestamp)();
void (*start_audio)(sys_audio_cb callback, void *param);
void (*stop_audio)();
void (*lock_audio)();
void (*unlock_audio)();
2018-12-16 15:28:52 +01:00
void (*render_load_sprites)(int spr_type, int count, const struct sys_rect_t *r, const uint8_t *data, int w, int h, int palette_offset, uint8_t color_key);
void (*render_unload_sprites)(int spr_type);
void (*render_add_sprite)(int spr_type, int frame, int x, int y, int xflip);
void (*render_clear_sprites)();
void (*render_set_sprites_clipping_rect)(int x, int y, int w, int h);
2018-07-08 16:08:53 +02:00
};
extern struct sys_t g_sys;
#endif /* SYS_H__ */