input system rework
This commit is contained in:
@ -13,4 +13,4 @@ set(SOURCE_FILES
|
||||
state.h
|
||||
)
|
||||
|
||||
use_townengine(${PROJECT_NAME} "${SOURCE_FILES}" ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
use_townengine("${SOURCE_FILES}" ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
@ -69,8 +69,8 @@ void game_tick(void)
|
||||
ctx.udata = calloc(1, sizeof(State));
|
||||
}
|
||||
|
||||
input_action("add_a_bit", CONTROL_LEFT_MOUSE);
|
||||
input_action("add_a_lot", CONTROL_RIGHT_MOUSE);
|
||||
input_action("add_a_bit", "LCLICK");
|
||||
input_action("add_a_lot", "RCLICK");
|
||||
|
||||
State *state = ctx.udata;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -17,4 +17,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})
|
||||
|
@ -24,8 +24,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;
|
||||
|
@ -188,14 +188,14 @@ static void draw_terrain(SceneIngame *scn) {
|
||||
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("mouse_capture_toggle", CONTROL_ESCAPE);
|
||||
input_action("toggle_camera_mode", CONTROL_C);
|
||||
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");
|
||||
input_action("mouse_capture_toggle", "ESCAPE");
|
||||
input_action("toggle_camera_mode", "C");
|
||||
|
||||
if (scn->mouse_captured) {
|
||||
const float sensitivity = 0.4f * (float)DEG2RAD; /* TODO: put this in a better place */
|
||||
|
@ -11,7 +11,7 @@ static void title_tick(State *state) {
|
||||
SceneTitle *scn = (SceneTitle *)state->scene;
|
||||
(void)scn;
|
||||
|
||||
input_action("ui_accept", CONTROL_RETURN);
|
||||
input_action("ui_accept", "RETURN");
|
||||
|
||||
if (input_action_just_pressed("ui_accept")) {
|
||||
switch_to(state, ingame_scene);
|
||||
|
Reference in New Issue
Block a user