1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Created new Engine singleton, and moved engine related OS functions to it.

This commit is contained in:
Juan Linietsky
2017-01-13 12:51:14 -03:00
parent 0ad9939603
commit e53c247cb1
17 changed files with 393 additions and 186 deletions

View File

@@ -158,10 +158,10 @@ bool InputDefault::is_action_just_pressed(const StringName& p_action) const {
if (!E)
return false;
if (OS::get_singleton()->is_in_fixed_frame()) {
return E->get().pressed && E->get().fixed_frame==OS::get_singleton()->get_fixed_frames();
if (Engine::get_singleton()->is_in_fixed_frame()) {
return E->get().pressed && E->get().fixed_frame==Engine::get_singleton()->get_fixed_frames();
} else {
return E->get().pressed && E->get().idle_frame==OS::get_singleton()->get_idle_frames();
return E->get().pressed && E->get().idle_frame==Engine::get_singleton()->get_idle_frames();
}
}
@@ -171,10 +171,10 @@ bool InputDefault::is_action_just_released(const StringName& p_action) const{
if (!E)
return false;
if (OS::get_singleton()->is_in_fixed_frame()) {
return !E->get().pressed && E->get().fixed_frame==OS::get_singleton()->get_fixed_frames();
if (Engine::get_singleton()->is_in_fixed_frame()) {
return !E->get().pressed && E->get().fixed_frame==Engine::get_singleton()->get_fixed_frames();
} else {
return !E->get().pressed && E->get().idle_frame==OS::get_singleton()->get_idle_frames();
return !E->get().pressed && E->get().idle_frame==Engine::get_singleton()->get_idle_frames();
}
}
@@ -379,8 +379,8 @@ void InputDefault::parse_input_event(const InputEvent& p_event) {
if(is_action_pressed(E->key()) != p_event.is_pressed()) {
Action action;
action.fixed_frame=OS::get_singleton()->get_fixed_frames();
action.idle_frame=OS::get_singleton()->get_idle_frames();
action.fixed_frame=Engine::get_singleton()->get_fixed_frames();
action.idle_frame=Engine::get_singleton()->get_idle_frames();
action.pressed=p_event.is_pressed();
action_state[E->key()]=action;
}
@@ -490,8 +490,8 @@ void InputDefault::action_press(const StringName& p_action) {
Action action;
action.fixed_frame=OS::get_singleton()->get_fixed_frames();
action.idle_frame=OS::get_singleton()->get_idle_frames();
action.fixed_frame=Engine::get_singleton()->get_fixed_frames();
action.idle_frame=Engine::get_singleton()->get_idle_frames();
action.pressed=true;
action_state[p_action]=action;
@@ -502,8 +502,8 @@ void InputDefault::action_release(const StringName& p_action){
Action action;
action.fixed_frame=OS::get_singleton()->get_fixed_frames();
action.idle_frame=OS::get_singleton()->get_idle_frames();
action.fixed_frame=Engine::get_singleton()->get_fixed_frames();
action.idle_frame=Engine::get_singleton()->get_idle_frames();
action.pressed=false;
action_state[p_action]=action;