Add properties registry. Start bounding defines with conditionals so users can change library allocation size.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#ifndef _SDL_GAMECONTROLLERDB_H_
|
||||
#define _SDL_GAMECONTROLLERDB_H_
|
||||
|
||||
// Taken from https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/refs/heads/master/gamecontrollerdb.txt on Thu May 7 10:19:07 PM EDT 2026
|
||||
// Taken from https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/refs/heads/master/gamecontrollerdb.txt on Fri May 8 10:15:43 AM EDT 2026
|
||||
|
||||
#define AKGL_SDL_GAMECONTROLLER_DB_LEN 2225
|
||||
#define AKGL_SDL_GAMECONTROLLER_DB_LEN 2227
|
||||
|
||||
const char *SDL_GAMECONTROLLER_DB[] = {
|
||||
"03000000300f00000a01000000000000,3 In 1 Conversion Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b8,x:b3,y:b0,platform:Windows",
|
||||
@@ -1538,6 +1538,8 @@ const char *SDL_GAMECONTROLLER_DB[] = {
|
||||
"05000000853200000503000000010000,Nacon MGX Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux",
|
||||
"0300000085320000170d000011010000,Nacon Revolution 5 Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,touchpad:b13,x:b0,y:b3,platform:Linux",
|
||||
"0300000085320000190d000011010000,Nacon Revolution 5 Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,touchpad:b13,x:b0,y:b3,platform:Linux",
|
||||
"0300000085320000180d000011010000,Nacon Revolution 5 Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux",
|
||||
"0300000085320000160d000011010000,Nacon Revolution 5 Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,touchpad:b13,x:b0,y:b3,platform:Linux",
|
||||
"030000000d0f00000900000010010000,Natec Genesis P44,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux",
|
||||
"030000004f1f00000800000011010000,NeoGeo PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux",
|
||||
"0300000092120000474e000000010000,NeoGeo X Arcade Stick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b9,x:b3,y:b2,platform:Linux",
|
||||
|
||||
@@ -7,11 +7,21 @@
|
||||
#include "staticstring.h"
|
||||
#include <akerror.h>
|
||||
|
||||
#ifndef AKGL_MAX_HEAP_ACTOR
|
||||
#define AKGL_MAX_HEAP_ACTOR 64
|
||||
#endif
|
||||
#ifndef AKGL_MAX_HEAP_SPRITE
|
||||
#define AKGL_MAX_HEAP_SPRITE (AKGL_MAX_HEAP_ACTOR * 16)
|
||||
#endif
|
||||
#ifndef AKGL_MAX_HEAP_SPRITESHEET
|
||||
#define AKGL_MAX_HEAP_SPRITESHEET AKGL_MAX_HEAP_SPRITE
|
||||
#endif
|
||||
#ifndef AKGL_MAX_HEAP_CHARACTER
|
||||
#define AKGL_MAX_HEAP_CHARACTER 256
|
||||
#endif
|
||||
#ifndef AKGL_MAX_HEAP_STRING
|
||||
#define AKGL_MAX_HEAP_STRING 256
|
||||
#endif
|
||||
|
||||
extern akgl_Actor HEAP_ACTOR[AKGL_MAX_HEAP_ACTOR];
|
||||
extern akgl_Sprite HEAP_SPRITE[AKGL_MAX_HEAP_SPRITE];
|
||||
|
||||
@@ -10,6 +10,7 @@ extern SDL_PropertiesID AKGL_REGISTRY_CHARACTER;
|
||||
extern SDL_PropertiesID AKGL_AKGL_REGISTRY_ACTOR_STATE_STRINGS;
|
||||
extern SDL_PropertiesID AKGL_REGISTRY_FONT;
|
||||
extern SDL_PropertiesID AKGL_REGISTRY_MUSIC;
|
||||
extern SDL_PropertiesID AKGL_REGISTRY_PROPERTIES;
|
||||
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_init();
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_init_music();
|
||||
@@ -18,6 +19,7 @@ akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_init_actor();
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_init_sprite();
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_init_spritesheet();
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_init_character();
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_init_properties();
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_init_actor_state_strings();
|
||||
|
||||
|
||||
|
||||
@@ -21,72 +21,72 @@
|
||||
#define AKGL_TILEMAP_LAYER_TYPE_OBJECTS 2
|
||||
|
||||
typedef struct {
|
||||
float x;
|
||||
float y;
|
||||
int gid;
|
||||
int id;
|
||||
int height;
|
||||
int width;
|
||||
int rotation;
|
||||
int type;
|
||||
bool visible;
|
||||
akgl_Actor *actorptr;
|
||||
char name[AKGL_TILEMAP_MAX_OBJECT_NAME_SIZE];
|
||||
float x;
|
||||
float y;
|
||||
int gid;
|
||||
int id;
|
||||
int height;
|
||||
int width;
|
||||
int rotation;
|
||||
int type;
|
||||
bool visible;
|
||||
akgl_Actor *actorptr;
|
||||
char name[AKGL_TILEMAP_MAX_OBJECT_NAME_SIZE];
|
||||
} akgl_TilemapObject;
|
||||
|
||||
typedef struct {
|
||||
short type;
|
||||
float opacity;
|
||||
bool visible;
|
||||
int height;
|
||||
int width;
|
||||
int x;
|
||||
int y;
|
||||
int id;
|
||||
int data[AKGL_TILEMAP_MAX_WIDTH * AKGL_TILEMAP_MAX_HEIGHT];
|
||||
akgl_TilemapObject objects[AKGL_TILEMAP_MAX_OBJECTS_PER_LAYER];
|
||||
short type;
|
||||
float opacity;
|
||||
bool visible;
|
||||
int height;
|
||||
int width;
|
||||
int x;
|
||||
int y;
|
||||
int id;
|
||||
int data[AKGL_TILEMAP_MAX_WIDTH * AKGL_TILEMAP_MAX_HEIGHT];
|
||||
akgl_TilemapObject objects[AKGL_TILEMAP_MAX_OBJECTS_PER_LAYER];
|
||||
} akgl_TilemapLayer;
|
||||
|
||||
typedef struct {
|
||||
int columns;
|
||||
int firstgid;
|
||||
char imagefilename[AKGL_TILEMAP_MAX_TILESET_FILENAME_SIZE];
|
||||
int imageheight;
|
||||
int imagewidth;
|
||||
char name[AKGL_TILEMAP_MAX_TILESET_NAME_SIZE];
|
||||
SDL_Texture *texture;
|
||||
// Use this as a lookup table instead of storing tiles
|
||||
// in individual textures to blit them from a single
|
||||
// texture at runtime
|
||||
// FIXME: This is probably not very efficient. For a map
|
||||
// with a single tileset it makes sense. For a map with
|
||||
// multiple tilesets you may have set A start at firstgid 1
|
||||
// and have 1728 tiles. Set B may start at firstgid 1729 and
|
||||
// have 1728 more tiles. This means Set B has 1728 empty
|
||||
// tile_offsets[] entries before firstgid 1729 because of the
|
||||
// way akgl_tilemap_load_tilesets() works. This is really inefficient
|
||||
// and should be improved in the future, and will eventually
|
||||
// lead to premature exhaustion of AKGL_TILEMAP_MAX_TILES_PER_IMAGE
|
||||
// because set D or E may only have 64 tiles but they may be
|
||||
// at the upper end of the array bound already because of this.
|
||||
int tile_offsets[AKGL_TILEMAP_MAX_TILES_PER_IMAGE][2];
|
||||
int tilecount;
|
||||
int tileheight;
|
||||
int tilewidth;
|
||||
int spacing;
|
||||
int margin;
|
||||
int columns;
|
||||
int firstgid;
|
||||
char imagefilename[AKGL_TILEMAP_MAX_TILESET_FILENAME_SIZE];
|
||||
int imageheight;
|
||||
int imagewidth;
|
||||
char name[AKGL_TILEMAP_MAX_TILESET_NAME_SIZE];
|
||||
SDL_Texture *texture;
|
||||
// Use this as a lookup table instead of storing tiles
|
||||
// in individual textures to blit them from a single
|
||||
// texture at runtime
|
||||
// FIXME: This is probably not very efficient. For a map
|
||||
// with a single tileset it makes sense. For a map with
|
||||
// multiple tilesets you may have set A start at firstgid 1
|
||||
// and have 1728 tiles. Set B may start at firstgid 1729 and
|
||||
// have 1728 more tiles. This means Set B has 1728 empty
|
||||
// tile_offsets[] entries before firstgid 1729 because of the
|
||||
// way akgl_tilemap_load_tilesets() works. This is really inefficient
|
||||
// and should be improved in the future, and will eventually
|
||||
// lead to premature exhaustion of AKGL_TILEMAP_MAX_TILES_PER_IMAGE
|
||||
// because set D or E may only have 64 tiles but they may be
|
||||
// at the upper end of the array bound already because of this.
|
||||
int tile_offsets[AKGL_TILEMAP_MAX_TILES_PER_IMAGE][2];
|
||||
int tilecount;
|
||||
int tileheight;
|
||||
int tilewidth;
|
||||
int spacing;
|
||||
int margin;
|
||||
} akgl_Tileset;
|
||||
|
||||
typedef struct {
|
||||
int tilewidth;
|
||||
int tileheight;
|
||||
int width;
|
||||
int height;
|
||||
int numlayers;
|
||||
int orientation; // 0 = orthogonal, 1 = isometric
|
||||
int numtilesets;
|
||||
akgl_Tileset tilesets[AKGL_TILEMAP_MAX_TILESETS];
|
||||
akgl_TilemapLayer layers[AKGL_TILEMAP_MAX_LAYERS];
|
||||
int tilewidth;
|
||||
int tileheight;
|
||||
int width;
|
||||
int height;
|
||||
int numlayers;
|
||||
int orientation; // 0 = orthogonal, 1 = isometric
|
||||
int numtilesets;
|
||||
akgl_Tileset tilesets[AKGL_TILEMAP_MAX_TILESETS];
|
||||
akgl_TilemapLayer layers[AKGL_TILEMAP_MAX_LAYERS];
|
||||
} akgl_Tilemap;
|
||||
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_tilemap_load(char *fname, akgl_Tilemap *dest);
|
||||
|
||||
@@ -46,6 +46,7 @@ akerr_ErrorContext AKERR_NOIGNORE *akgl_game_init()
|
||||
CATCH(errctx, akgl_registry_init_character());
|
||||
CATCH(errctx, akgl_registry_init_font());
|
||||
CATCH(errctx, akgl_registry_init_music());
|
||||
CATCH(errctx, akgl_registry_init_properties());
|
||||
CATCH(errctx, akgl_registry_init_actor_state_strings());
|
||||
} CLEANUP {
|
||||
} PROCESS(errctx) {
|
||||
|
||||
@@ -13,6 +13,7 @@ SDL_PropertiesID AKGL_AKGL_REGISTRY_SPRITESHEET;
|
||||
SDL_PropertiesID AKGL_REGISTRY_CHARACTER;
|
||||
SDL_PropertiesID AKGL_REGISTRY_MUSIC;
|
||||
SDL_PropertiesID AKGL_REGISTRY_FONT;
|
||||
SDL_PropertiesID AKGL_REGISTRY_PROPERTIES;
|
||||
|
||||
akerr_ErrorContext *akgl_registry_init()
|
||||
{
|
||||
@@ -55,6 +56,14 @@ akerr_ErrorContext *akgl_registry_init_music()
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_registry_init_properties()
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
AKGL_REGISTRY_PROPERTIES = SDL_CreateProperties();
|
||||
FAIL_ZERO_RETURN(errctx, AKGL_REGISTRY_PROPERTIES, AKERR_NULLPOINTER, "Error initializing properties registry");
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_registry_init_actor_state_strings()
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
Reference in New Issue
Block a user