Update HUD for more info on player state, fiddle with properties and character settings for physics
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "little guy",
|
||||
"speedtime": 8,
|
||||
"acceleration_x": 0.001,
|
||||
"acceleration_y": 0.001,
|
||||
"speed_x": 1,
|
||||
"speed_y": 1,
|
||||
"acceleration_x": 64.0,
|
||||
"acceleration_y": 64.0,
|
||||
"speed_x": 64.0,
|
||||
"speed_y": 64.0,
|
||||
"sprite_mappings": [
|
||||
{
|
||||
"state": [
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"some.key.with.a.value": "value",
|
||||
"game.screenwidth": "640",
|
||||
"game.screenheight": "480",
|
||||
"physics.gravity.y": "32.0",
|
||||
"physics.gravity.terminal_y": "120.0"
|
||||
"physics.gravity.y": "1024.0",
|
||||
"physics.drag.y": "1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
"type":"actor",
|
||||
"visible":true,
|
||||
"width":16,
|
||||
"x":304.261511065887,
|
||||
"y":258.471635716103
|
||||
"x":294.721953701349,
|
||||
"y":58.7769015517682
|
||||
}],
|
||||
"opacity":1,
|
||||
"type":"objectgroup",
|
||||
|
||||
2
deps/libakgl
vendored
2
deps/libakgl
vendored
Submodule deps/libakgl updated: 314ce5e10d...941eeb2493
@@ -53,7 +53,7 @@ akerr_ErrorContext AKERR_NOIGNORE *akgltest_iterate_mapmenu(void);
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgltest_iterate_running(void);
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgltest_iterate_waitforinput(void);
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgltest_load_assets();
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgltest_menupointer_logic_movement(akgl_Actor *obj, SDL_Time curtime);
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgltest_menupointer_logic_movement(akgl_Actor *obj, float32_t dt);
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgltest_release_actor(char *actorname);
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgltest_set_actor_visible(char *actorname, bool visible);
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgltest_set_gamemode_menu(akgl_Actor *appstate, SDL_Event *event);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <akgltest.h>
|
||||
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgltest_menupointer_logic_movement(akgl_Actor *obj, SDL_Time curtime)
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgltest_menupointer_logic_movement(akgl_Actor *obj, float32_t dt)
|
||||
{
|
||||
PREPARE_ERROR(e);
|
||||
FAIL_ZERO_RETURN(e, obj, AKERR_NULLPOINTER, "NULL actor");
|
||||
@@ -19,6 +19,7 @@ akerr_ErrorContext AKERR_NOIGNORE *akgltest_menupointer_logic_movement(akgl_Acto
|
||||
}
|
||||
obj->y = 85 + (menuselection * 100);
|
||||
AKGL_BITMASK_DEL(obj->state, (AKGL_ACTOR_STATE_MOVING_UP | AKGL_ACTOR_STATE_MOVING_DOWN));
|
||||
FAIL(e, AKGL_ERR_LOGICINTERRUPT, "NULL");
|
||||
SUCCEED_RETURN(e);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,8 +151,7 @@ akerr_ErrorContext AKERR_NOIGNORE *akgltest_iterate_running(void)
|
||||
akgl_Iterator opflags;
|
||||
akgl_Actor *player;
|
||||
TTF_Font *gamefont;
|
||||
char fpsText[32];
|
||||
char velocityText[128];
|
||||
char screenText[128];
|
||||
int count;
|
||||
|
||||
PREPARE_ERROR(e);
|
||||
@@ -164,38 +163,69 @@ akerr_ErrorContext AKERR_NOIGNORE *akgltest_iterate_running(void)
|
||||
|
||||
PASS(e, akgl_game_update(NULL));
|
||||
|
||||
memset((char *)&fpsText, 0x00, 32);
|
||||
snprintf((char *)&fpsText, 31, "FPS : %d", game.fps);
|
||||
memset((char *)&screenText, 0x00, 32);
|
||||
snprintf((char *)&screenText, 127, "FPS : %d", game.fps);
|
||||
PASS(e, akgl_text_rendertextat(
|
||||
gamefont,
|
||||
(char *)&fpsText,
|
||||
(char *)&screenText,
|
||||
(SDL_Color){255, 255, 255, 255},
|
||||
0,
|
||||
450,
|
||||
10)
|
||||
);
|
||||
|
||||
memset((char *)&velocityText, 0x00, 128);
|
||||
snprintf((char *)&velocityText, 127, "AX: %f", player->vx);
|
||||
memset((char *)&screenText, 0x00, 128);
|
||||
snprintf((char *)&screenText, 127, "VX: %f", player->vx);
|
||||
PASS(e, akgl_text_rendertextat(
|
||||
gamefont,
|
||||
(char *)&velocityText,
|
||||
(char *)&screenText,
|
||||
(SDL_Color){255, 255, 255, 255},
|
||||
0,
|
||||
10,
|
||||
10)
|
||||
);
|
||||
memset((char *)&velocityText, 0x00, 128);
|
||||
snprintf((char *)&velocityText, 127, "AY: %f", player->vy);
|
||||
memset((char *)&screenText, 0x00, 128);
|
||||
snprintf((char *)&screenText, 127, "VY: %f", player->vy);
|
||||
PASS(e, akgl_text_rendertextat(
|
||||
gamefont,
|
||||
(char *)&velocityText,
|
||||
(char *)&screenText,
|
||||
(SDL_Color){255, 255, 255, 255},
|
||||
0,
|
||||
10,
|
||||
30)
|
||||
);
|
||||
memset((char *)&screenText, 0x00, 128);
|
||||
snprintf((char *)&screenText, 127, "DY: %f", physics.drag_y);
|
||||
PASS(e, akgl_text_rendertextat(
|
||||
gamefont,
|
||||
(char *)&screenText,
|
||||
(SDL_Color){255, 255, 255, 255},
|
||||
0,
|
||||
10,
|
||||
60)
|
||||
);
|
||||
|
||||
memset((char *)&screenText, 0x00, 128);
|
||||
snprintf((char *)&screenText, 127, "PX: %f", player->x);
|
||||
PASS(e, akgl_text_rendertextat(
|
||||
gamefont,
|
||||
(char *)&screenText,
|
||||
(SDL_Color){255, 255, 255, 255},
|
||||
0,
|
||||
220,
|
||||
10)
|
||||
);
|
||||
memset((char *)&screenText, 0x00, 128);
|
||||
snprintf((char *)&screenText, 127, "PY: %f", player->y);
|
||||
PASS(e, akgl_text_rendertextat(
|
||||
gamefont,
|
||||
(char *)&screenText,
|
||||
(SDL_Color){255, 255, 255, 255},
|
||||
0,
|
||||
220,
|
||||
30)
|
||||
);
|
||||
|
||||
PASS(e, renderer.frame_end(&renderer));
|
||||
SUCCEED_RETURN(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user