Fixed editor camera right-click bug

dev
Shariq Shah 6 years ago
parent 24c3e5305a
commit c443e4d9ee
  1. 7
      src/game/editor.c
  2. 4
      src/game/entity.c
  3. 6
      src/game/input.c
  4. 4
      todo.txt

@ -757,7 +757,7 @@ void editor_on_mousebutton_release(const struct Event* event)
struct Editor* editor = game_state->editor; struct Editor* editor = game_state->editor;
struct Gui* gui = game_state->gui; struct Gui* gui = game_state->gui;
if(game_state->game_mode != GAME_MODE_EDITOR || nk_window_is_any_hovered(&gui->context) || game_state->console->visible) if(game_state->game_mode != GAME_MODE_EDITOR || game_state->console->visible)
return; return;
if(editor->camera_looking_around) if(editor->camera_looking_around)
@ -772,6 +772,9 @@ void editor_on_mousebutton_release(const struct Event* event)
editor_axis_set(editor, editor->previous_axis); editor_axis_set(editor, editor->previous_axis);
} }
if(nk_window_is_any_hovered(&gui->context))
return;
if(event->mousebutton.button == MSB_LEFT && if(event->mousebutton.button == MSB_LEFT &&
!editor->camera_looking_around && !editor->camera_looking_around &&
nk_item_is_any_active(&gui->context) == 0) nk_item_is_any_active(&gui->context) == 0)
@ -1320,7 +1323,7 @@ void editor_camera_update(struct Editor* editor, float dt)
{ {
struct Game_State* game_state = game_state_get(); struct Game_State* game_state = game_state_get();
struct Gui* gui = game_state->gui; struct Gui* gui = game_state->gui;
if(nk_window_is_any_hovered(&gui->context) || game_state->console->visible) if(game_state->console->visible)
return; return;
struct Camera* editor_camera = &game_state_get()->scene->cameras[CAM_EDITOR]; struct Camera* editor_camera = &game_state_get()->scene->cameras[CAM_EDITOR];

@ -295,7 +295,7 @@ struct Entity* entity_read(struct Parser_Object* object)
case ET_LIGHT: case ET_LIGHT:
{ {
struct Light* light = scene_light_create(scene, name, NULL, LT_POINT); struct Light* light = scene_light_create(scene, name, NULL, LT_POINT);
if(hashmap_value_exists(object->data, "light_type")) light->type = hashmap_int_get(object->data, "type"); if(hashmap_value_exists(object->data, "light_type")) light->type = hashmap_int_get(object->data, "light_type");
if(hashmap_value_exists(object->data, "outer_angle")) light->outer_angle = hashmap_float_get(object->data, "outer_angle"); if(hashmap_value_exists(object->data, "outer_angle")) light->outer_angle = hashmap_float_get(object->data, "outer_angle");
if(hashmap_value_exists(object->data, "inner_angle")) light->inner_angle = hashmap_float_get(object->data, "inner_angle"); if(hashmap_value_exists(object->data, "inner_angle")) light->inner_angle = hashmap_float_get(object->data, "inner_angle");
if(hashmap_value_exists(object->data, "falloff")) light->falloff = hashmap_float_get(object->data, "falloff"); if(hashmap_value_exists(object->data, "falloff")) light->falloff = hashmap_float_get(object->data, "falloff");
@ -310,7 +310,7 @@ struct Entity* entity_read(struct Parser_Object* object)
break; break;
case ET_SOUND_SOURCE: case ET_SOUND_SOURCE:
{ {
struct Sound_Source* sound_source = scene_sound_source_create(scene, name, NULL, "default.wav", ST_WAV, true, true); struct Sound_Source* sound_source = scene_sound_source_create(scene, name, NULL, "teh_beatz.wav", ST_WAV, true, true);
sound_source->type = ST_WAV; sound_source->type = ST_WAV;
sound_source->playing = false; sound_source->playing = false;
sound_source->loop = false; sound_source->loop = false;

@ -35,9 +35,9 @@ void input_init(void)
struct Key_Binding left_keys = {KEY_A, KMOD_NONE, KEY_LEFT, KMOD_NONE, KS_INACTIVE}; struct Key_Binding left_keys = {KEY_A, KMOD_NONE, KEY_LEFT, KMOD_NONE, KS_INACTIVE};
struct Key_Binding right_keys = {KEY_D, KMOD_NONE, KEY_RIGHT, KMOD_NONE, KS_INACTIVE}; struct Key_Binding right_keys = {KEY_D, KMOD_NONE, KEY_RIGHT, KMOD_NONE, KS_INACTIVE};
struct Key_Binding turn_right_keys = {KEY_L, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE}; struct Key_Binding turn_right_keys = {KEY_L, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE};
struct Key_Binding turn_left_keys = {KEY_J, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE}; struct Key_Binding turn_left_keys = {KEY_H, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE};
struct Key_Binding turn_up_keys = {KEY_I, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE}; struct Key_Binding turn_up_keys = {KEY_K, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE};
struct Key_Binding turn_down_keys = {KEY_K, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE}; struct Key_Binding turn_down_keys = {KEY_J, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE};
struct Key_Binding sprint_keys = {KEY_LSHIFT, KMOD_NONE, KEY_RSHIFT, KMOD_NONE, KS_INACTIVE}; struct Key_Binding sprint_keys = {KEY_LSHIFT, KMOD_NONE, KEY_RSHIFT, KMOD_NONE, KS_INACTIVE};
struct Key_Binding editor_toggle_keys = {KEY_F1, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE}; struct Key_Binding editor_toggle_keys = {KEY_F1, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE};
struct Key_Binding console_toggle_keys = {KEY_TILDE, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE}; struct Key_Binding console_toggle_keys = {KEY_TILDE, KMOD_NONE, KEY_NONE, KMOD_NONE, KS_INACTIVE};

@ -1,6 +1,5 @@
Todo: Todo:
- Finish mesh and material properties serialization to and from file - Finish mesh and material properties serialization to and from file
- Console command to read/write entity to file and add it to scene
- Editor functionality to add entity from specific file to scene - Editor functionality to add entity from specific file to scene
- Scene read/write to file with scene file only containing names of - Scene read/write to file with scene file only containing names of
entity archetypes entity archetypes
@ -112,7 +111,6 @@ Bugs:
- Fix hang on fullscreen toggle - Fix hang on fullscreen toggle
- Fix axis lines not aligning with grid lines - Fix axis lines not aligning with grid lines
- Fix arc angles resetting when rotating - Fix arc angles resetting when rotating
- Fix editor camera right-click behaviour
Done: Done:
* Input * Input
@ -305,4 +303,6 @@ Done:
* Disabled editor functionalites when console is toggled * Disabled editor functionalites when console is toggled
* Entity to file read/write * Entity to file read/write
* Added editor shortcut key to delete selected entity * Added editor shortcut key to delete selected entity
* Console command to read/write entity to file and add it to scene
* Fix editor camera right-click behaviour

Loading…
Cancel
Save