2022-02-28 15:38:08 +01:00
|
|
|
#ifndef LZY_H_
|
|
|
|
#define LZY_H_
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
int LZY_Init(void);
|
|
|
|
int LZY_Deinit(void);
|
|
|
|
int LZY_DrawBegin(void);
|
|
|
|
int LZY_DrawEnd(void);
|
|
|
|
void LZY_DrawSetColor(uint8_t r, uint8_t g, uint8_t b);
|
2022-02-28 15:49:33 +01:00
|
|
|
void LZY_DrawSetColorNone(void);
|
2022-02-28 15:38:08 +01:00
|
|
|
int LZY_DrawClear(void);
|
|
|
|
void LZY_CycleEvents(void);
|
|
|
|
int LZY_KeyDown(unsigned int scancode);
|
|
|
|
const char *LZY_GetError(void);
|
|
|
|
|
|
|
|
#ifdef FXCG50
|
|
|
|
#include <gint/keycodes.h>
|
|
|
|
enum LZY_ScanCode {
|
|
|
|
LZY_SC_ESCAPE = KEY_EXIT,
|
|
|
|
};
|
|
|
|
#else /* end FXCG50, begin SDL2 */
|
|
|
|
#include <SDL.h>
|
|
|
|
enum LZY_ScanCode {
|
|
|
|
LZY_SC_ESCAPE = SDLK_ESCAPE,
|
|
|
|
};
|
|
|
|
#endif /* SDL2 */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* LZY_H_ */
|
|
|
|
|
|
|
|
/* implementation */
|
|
|
|
#ifdef LZY_IMPLEMENTATION
|
|
|
|
#ifndef LZY_TILE_SIZE
|
|
|
|
#define LZY_TILE_SIZE 16
|
|
|
|
#endif
|
|
|
|
#ifdef FXCG50
|
|
|
|
#include <gint/display.h>
|
2022-02-28 15:49:33 +01:00
|
|
|
#include <gint/keyboard.h>
|
2022-02-28 15:38:08 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
static color_t draw_color;
|
|
|
|
|
|
|
|
int LZY_Init(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int LZY_Deinit(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int LZY_DrawBegin(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int LZY_DrawEnd(void) {
|
2022-02-28 15:49:33 +01:00
|
|
|
dupdate();
|
2022-02-28 15:38:08 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LZY_DrawSetColor(uint8_t r, uint8_t g, uint8_t b) {
|
|
|
|
draw_color = C_RGB(r << 3, g << 3, b << 3);
|
|
|
|
}
|
|
|
|
|
2022-02-28 15:49:33 +01:00
|
|
|
void LZY_DrawSetColorNone(void) {
|
|
|
|
draw_color = C_NONE;
|
|
|
|
}
|
|
|
|
|
2022-02-28 15:38:08 +01:00
|
|
|
int LZY_DrawClear(void) {
|
2022-02-28 15:49:33 +01:00
|
|
|
dclear(draw_color);
|
2022-02-28 15:38:08 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-02-28 15:49:33 +01:00
|
|
|
void LZY_CycleEvents(void) {
|
|
|
|
clearevents();
|
|
|
|
}
|
2022-02-28 15:38:08 +01:00
|
|
|
|
|
|
|
int LZY_KeyDown(unsigned int scancode) {
|
2022-02-28 15:49:33 +01:00
|
|
|
return keydown(scancode);
|
2022-02-28 15:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *LZY_GetError(void) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* end FXCG50, begin SDL2 */
|
|
|
|
#include <SDL.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
int LZY_Init(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int LZY_Deinit(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int LZY_DrawBegin(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int LZY_DrawEnd(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LZY_DrawSetColor(uint8_t r, uint8_t g, uint8_t b) {}
|
|
|
|
|
2022-02-28 15:49:33 +01:00
|
|
|
void LZY_DrawSetColorNone(void) {}
|
|
|
|
|
2022-02-28 15:38:08 +01:00
|
|
|
int LZY_DrawClear(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LZY_CycleEvents(void) {}
|
|
|
|
|
|
|
|
int LZY_KeyDown(unsigned int scancode) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *LZY_GetError(void) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif /* SDL2 */
|
|
|
|
#endif /* LZY_IMPLEMENTATION */
|