input system rework
This commit is contained in:
		@@ -20,4 +20,4 @@ set(SOURCE_FILES
 | 
			
		||||
        scenes/ingame.c scenes/ingame.h
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
use_townengine(${PROJECT_NAME} "${SOURCE_FILES}" ${CMAKE_CURRENT_SOURCE_DIR})
 | 
			
		||||
use_townengine("${SOURCE_FILES}" ${CMAKE_CURRENT_SOURCE_DIR})
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,8 @@ void game_tick(void) {
 | 
			
		||||
 | 
			
		||||
    State *state = ctx.udata;
 | 
			
		||||
 | 
			
		||||
    input_action("debug_toggle", CONTROL_BACKSPACE);
 | 
			
		||||
    input_action("debug_dump_atlases", CONTROL_HOME);
 | 
			
		||||
    input_action("debug_toggle", "BACKSPACE");
 | 
			
		||||
    input_action("debug_dump_atlases", "HOME");
 | 
			
		||||
 | 
			
		||||
    if (input_action_just_pressed("debug_toggle")) {
 | 
			
		||||
        ctx.debug = !ctx.debug;
 | 
			
		||||
 
 | 
			
		||||
@@ -11,12 +11,12 @@
 | 
			
		||||
static void ingame_tick(State *state) {
 | 
			
		||||
    SceneIngame *scn = (SceneIngame *)state->scene;
 | 
			
		||||
 | 
			
		||||
    input_action("player_left", CONTROL_A);
 | 
			
		||||
    input_action("player_right", CONTROL_D);
 | 
			
		||||
    input_action("player_forward", CONTROL_W);
 | 
			
		||||
    input_action("player_backward", CONTROL_S);
 | 
			
		||||
    input_action("player_jump", CONTROL_SPACE);
 | 
			
		||||
    input_action("player_run", CONTROL_LSHIFT);
 | 
			
		||||
    input_action("player_left", "A");
 | 
			
		||||
    input_action("player_right", "D");
 | 
			
		||||
    input_action("player_forward", "W");
 | 
			
		||||
    input_action("player_backward", "S");
 | 
			
		||||
    input_action("player_jump", "SPACE");
 | 
			
		||||
    input_action("player_run", "LSHIFT");
 | 
			
		||||
 | 
			
		||||
    world_drawdef(scn->world);
 | 
			
		||||
    player_calc(scn->player);
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ static void title_tick(State *state) {
 | 
			
		||||
    SceneTitle *scn = (SceneTitle *)state->scene;
 | 
			
		||||
    (void)scn;
 | 
			
		||||
 | 
			
		||||
    input_action("ui_accept", CONTROL_RETURN);
 | 
			
		||||
    input_action("ui_accept", "ENTER");
 | 
			
		||||
 | 
			
		||||
    if (input_action_just_pressed("ui_accept")) {
 | 
			
		||||
        switch_to(state, ingame_scene);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user