|
|
|
@ -89,36 +89,36 @@ int game_init(struct Window* window) |
|
|
|
|
|
|
|
|
|
void scene_setup(void) |
|
|
|
|
{ |
|
|
|
|
int forward_keys[2] = {KEY_W, KEY_UP}; |
|
|
|
|
int backward_keys[2] = {KEY_S, KEY_DOWN}; |
|
|
|
|
int up_keys[2] = {KEY_Q}; |
|
|
|
|
int down_keys[2] = {KEY_E}; |
|
|
|
|
int left_keys[2] = {KEY_A, KEY_LEFT}; |
|
|
|
|
int right_keys[2] = {KEY_D, KEY_RIGHT}; |
|
|
|
|
int turn_right_keys[1] = {KEY_L}; |
|
|
|
|
int turn_left_keys[1] = {KEY_J}; |
|
|
|
|
int turn_up_keys[1] = {KEY_I}; |
|
|
|
|
int turn_down_keys[1] = {KEY_K}; |
|
|
|
|
int sprint_keys[2] = {KEY_LSHIFT, KEY_RSHIFT}; |
|
|
|
|
int recompute_keys[2] = {KEY_F5, KEY_H}; |
|
|
|
|
int ed_toggle_keys[1] = {KEY_F1}; |
|
|
|
|
int win_fullscr_keys[1] = {KEY_F11}; |
|
|
|
|
int win_max_keys[1] = {KEY_F12}; |
|
|
|
|
struct Key_Combination forward_keys[2] = {{KEY_W, KMD_NONE}, {KEY_UP, KMD_ALT}}; |
|
|
|
|
struct Key_Combination backward_keys[2] = {{KEY_S, KMD_NONE}, {KEY_DOWN, KMD_NONE}}; |
|
|
|
|
/* struct Key_Combination up_keys[2] = {KEY_Q}; */ |
|
|
|
|
/* struct Key_Combination down_keys[2] = {KEY_E}; */ |
|
|
|
|
/* struct Key_Combination left_keys[2] = {KEY_A, KEY_LEFT}; */ |
|
|
|
|
/* struct Key_Combination right_keys[2] = {KEY_D, KEY_RIGHT}; */ |
|
|
|
|
/* struct Key_Combination turn_right_keys[1] = {KEY_L}; */ |
|
|
|
|
/* struct Key_Combination turn_left_keys[1] = {KEY_J}; */ |
|
|
|
|
/* struct Key_Combination turn_up_keys[1] = {KEY_I}; */ |
|
|
|
|
/* struct Key_Combination turn_down_keys[1] = {KEY_K}; */ |
|
|
|
|
/* struct Key_Combination sprint_keys[2] = {KEY_LSHIFT, KEY_RSHIFT}; */ |
|
|
|
|
/* struct Key_Combination recompute_keys[2] = {KEY_F5, KEY_H}; */ |
|
|
|
|
/* struct Key_Combination ed_toggle_keys[1] = {KEY_F1}; */ |
|
|
|
|
/* struct Key_Combination win_fullscr_keys[1] = {KEY_F11}; */ |
|
|
|
|
/* struct Key_Combination win_max_keys[1] = {KEY_F12}; */ |
|
|
|
|
input_map_create("Move_Forward", forward_keys, 2); |
|
|
|
|
input_map_create("Move_Backward", backward_keys, 2); |
|
|
|
|
input_map_create("Move_Up", up_keys, 1); |
|
|
|
|
input_map_create("Move_Down", down_keys, 1); |
|
|
|
|
input_map_create("Move_Left", left_keys, 2); |
|
|
|
|
input_map_create("Move_Right", right_keys, 2); |
|
|
|
|
input_map_create("Turn_Right", turn_right_keys, 1); |
|
|
|
|
input_map_create("Turn_Left", turn_left_keys, 1); |
|
|
|
|
input_map_create("Turn_Up", turn_up_keys, 1); |
|
|
|
|
input_map_create("Turn_Down", turn_down_keys, 1); |
|
|
|
|
input_map_create("Sprint", sprint_keys, 2); |
|
|
|
|
input_map_create("Recompute", recompute_keys, 2); |
|
|
|
|
input_map_create("Editor_Toggle", ed_toggle_keys, 1); |
|
|
|
|
input_map_create("Window_Fullscreen", win_fullscr_keys, 1); |
|
|
|
|
input_map_create("Window_Maximize", win_max_keys, 1); |
|
|
|
|
/* input_map_create("Move_Up", up_keys, 1); */ |
|
|
|
|
/* input_map_create("Move_Down", down_keys, 1); */ |
|
|
|
|
/* input_map_create("Move_Left", left_keys, 2); */ |
|
|
|
|
/* input_map_create("Move_Right", right_keys, 2); */ |
|
|
|
|
/* input_map_create("Turn_Right", turn_right_keys, 1); */ |
|
|
|
|
/* input_map_create("Turn_Left", turn_left_keys, 1); */ |
|
|
|
|
/* input_map_create("Turn_Up", turn_up_keys, 1); */ |
|
|
|
|
/* input_map_create("Turn_Down", turn_down_keys, 1); */ |
|
|
|
|
/* input_map_create("Sprint", sprint_keys, 2); */ |
|
|
|
|
/* input_map_create("Recompute", recompute_keys, 2); */ |
|
|
|
|
/* input_map_create("Editor_Toggle", ed_toggle_keys, 1); */ |
|
|
|
|
/* input_map_create("Window_Fullscreen", win_fullscr_keys, 1); */ |
|
|
|
|
/* input_map_create("Window_Maximize", win_max_keys, 1); */ |
|
|
|
|
|
|
|
|
|
struct Entity* player = scene_add_new("player", "None"); |
|
|
|
|
game_state->player_node = player->node; |
|
|
|
@ -272,16 +272,16 @@ void debug(float dt) |
|
|
|
|
vec3 rot_axis_left_right = {0, 1, 0}; |
|
|
|
|
|
|
|
|
|
/* Look around */ |
|
|
|
|
if(input_map_state_get("Turn_Up", KS_PRESSED)) turn_up_down += turn_speed; |
|
|
|
|
if(input_map_state_get("Turn_Down", KS_PRESSED)) turn_up_down -= turn_speed; |
|
|
|
|
if(input_map_state_get("Turn_Right", KS_PRESSED)) turn_left_right += turn_speed; |
|
|
|
|
if(input_map_state_get("Turn_Left", KS_PRESSED)) turn_left_right -= turn_speed; |
|
|
|
|
/* if(input_map_state_get("Turn_Up", KS_PRESSED)) turn_up_down += turn_speed; */ |
|
|
|
|
/* if(input_map_state_get("Turn_Down", KS_PRESSED)) turn_up_down -= turn_speed; */ |
|
|
|
|
/* if(input_map_state_get("Turn_Right", KS_PRESSED)) turn_left_right += turn_speed; */ |
|
|
|
|
/* if(input_map_state_get("Turn_Left", KS_PRESSED)) turn_left_right -= turn_speed; */ |
|
|
|
|
|
|
|
|
|
if(input_map_state_get("Recompute", KS_PRESSED)) |
|
|
|
|
{ |
|
|
|
|
log_message("Regenerating Bounding Volumes"); |
|
|
|
|
geom_bounding_volume_generate_all(); |
|
|
|
|
} |
|
|
|
|
/* if(input_map_state_get("Recompute", KS_PRESSED)) */ |
|
|
|
|
/* { */ |
|
|
|
|
/* log_message("Regenerating Bounding Volumes"); */ |
|
|
|
|
/* geom_bounding_volume_generate_all(); */ |
|
|
|
|
/* } */ |
|
|
|
|
/* if(input_is_key_pressed(KEY_TAB, KS_PRESSED)) */ |
|
|
|
|
/* if(input_is_key_pressed(KEY_TAB, KS_PRESSED) && input_is_key_pressed(KEY_LSHIFT, KS_PRESSED)) input_mouse_mode_set(MM_NORMAL); */ |
|
|
|
|
|
|
|
|
@ -340,13 +340,13 @@ void debug(float dt) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Movement */ |
|
|
|
|
if(input_map_state_get("Sprint", KS_PRESSED)) move_speed *= move_scale; |
|
|
|
|
/* if(input_map_state_get("Sprint", KS_PRESSED)) move_speed *= move_scale; */ |
|
|
|
|
if(input_map_state_get("Move_Forward", KS_PRESSED)) offset.z -= move_speed; |
|
|
|
|
if(input_map_state_get("Move_Backward", KS_PRESSED)) offset.z += move_speed; |
|
|
|
|
if(input_map_state_get("Move_Left", KS_PRESSED)) offset.x -= move_speed; |
|
|
|
|
if(input_map_state_get("Move_Right", KS_PRESSED)) offset.x += move_speed; |
|
|
|
|
if(input_map_state_get("Move_Up", KS_PRESSED)) offset.y += move_speed; |
|
|
|
|
if(input_map_state_get("Move_Down", KS_PRESSED)) offset.y -= move_speed; |
|
|
|
|
/* if(input_map_state_get("Move_Left", KS_PRESSED)) offset.x -= move_speed; */ |
|
|
|
|
/* if(input_map_state_get("Move_Right", KS_PRESSED)) offset.x += move_speed; */ |
|
|
|
|
/* if(input_map_state_get("Move_Up", KS_PRESSED)) offset.y += move_speed; */ |
|
|
|
|
/* if(input_map_state_get("Move_Down", KS_PRESSED)) offset.y -= move_speed; */ |
|
|
|
|
|
|
|
|
|
vec3_scale(&offset, &offset, dt); |
|
|
|
|
if(offset.x != 0 || offset.y != 0 || offset.z != 0) |
|
|
|
@ -422,9 +422,9 @@ int run(void) |
|
|
|
|
void update(float dt, int* window_should_close) |
|
|
|
|
{
|
|
|
|
|
if(input_is_key_pressed(KEY_ESCAPE)) *window_should_close = 1; |
|
|
|
|
if(input_map_state_get("Editor_Toggle", KS_RELEASED)) editor_toggle(); |
|
|
|
|
if(input_map_state_get("Window_Fullscreen", KS_RELEASED)) window_fullscreen_set(game_state->window, 1); |
|
|
|
|
if(input_map_state_get("Window_Maximize", KS_RELEASED)) window_fullscreen_set(game_state->window, 0); |
|
|
|
|
/* if(input_map_state_get("Editor_Toggle", KS_RELEASED)) editor_toggle(); */ |
|
|
|
|
/* if(input_map_state_get("Window_Fullscreen", KS_RELEASED)) window_fullscreen_set(game_state->window, 1); */ |
|
|
|
|
/* if(input_map_state_get("Window_Maximize", KS_RELEASED)) window_fullscreen_set(game_state->window, 0); */ |
|
|
|
|
|
|
|
|
|
debug(dt); |
|
|
|
|
//debug_gui(dt);
|
|
|
|
|