Rename library to AKGL (AKLabs Game Library)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(sdl3game LANGUAGES C)
|
project(akgl LANGUAGES C)
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
@@ -19,12 +19,12 @@ find_package(box2d REQUIRED)
|
|||||||
#pkg_check_modules(jansson REQUIRED jansson)
|
#pkg_check_modules(jansson REQUIRED jansson)
|
||||||
#pkg_check_modules(akerror REQUIRED akerror)
|
#pkg_check_modules(akerror REQUIRED akerror)
|
||||||
|
|
||||||
set(GAMECONTROLLERDB_H "include/sdl3game/SDL_GameControllerDB.h")
|
set(GAMECONTROLLERDB_H "include/akgl/SDL_GameControllerDB.h")
|
||||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
set(exec_prefix "\${prefix}")
|
set(exec_prefix "\${prefix}")
|
||||||
set(libdir "\${exec_prefix}/lib")
|
set(libdir "\${exec_prefix}/lib")
|
||||||
set(includedir "\${prefix}/include")
|
set(includedir "\${prefix}/include")
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sdl3game.pc.in ${CMAKE_CURRENT_BINARY_DIR}/sdl3game.pc @ONLY)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/akgl.pc.in ${CMAKE_CURRENT_BINARY_DIR}/akgl.pc @ONLY)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${GAMECONTROLLERDB_H}
|
OUTPUT ${GAMECONTROLLERDB_H}
|
||||||
@@ -34,7 +34,7 @@ add_custom_command(
|
|||||||
|
|
||||||
# Add include directories
|
# Add include directories
|
||||||
include_directories(${SDL3_INCLUDE_DIRS})
|
include_directories(${SDL3_INCLUDE_DIRS})
|
||||||
add_library(sdl3game SHARED
|
add_library(akgl SHARED
|
||||||
src/actor.c
|
src/actor.c
|
||||||
src/actor_state_string_names.c
|
src/actor_state_string_names.c
|
||||||
src/text.c
|
src/text.c
|
||||||
@@ -74,11 +74,11 @@ add_test(NAME tilemap COMMAND test_tilemap)
|
|||||||
add_test(NAME util COMMAND test_util)
|
add_test(NAME util COMMAND test_util)
|
||||||
|
|
||||||
# Specify include directories for the library's headers (if applicable)
|
# Specify include directories for the library's headers (if applicable)
|
||||||
target_include_directories(sdl3game PUBLIC
|
target_include_directories(akgl PUBLIC
|
||||||
include/
|
include/
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(sdl3game
|
target_link_libraries(akgl
|
||||||
PUBLIC
|
PUBLIC
|
||||||
SDL3::SDL3
|
SDL3::SDL3
|
||||||
SDL3_image::SDL3_image
|
SDL3_image::SDL3_image
|
||||||
@@ -86,34 +86,34 @@ target_link_libraries(sdl3game
|
|||||||
SDL3_ttf::SDL3_ttf
|
SDL3_ttf::SDL3_ttf
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(test_actor PRIVATE akerror::akerror sdl3game SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
target_link_libraries(test_actor PRIVATE akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
||||||
target_link_libraries(test_bitmasks PRIVATE akerror::akerror sdl3game SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
target_link_libraries(test_bitmasks PRIVATE akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
||||||
target_link_libraries(test_character PRIVATE akerror::akerror sdl3game SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
target_link_libraries(test_character PRIVATE akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
||||||
target_link_libraries(test_registry PRIVATE akerror::akerror sdl3game SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
target_link_libraries(test_registry PRIVATE akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
||||||
target_link_libraries(test_sprite PRIVATE akerror::akerror sdl3game SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
target_link_libraries(test_sprite PRIVATE akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
||||||
target_link_libraries(test_staticstring PRIVATE akerror::akerror sdl3game SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
target_link_libraries(test_staticstring PRIVATE akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
||||||
target_link_libraries(test_tilemap PRIVATE akerror::akerror sdl3game SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
target_link_libraries(test_tilemap PRIVATE akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
||||||
target_link_libraries(test_util PRIVATE akerror::akerror sdl3game SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
target_link_libraries(test_util PRIVATE akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
||||||
|
|
||||||
target_link_libraries(charviewer PRIVATE akerror::akerror sdl3game SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
target_link_libraries(charviewer PRIVATE akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer box2d::box2d jansson::jansson -lm)
|
||||||
|
|
||||||
set(main_lib_dest "lib/sdl3game-${MY_LIBRARY_VERSION}")
|
set(main_lib_dest "lib/akgl-${MY_LIBRARY_VERSION}")
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sdl3game.pc DESTINATION "lib/pkgconfig/")
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/akgl.pc DESTINATION "lib/pkgconfig/")
|
||||||
install(TARGETS sdl3game DESTINATION "lib/")
|
install(TARGETS akgl DESTINATION "lib/")
|
||||||
install(FILES "include/sdl3game/actor.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/actor.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/text.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/text.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/assets.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/assets.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/character.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/character.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/error.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/error.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/draw.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/draw.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/game.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/game.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/controller.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/controller.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/heap.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/heap.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/iterator.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/iterator.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/json_helpers.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/json_helpers.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/registry.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/registry.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/sprite.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/sprite.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/staticstring.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/staticstring.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/tilemap.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/tilemap.h" DESTINATION "include/akgl/")
|
||||||
install(FILES "include/sdl3game/util.h" DESTINATION "include/sdl3game/")
|
install(FILES "include/akgl/util.h" DESTINATION "include/akgl/")
|
||||||
install(FILES ${GAMECONTROLLERDB_H} DESTINATION "include/sdl3game/")
|
install(FILES ${GAMECONTROLLERDB_H} DESTINATION "include/akgl/")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef _SDL_GAMECONTROLLERDB_H_
|
#ifndef _SDL_GAMECONTROLLERDB_H_
|
||||||
#define _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:00:08 PM EDT 2026
|
// Taken from https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/refs/heads/master/gamecontrollerdb.txt on Thu May 7 10:19:07 PM EDT 2026
|
||||||
|
|
||||||
#define AKGL_SDL_GAMECONTROLLER_DB_LEN 2225
|
#define AKGL_SDL_GAMECONTROLLER_DB_LEN 2225
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ curl https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/refs/heads/ma
|
|||||||
|
|
||||||
filelen=$(wc -l mappings.txt | cut -d ' ' -f 1)
|
filelen=$(wc -l mappings.txt | cut -d ' ' -f 1)
|
||||||
|
|
||||||
cat > ../include/sdl3game/SDL_GameControllerDB.h <<EOF
|
cat > ../include/akgl/SDL_GameControllerDB.h <<EOF
|
||||||
#ifndef _SDL_GAMECONTROLLERDB_H_
|
#ifndef _SDL_GAMECONTROLLERDB_H_
|
||||||
#define _SDL_GAMECONTROLLERDB_H_
|
#define _SDL_GAMECONTROLLERDB_H_
|
||||||
|
|
||||||
@@ -20,11 +20,11 @@ counter=0
|
|||||||
cat mappings.txt | while read LINE;
|
cat mappings.txt | while read LINE;
|
||||||
do
|
do
|
||||||
if [[ $counter -gt 0 ]]; then
|
if [[ $counter -gt 0 ]]; then
|
||||||
printf ",\n" >> ../include/sdl3game/SDL_GameControllerDB.h;
|
printf ",\n" >> ../include/akgl/SDL_GameControllerDB.h;
|
||||||
fi
|
fi
|
||||||
printf " \"${LINE}\"" >> ../include/sdl3game/SDL_GameControllerDB.h;
|
printf " \"${LINE}\"" >> ../include/akgl/SDL_GameControllerDB.h;
|
||||||
counter=$((counter + 1))
|
counter=$((counter + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "\n};\n" >> ../include/sdl3game/SDL_GameControllerDB.h
|
printf "\n};\n" >> ../include/akgl/SDL_GameControllerDB.h
|
||||||
printf "#endif // _SDL_GAMECONTROLLERDB_H_\n" >> ../include/sdl3game/SDL_GameControllerDB.h
|
printf "#endif // _SDL_GAMECONTROLLERDB_H_\n" >> ../include/akgl/SDL_GameControllerDB.h
|
||||||
|
|||||||
2
rebuild.sh
Executable file → Normal file
2
rebuild.sh
Executable file → Normal file
@@ -5,7 +5,7 @@ export CMAKE_PREFIX_PATH=/home/andrew/local:/home/andrew/local/lib/cmake
|
|||||||
export CMAKE_MODULE_PATH=/home/andrew/local/lib/cmake
|
export CMAKE_MODULE_PATH=/home/andrew/local/lib/cmake
|
||||||
#export SDL3_DIR=/home/andrew/local
|
#export SDL3_DIR=/home/andrew/local
|
||||||
|
|
||||||
rm -fr ~/local/lib/*sdl3game* ~/local/include/sdl3game build
|
rm -fr ~/local/lib/*akgl* ~/local/include/akgl build
|
||||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
cmake --build build --parallel 4
|
cmake --build build --parallel 4
|
||||||
cmake --install build --prefix /home/andrew/local
|
cmake --install build --prefix /home/andrew/local
|
||||||
|
|||||||
14
src/actor.c
14
src/actor.c
@@ -3,13 +3,13 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
|
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/sprite.h>
|
#include <akgl/sprite.h>
|
||||||
#include <sdl3game/actor.h>
|
#include <akgl/actor.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/staticstring.h>
|
#include <akgl/staticstring.h>
|
||||||
#include <sdl3game/iterator.h>
|
#include <akgl/iterator.h>
|
||||||
|
|
||||||
akerr_ErrorContext *akgl_actor_initialize(akgl_Actor *obj, char *name)
|
akerr_ErrorContext *akgl_actor_initialize(akgl_Actor *obj, char *name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
#include <SDL3_image/SDL_image.h>
|
#include <SDL3_image/SDL_image.h>
|
||||||
#include <SDL3_mixer/SDL_mixer.h>
|
#include <SDL3_mixer/SDL_mixer.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/staticstring.h>
|
#include <akgl/staticstring.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/error.h>
|
#include <akgl/error.h>
|
||||||
|
|
||||||
akerr_ErrorContext *akgl_load_start_bgm(char *fname)
|
akerr_ErrorContext *akgl_load_start_bgm(char *fname)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,14 +4,14 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
|
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/sprite.h>
|
#include <akgl/sprite.h>
|
||||||
#include <sdl3game/json_helpers.h>
|
#include <akgl/json_helpers.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/staticstring.h>
|
#include <akgl/staticstring.h>
|
||||||
#include <sdl3game/iterator.h>
|
#include <akgl/iterator.h>
|
||||||
#include <sdl3game/util.h>
|
#include <akgl/util.h>
|
||||||
|
|
||||||
akerr_ErrorContext *akgl_character_initialize(akgl_Character *obj, char *name)
|
akerr_ErrorContext *akgl_character_initialize(akgl_Character *obj, char *name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/controller.h>
|
#include <akgl/controller.h>
|
||||||
|
|
||||||
akgl_ControlMap GAME_ControlMaps[AKGL_MAX_CONTROL_MAPS];
|
akgl_ControlMap GAME_ControlMaps[AKGL_MAX_CONTROL_MAPS];
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3_image/SDL_image.h>
|
#include <SDL3_image/SDL_image.h>
|
||||||
#include <SDL3_mixer/SDL_mixer.h>
|
#include <SDL3_mixer/SDL_mixer.h>
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
|
|
||||||
/* Draw a Gimpish background pattern to show transparency in the image */
|
/* Draw a Gimpish background pattern to show transparency in the image */
|
||||||
void akgl_draw_background(int w, int h)
|
void akgl_draw_background(int w, int h)
|
||||||
|
|||||||
18
src/game.c
18
src/game.c
@@ -5,15 +5,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
|
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/controller.h>
|
#include <akgl/controller.h>
|
||||||
#include <sdl3game/tilemap.h>
|
#include <akgl/tilemap.h>
|
||||||
#include <sdl3game/sprite.h>
|
#include <akgl/sprite.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/staticstring.h>
|
#include <akgl/staticstring.h>
|
||||||
#include <sdl3game/iterator.h>
|
#include <akgl/iterator.h>
|
||||||
#include <sdl3game/SDL_GameControllerDB.h>
|
#include <akgl/SDL_GameControllerDB.h>
|
||||||
|
|
||||||
SDL_Window *window = NULL;
|
SDL_Window *window = NULL;
|
||||||
SDL_Renderer *renderer = NULL;
|
SDL_Renderer *renderer = NULL;
|
||||||
|
|||||||
14
src/heap.c
14
src/heap.c
@@ -1,13 +1,13 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
|
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/sprite.h>
|
#include <akgl/sprite.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/staticstring.h>
|
#include <akgl/staticstring.h>
|
||||||
#include <sdl3game/iterator.h>
|
#include <akgl/iterator.h>
|
||||||
#include <sdl3game/error.h>
|
#include <akgl/error.h>
|
||||||
|
|
||||||
akgl_Actor HEAP_ACTOR[AKGL_MAX_HEAP_ACTOR];
|
akgl_Actor HEAP_ACTOR[AKGL_MAX_HEAP_ACTOR];
|
||||||
akgl_Sprite HEAP_SPRITE[AKGL_MAX_HEAP_SPRITE];
|
akgl_Sprite HEAP_SPRITE[AKGL_MAX_HEAP_SPRITE];
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
|
|
||||||
#include <sdl3game/json_helpers.h>
|
#include <akgl/json_helpers.h>
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/staticstring.h>
|
#include <akgl/staticstring.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
|
|
||||||
akerr_ErrorContext *akgl_get_json_object_value(json_t *obj, char *key, json_t **dest)
|
akerr_ErrorContext *akgl_get_json_object_value(json_t *obj, char *key, json_t **dest)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
|
|
||||||
#include <sdl3game/sprite.h>
|
#include <akgl/sprite.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/iterator.h>
|
#include <akgl/iterator.h>
|
||||||
#include <sdl3game/actor.h>
|
#include <akgl/actor.h>
|
||||||
|
|
||||||
SDL_PropertiesID AKGL_REGISTRY_ACTOR;
|
SDL_PropertiesID AKGL_REGISTRY_ACTOR;
|
||||||
SDL_PropertiesID AKGL_AKGL_REGISTRY_ACTOR_STATE_STRINGS;
|
SDL_PropertiesID AKGL_AKGL_REGISTRY_ACTOR_STATE_STRINGS;
|
||||||
|
|||||||
14
src/sprite.c
14
src/sprite.c
@@ -5,13 +5,13 @@
|
|||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
|
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/sprite.h>
|
#include <akgl/sprite.h>
|
||||||
#include <sdl3game/json_helpers.h>
|
#include <akgl/json_helpers.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/staticstring.h>
|
#include <akgl/staticstring.h>
|
||||||
#include <sdl3game/iterator.h>
|
#include <akgl/iterator.h>
|
||||||
|
|
||||||
static akerr_ErrorContext *akgl_sprite_load_json_spritesheet(json_t *json, akgl_SpriteSheet **sheet, char *relative_path)
|
static akerr_ErrorContext *akgl_sprite_load_json_spritesheet(json_t *json, akgl_SpriteSheet **sheet, char *relative_path)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
#include <sdl3game/staticstring.h>
|
#include <akgl/staticstring.h>
|
||||||
|
|
||||||
akerr_ErrorContext *akgl_string_initialize(akgl_String *obj, char *init)
|
akerr_ErrorContext *akgl_string_initialize(akgl_String *obj, char *init)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3_ttf/SDL_ttf.h>
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
#include <sdl3game/text.h>
|
#include <akgl/text.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
|
|
||||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_text_loadfont(char *name, char *filepath, int size)
|
akerr_ErrorContext AKERR_NOIGNORE *akgl_text_loadfont(char *name, char *filepath, int size)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
|
|
||||||
#include <sdl3game/tilemap.h>
|
#include <akgl/tilemap.h>
|
||||||
#include <sdl3game/actor.h>
|
#include <akgl/actor.h>
|
||||||
#include <sdl3game/json_helpers.h>
|
#include <akgl/json_helpers.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/staticstring.h>
|
#include <akgl/staticstring.h>
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
|
|
||||||
akerr_ErrorContext *akgl_get_json_tilemap_property(json_t *obj, char *key, char *type, json_t **dest)
|
akerr_ErrorContext *akgl_get_json_tilemap_property(json_t *obj, char *key, char *type, json_t **dest)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
#include <SDL3_image/SDL_image.h>
|
#include <SDL3_image/SDL_image.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
|
|
||||||
#include <sdl3game/util.h>
|
#include <akgl/util.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
|
|
||||||
akerr_ErrorContext *akgl_rectangle_points(RectanglePoints *dest, SDL_FRect *rect)
|
akerr_ErrorContext *akgl_rectangle_points(RectanglePoints *dest, SDL_FRect *rect)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <sdl3game/iterator.h>
|
#include <akgl/iterator.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/actor.h>
|
#include <akgl/actor.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
|
|
||||||
int UNHANDLED_ERROR_BEHAVIOR;
|
int UNHANDLED_ERROR_BEHAVIOR;
|
||||||
akerr_ErrorContext *unhandled_error_context;
|
akerr_ErrorContext *unhandled_error_context;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/actor.h>
|
#include <akgl/actor.h>
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
|
|
||||||
#include <sdl3game/character.h>
|
#include <akgl/character.h>
|
||||||
#include <sdl3game/actor.h>
|
#include <akgl/actor.h>
|
||||||
#include <sdl3game/error.h>
|
#include <akgl/error.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/iterator.h>
|
#include <akgl/iterator.h>
|
||||||
|
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
SDL_Renderer *renderer;
|
SDL_Renderer *renderer;
|
||||||
@@ -199,7 +199,7 @@ int main(void)
|
|||||||
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't initialize SDL: %s", SDL_GetError());
|
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't initialize SDL: %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SDL_CreateWindowAndRenderer("net/aklabs/libsdl3game/test_character", 640, 480, SDL_WINDOW_HIDDEN, &window, &renderer)) {
|
if (!SDL_CreateWindowAndRenderer("net/aklabs/libakgl/test_character", 640, 480, SDL_WINDOW_HIDDEN, &window, &renderer)) {
|
||||||
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't create window/renderer: %s", SDL_GetError());
|
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't create window/renderer: %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,17 +5,17 @@
|
|||||||
#include <SDL3_mixer/SDL_mixer.h>
|
#include <SDL3_mixer/SDL_mixer.h>
|
||||||
|
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
#include <sdl3game/assets.h>
|
#include <akgl/assets.h>
|
||||||
#include <sdl3game/iterator.h>
|
#include <akgl/iterator.h>
|
||||||
#include <sdl3game/tilemap.h>
|
#include <akgl/tilemap.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/controller.h>
|
#include <akgl/controller.h>
|
||||||
#include <sdl3game/draw.h>
|
#include <akgl/draw.h>
|
||||||
#include <sdl3game/sprite.h>
|
#include <akgl/sprite.h>
|
||||||
#include <sdl3game/actor.h>
|
#include <akgl/actor.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/error.h>
|
#include <akgl/error.h>
|
||||||
|
|
||||||
int numsprites = 8;
|
int numsprites = 8;
|
||||||
char *spritepaths[] = {
|
char *spritepaths[] = {
|
||||||
@@ -43,7 +43,7 @@ int main(void)
|
|||||||
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't initialize SDL: %s", SDL_GetError());
|
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't initialize SDL: %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SDL_CreateWindowAndRenderer("net/aklabs/libsdl3game/test_sprite", 640, 480, 0, &window, &renderer)) {
|
if (!SDL_CreateWindowAndRenderer("net/aklabs/libakgl/test_sprite", 640, 480, 0, &window, &renderer)) {
|
||||||
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't create window/renderer: %s", SDL_GetError());
|
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't create window/renderer: %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ int main(void)
|
|||||||
|
|
||||||
strcpy((char *)&game.name, "charviewer");
|
strcpy((char *)&game.name, "charviewer");
|
||||||
strcpy((char *)&game.version, "0.0.1");
|
strcpy((char *)&game.version, "0.0.1");
|
||||||
strcpy((char *)&game.uri, "net.aklabs.libsdl3game.charviewer");
|
strcpy((char *)&game.uri, "net.aklabs.libakgl.charviewer");
|
||||||
game.screenwidth = 640;
|
game.screenwidth = 640;
|
||||||
game.screenheight = 480;
|
game.screenheight = 480;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
|
|
||||||
typedef akerr_ErrorContext *(*RegistryFuncPtr)(void);
|
typedef akerr_ErrorContext *(*RegistryFuncPtr)(void);
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
|
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/sprite.h>
|
#include <akgl/sprite.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/util.h>
|
#include <akgl/util.h>
|
||||||
#include <sdl3game/error.h>
|
#include <akgl/error.h>
|
||||||
|
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
SDL_Renderer *renderer;
|
SDL_Renderer *renderer;
|
||||||
@@ -194,7 +194,7 @@ int main(void)
|
|||||||
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't initialize SDL: %s", SDL_GetError());
|
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't initialize SDL: %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SDL_CreateWindowAndRenderer("net/aklabs/libsdl3game/test_sprite", 640, 480, 0, &window, &renderer)) {
|
if (!SDL_CreateWindowAndRenderer("net/aklabs/libakgl/test_sprite", 640, 480, 0, &window, &renderer)) {
|
||||||
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't create window/renderer: %s", SDL_GetError());
|
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't create window/renderer: %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/staticstring.h>
|
#include <akgl/staticstring.h>
|
||||||
|
|
||||||
void reset_string_heap(void);
|
void reset_string_heap(void);
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
|
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
#include <sdl3game/util.h>
|
#include <akgl/util.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/tilemap.h>
|
#include <akgl/tilemap.h>
|
||||||
#include <sdl3game/actor.h>
|
#include <akgl/actor.h>
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/json_helpers.h>
|
#include <akgl/json_helpers.h>
|
||||||
|
|
||||||
akerr_ErrorContext *test_tilemap_akgl_get_json_tilemap_property(void)
|
akerr_ErrorContext *test_tilemap_akgl_get_json_tilemap_property(void)
|
||||||
{
|
{
|
||||||
@@ -398,7 +398,7 @@ int main(void)
|
|||||||
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't initialize SDL: %s", SDL_GetError());
|
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't initialize SDL: %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SDL_CreateWindowAndRenderer("net/aklabs/libsdl3game/test_sprite", 768, 576, 0, &window, &renderer)) {
|
if (!SDL_CreateWindowAndRenderer("net/aklabs/libakgl/test_sprite", 768, 576, 0, &window, &renderer)) {
|
||||||
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't create window/renderer: %s", SDL_GetError());
|
FAIL_BREAK(errctx, AKGL_ERR_SDL, "Couldn't create window/renderer: %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
#include <sdl3game/util.h>
|
#include <akgl/util.h>
|
||||||
|
|
||||||
akerr_ErrorContext *test_akgl_rectangle_points_nullpointers(void)
|
akerr_ErrorContext *test_akgl_rectangle_points_nullpointers(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,17 +6,17 @@
|
|||||||
#include <SDL3_mixer/SDL_mixer.h>
|
#include <SDL3_mixer/SDL_mixer.h>
|
||||||
|
|
||||||
#include <akerror.h>
|
#include <akerror.h>
|
||||||
#include <sdl3game/assets.h>
|
#include <akgl/assets.h>
|
||||||
#include <sdl3game/iterator.h>
|
#include <akgl/iterator.h>
|
||||||
#include <sdl3game/tilemap.h>
|
#include <akgl/tilemap.h>
|
||||||
#include <sdl3game/heap.h>
|
#include <akgl/heap.h>
|
||||||
#include <sdl3game/game.h>
|
#include <akgl/game.h>
|
||||||
#include <sdl3game/controller.h>
|
#include <akgl/controller.h>
|
||||||
#include <sdl3game/draw.h>
|
#include <akgl/draw.h>
|
||||||
#include <sdl3game/sprite.h>
|
#include <akgl/sprite.h>
|
||||||
#include <sdl3game/actor.h>
|
#include <akgl/actor.h>
|
||||||
#include <sdl3game/registry.h>
|
#include <akgl/registry.h>
|
||||||
#include <sdl3game/error.h>
|
#include <akgl/error.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
|||||||
|
|
||||||
strcpy((char *)&game.name, "charviewer");
|
strcpy((char *)&game.name, "charviewer");
|
||||||
strcpy((char *)&game.version, "0.0.1");
|
strcpy((char *)&game.version, "0.0.1");
|
||||||
strcpy((char *)&game.uri, "net.aklabs.libsdl3game.charviewer");
|
strcpy((char *)&game.uri, "net.aklabs.libakgl.charviewer");
|
||||||
game.screenwidth = 640;
|
game.screenwidth = 640;
|
||||||
game.screenheight = 480;
|
game.screenheight = 480;
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
|
|||||||
AKGL_BITMASK_ADD(opflags.flags, AKGL_ITERATOR_OP_RENDER);
|
AKGL_BITMASK_ADD(opflags.flags, AKGL_ITERATOR_OP_RENDER);
|
||||||
akgl_draw_background(game.screenwidth, game.screenheight);
|
akgl_draw_background(game.screenwidth, game.screenheight);
|
||||||
ATTEMPT {
|
ATTEMPT {
|
||||||
CATCH(errctx, akgl_tilemap_draw(renderer, (tilemap *)&gamemap, &camera, i));
|
CATCH(errctx, akgl_tilemap_draw(renderer, (akgl_Tilemap *)&gamemap, &camera, i));
|
||||||
SDL_EnumerateProperties(AKGL_REGISTRY_ACTOR, &akgl_registry_iterate_actor, (void *)&opflags);
|
SDL_EnumerateProperties(AKGL_REGISTRY_ACTOR, &akgl_registry_iterate_actor, (void *)&opflags);
|
||||||
} CLEANUP {
|
} CLEANUP {
|
||||||
} PROCESS(errctx) {
|
} PROCESS(errctx) {
|
||||||
|
|||||||
Reference in New Issue
Block a user