Unify the library on an akgl_ namespace
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
actor *actorptr = NULL;
|
||||
akgl_Actor *actorptr = NULL;
|
||||
int i = 0;
|
||||
int gamepadids[32];
|
||||
char *characterjson = NULL;
|
||||
@@ -51,9 +51,9 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
game.screenwidth = 640;
|
||||
game.screenheight = 480;
|
||||
|
||||
CATCH(errctx, GAME_init());
|
||||
CATCH(errctx, heap_init());
|
||||
CATCH(errctx, registry_init());
|
||||
CATCH(errctx, akgl_game_init());
|
||||
CATCH(errctx, akgl_heap_init());
|
||||
CATCH(errctx, akgl_registry_init());
|
||||
|
||||
} CLEANUP {
|
||||
} PROCESS(errctx) {
|
||||
@@ -70,7 +70,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
sprintf((char *)&pathbuf, "%s", argv[i]);
|
||||
}
|
||||
SDL_Log("Loading sprite %s...", (char *)&pathbuf);
|
||||
CATCH(errctx, sprite_load_json((char *)&pathbuf));
|
||||
CATCH(errctx, akgl_sprite_load_json((char *)&pathbuf));
|
||||
} CLEANUP {
|
||||
} PROCESS(errctx) {
|
||||
} HANDLE_DEFAULT(errctx) {
|
||||
@@ -87,25 +87,25 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
sprintf((char *)&pathbuf, "%s", characterjson);
|
||||
}
|
||||
SDL_Log("Loading character %s...", (char *)&pathbuf);
|
||||
CATCH(errctx, character_load_json((char *)&pathbuf));
|
||||
CATCH(errctx, heap_next_actor(&actorptr));
|
||||
CATCH(errctx, actor_initialize((actor *)actorptr, "player"));
|
||||
CATCH(errctx, akgl_character_load_json((char *)&pathbuf));
|
||||
CATCH(errctx, akgl_heap_next_actor(&actorptr));
|
||||
CATCH(errctx, akgl_actor_initialize((akgl_Actor *)actorptr, "player"));
|
||||
actorptr->basechar = SDL_GetPointerProperty(
|
||||
REGISTRY_CHARACTER,
|
||||
AKGL_REGISTRY_CHARACTER,
|
||||
"little guy",
|
||||
NULL);
|
||||
FAIL_ZERO_BREAK(errctx, actorptr->basechar, AKERR_REGISTRY, "Can't load character 'little guy' from the registry");
|
||||
actorptr->movement_controls_face = false;
|
||||
actorptr->state = (ACTOR_STATE_ALIVE | ACTOR_STATE_FACE_DOWN);
|
||||
actorptr->state = (AKGL_ACTOR_STATE_ALIVE | AKGL_ACTOR_STATE_FACE_DOWN);
|
||||
actorptr->x = 320;
|
||||
actorptr->y = 240;
|
||||
actorptr->visible = true;
|
||||
|
||||
// Open the first gamepad
|
||||
FAIL_ZERO_BREAK(errctx, SDL_GetGamepads((int *)&gamepadids), AKERR_SDL, "%s", SDL_GetError());
|
||||
FAIL_ZERO_BREAK(errctx, SDL_GetGamepads((int *)&gamepadids), AKGL_ERR_SDL, "%s", SDL_GetError());
|
||||
SDL_Log("Opening gamepad %d", gamepadids[0]);
|
||||
FAIL_ZERO_BREAK(errctx, SDL_OpenGamepad(gamepadids[0]), AKERR_SDL, "%s", SDL_GetError());
|
||||
CATCH(errctx, SDL3G_controller_default(0, "player", 0, gamepadids[0]));
|
||||
FAIL_ZERO_BREAK(errctx, SDL_OpenGamepad(gamepadids[0]), AKGL_ERR_SDL, "%s", SDL_GetError());
|
||||
CATCH(errctx, akgl_controller_default(0, "player", 0, gamepadids[0]));
|
||||
|
||||
} CLEANUP {
|
||||
} PROCESS(errctx) {
|
||||
@@ -125,7 +125,7 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
|
||||
FAIL_ZERO_BREAK(errctx, appstate, AKERR_NULLPOINTER, "NULL appstate pointer");
|
||||
FAIL_ZERO_BREAK(errctx, event, AKERR_NULLPOINTER, "NULL event pointer");
|
||||
|
||||
CATCH(errctx, controller_handle_event(appstate, event));
|
||||
CATCH(errctx, akgl_controller_handle_event(appstate, event));
|
||||
if (event->type == SDL_EVENT_QUIT) {
|
||||
return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */
|
||||
}
|
||||
@@ -138,17 +138,17 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
|
||||
SDL_AppResult SDL_AppIterate(void *appstate)
|
||||
{
|
||||
int i = 0;
|
||||
iterator opflags;
|
||||
akgl_Iterator opflags;
|
||||
|
||||
PREPARE_ERROR(errctx);
|
||||
|
||||
BITMASK_CLEAR(opflags.flags);
|
||||
BITMASK_ADD(opflags.flags, ITERATOR_OP_UPDATE);
|
||||
BITMASK_ADD(opflags.flags, ITERATOR_OP_RENDER);
|
||||
GAME_draw_background(game.screenwidth, game.screenheight);
|
||||
AKGL_BITMASK_CLEAR(opflags.flags);
|
||||
AKGL_BITMASK_ADD(opflags.flags, AKGL_ITERATOR_OP_UPDATE);
|
||||
AKGL_BITMASK_ADD(opflags.flags, AKGL_ITERATOR_OP_RENDER);
|
||||
akgl_draw_background(game.screenwidth, game.screenheight);
|
||||
ATTEMPT {
|
||||
CATCH(errctx, tilemap_draw(renderer, (tilemap *)&gamemap, &camera, i));
|
||||
SDL_EnumerateProperties(REGISTRY_ACTOR, ®istry_iterate_actor, (void *)&opflags);
|
||||
CATCH(errctx, akgl_tilemap_draw(renderer, (tilemap *)&gamemap, &camera, i));
|
||||
SDL_EnumerateProperties(AKGL_REGISTRY_ACTOR, &akgl_registry_iterate_actor, (void *)&opflags);
|
||||
} CLEANUP {
|
||||
} PROCESS(errctx) {
|
||||
} HANDLE_DEFAULT(errctx) {
|
||||
|
||||
Reference in New Issue
Block a user