initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#ifndef SKELE_BLIT_H
|
||||
#define SKELE_BLIT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void skele_video_blit(uint8_t *pixels);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SKELE_BLIT_H */
|
||||
@@ -0,0 +1,132 @@
|
||||
#ifndef SKELE_INPUT_H
|
||||
#define SKELE_INPUT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
SKELE_KEY_UNKNOWN = 0,
|
||||
|
||||
SKELE_KEY_A,
|
||||
SKELE_KEY_B,
|
||||
SKELE_KEY_C,
|
||||
SKELE_KEY_D,
|
||||
SKELE_KEY_E,
|
||||
SKELE_KEY_F,
|
||||
SKELE_KEY_G,
|
||||
SKELE_KEY_H,
|
||||
SKELE_KEY_I,
|
||||
SKELE_KEY_J,
|
||||
SKELE_KEY_K,
|
||||
SKELE_KEY_L,
|
||||
SKELE_KEY_M,
|
||||
SKELE_KEY_N,
|
||||
SKELE_KEY_O,
|
||||
SKELE_KEY_P,
|
||||
SKELE_KEY_Q,
|
||||
SKELE_KEY_R,
|
||||
SKELE_KEY_S,
|
||||
SKELE_KEY_T,
|
||||
SKELE_KEY_U,
|
||||
SKELE_KEY_V,
|
||||
SKELE_KEY_W,
|
||||
SKELE_KEY_X,
|
||||
SKELE_KEY_Y,
|
||||
SKELE_KEY_Z,
|
||||
|
||||
SKELE_KEY_0,
|
||||
SKELE_KEY_1,
|
||||
SKELE_KEY_2,
|
||||
SKELE_KEY_3,
|
||||
SKELE_KEY_4,
|
||||
SKELE_KEY_5,
|
||||
SKELE_KEY_6,
|
||||
SKELE_KEY_7,
|
||||
SKELE_KEY_8,
|
||||
SKELE_KEY_9,
|
||||
|
||||
SKELE_KEY_F1,
|
||||
SKELE_KEY_F2,
|
||||
SKELE_KEY_F3,
|
||||
SKELE_KEY_F4,
|
||||
SKELE_KEY_F5,
|
||||
SKELE_KEY_F6,
|
||||
SKELE_KEY_F7,
|
||||
SKELE_KEY_F8,
|
||||
SKELE_KEY_F9,
|
||||
SKELE_KEY_F10,
|
||||
SKELE_KEY_F11,
|
||||
SKELE_KEY_F12,
|
||||
|
||||
SKELE_KEY_SPACE,
|
||||
SKELE_KEY_ENTER,
|
||||
SKELE_KEY_ESCAPE,
|
||||
SKELE_KEY_TAB,
|
||||
SKELE_KEY_BACKSPACE,
|
||||
SKELE_KEY_LSHIFT,
|
||||
SKELE_KEY_RSHIFT,
|
||||
SKELE_KEY_LCTRL,
|
||||
SKELE_KEY_RCTRL,
|
||||
SKELE_KEY_LALT,
|
||||
SKELE_KEY_RALT,
|
||||
|
||||
SKELE_KEY_UP,
|
||||
SKELE_KEY_DOWN,
|
||||
SKELE_KEY_LEFT,
|
||||
SKELE_KEY_RIGHT,
|
||||
|
||||
SKELE_KEY_COUNT
|
||||
} skele_key_t;
|
||||
|
||||
typedef enum {
|
||||
SKELE_PAD_A,
|
||||
SKELE_PAD_B,
|
||||
SKELE_PAD_X,
|
||||
SKELE_PAD_Y,
|
||||
SKELE_PAD_LB,
|
||||
SKELE_PAD_RB,
|
||||
SKELE_PAD_LT,
|
||||
SKELE_PAD_RT,
|
||||
SKELE_PAD_LSTICK,
|
||||
SKELE_PAD_RSTICK,
|
||||
SKELE_PAD_START,
|
||||
SKELE_PAD_BACK,
|
||||
SKELE_PAD_DPAD_UP,
|
||||
SKELE_PAD_DPAD_DOWN,
|
||||
SKELE_PAD_DPAD_LEFT,
|
||||
SKELE_PAD_DPAD_RIGHT,
|
||||
SKELE_PAD_BUTTON_COUNT
|
||||
} skele_pad_button_t;
|
||||
|
||||
typedef enum {
|
||||
SKELE_PAD_AXIS_LX,
|
||||
SKELE_PAD_AXIS_LY,
|
||||
SKELE_PAD_AXIS_RX,
|
||||
SKELE_PAD_AXIS_RY,
|
||||
SKELE_PAD_AXIS_LT,
|
||||
SKELE_PAD_AXIS_RT,
|
||||
SKELE_PAD_AXIS_COUNT
|
||||
} skele_pad_axis_t;
|
||||
|
||||
#define SKELE_MAX_PADS 4
|
||||
|
||||
uint8_t skele_input_poll(void);
|
||||
|
||||
uint8_t skele_key_down(skele_key_t key);
|
||||
uint8_t skele_key_held(skele_key_t key);
|
||||
|
||||
uint8_t skele_pad_connected(uint8_t pad);
|
||||
uint8_t skele_pad_button_down(uint8_t pad, skele_pad_button_t btn);
|
||||
uint8_t skele_pad_button_held(uint8_t pad, skele_pad_button_t btn);
|
||||
float skele_pad_axis(uint8_t pad, skele_pad_axis_t axis);
|
||||
|
||||
void skele_mouse_delta(int32_t *dx, int32_t *dy);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SKELE_INPUT_H */
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef SKELE_PALETTE_H
|
||||
#define SKELE_PALETTE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SKELE_PALETTE_COLORS 256
|
||||
|
||||
typedef uint32_t skele_palette_t[SKELE_PALETTE_COLORS];
|
||||
|
||||
void skele_palette_set(skele_palette_t pal);
|
||||
void skele_palette_set_index(uint8_t index, uint32_t color);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SKELE_PALETTE_H */
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef SKELE_VIDEO_H
|
||||
#define SKELE_VIDEO_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SKELE_VIDEO_FULLSCREEN 0x01
|
||||
#define SKELE_VIDEO_BORDERLESS 0x02
|
||||
#define SKELE_VIDEO_RESIZABLE 0x04
|
||||
#define SKELE_VIDEO_HIGHDPI 0x08
|
||||
|
||||
#define SKELE_DEFAULT_RENDER_WIDTH 320
|
||||
#define SKELE_DEFAULT_RENDER_HEIGHT 200
|
||||
|
||||
typedef struct {
|
||||
uint16_t render_width;
|
||||
uint16_t render_height;
|
||||
uint16_t window_width;
|
||||
uint16_t window_height;
|
||||
uint8_t flags;
|
||||
} skele_video_config_t;
|
||||
|
||||
uint8_t skele_video_init(skele_video_config_t cfg);
|
||||
void skele_video_shutdown(void);
|
||||
void skele_video_present(void);
|
||||
void skele_video_set_title(const char *title);
|
||||
void skele_video_toggle_fullscreen(void);
|
||||
void skele_video_cycle_scale(void);
|
||||
void skele_video_set_mouse_grab(uint8_t grab);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SKELE_VIDEO_H */
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef SKELE_CLOCK_H
|
||||
#define SKELE_CLOCK_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void skele_clock_init(void (*on_signal)(void));
|
||||
uint64_t skele_time_ns(void);
|
||||
void skele_sleep_ns(uint64_t ns);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SKELE_CLOCK_H */
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef SKELE_H
|
||||
#define SKELE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SKELE_VERSION_MAJOR 0
|
||||
#define SKELE_VERSION_MINOR 0
|
||||
#define SKELE_VERSION_PATCH 0
|
||||
|
||||
#define SKELE_STR(x) #x
|
||||
#define SKELE_XSTR(x) SKELE_STR(x)
|
||||
#define SKELE_VERSION \
|
||||
SKELE_XSTR(SKELE_VERSION_MAJOR) \
|
||||
"." SKELE_XSTR(SKELE_VERSION_MINOR) "." SKELE_XSTR(SKELE_VERSION_PATCH)
|
||||
|
||||
#define SKELE_INIT_SUCCESS 1
|
||||
#define SKELE_INIT_FAILURE 0
|
||||
|
||||
#define SKELE_DEFAULT_TICK_RATE 35
|
||||
|
||||
extern uint64_t skele_tick_ns;
|
||||
|
||||
void skele_set_tick_rate(uint8_t rate);
|
||||
uint8_t skele_init(void);
|
||||
void skele_shutdown(void);
|
||||
void skele_tick(void);
|
||||
|
||||
uint8_t skele_stk_setup(void);
|
||||
void skele_stk_teardown(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SKELE_H */
|
||||
Reference in New Issue
Block a user