Skip to content

Commit

Permalink
Working keyboard mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMoroz committed Sep 27, 2019
1 parent 75deac9 commit ea0e70e
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 88 deletions.
43 changes: 19 additions & 24 deletions src/Gamemodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,27 +309,27 @@ void OpenControlMenu(Scene * scene, Overlays * overlays)

controls.AddObject(&Text(LOCAL["Keyboard Controls"], LOCAL("default"), 50), Object::Allign::LEFT);
controls.AddObject(&Box(800, 0), Object::Allign::CENTER);
controls.AddObject(&KeyMapper(LOCAL["UP"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[UP], 1200.f, 50.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["DOWN"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[DOWN], 1200.f, 50.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["LEFT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[LEFT], 1200.f, 50.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["RIGHT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[RIGHT], 1200.f, 50.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["VIEWUP"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[VIEWUP], 1200.f, 50.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["VIEWDOWN"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[VIEWDOWN], 1200.f, 50.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["VIEWLEFT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[VIEWLEFT], 1200.f, 50.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["VIEWRIGHT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[VIEWRIGHT], 1200.f, 50.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["PAUSE"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[PAUSE], 1200.f, 50.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["RESTART"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[RESTART], 1200.f, 50.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["SCREENSHOT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[SCREENSHOT], 1200.f, 50.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["UP"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[UP], 800.f, 35.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["DOWN"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[DOWN], 800.f, 35.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["LEFT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[LEFT], 800.f, 35.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["RIGHT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[RIGHT], 800.f, 35.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["VIEWUP"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[VIEWUP], 800.f, 35.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["VIEWDOWN"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[VIEWDOWN], 800.f, 35.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["VIEWLEFT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[VIEWLEFT], 800.f, 35.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["VIEWRIGHT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[VIEWRIGHT], 800.f, 35.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["PAUSE"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[PAUSE], 800.f, 35.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["RESTART"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[RESTART], 800.f, 35.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["SCREENSHOT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[SCREENSHOT], 800.f, 35.f, KeyMapper::MapperType::KEYBOARD), Object::Allign::LEFT);
controls.AddObject(&Box(800, 0), Object::Allign::CENTER);
controls.AddObject(&Text(LOCAL["Gamepad Controls"], LOCAL("default"), 50), Object::Allign::LEFT);
controls.AddObject(&Box(800, 0), Object::Allign::CENTER);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_MOVE_AXIS_X"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_MOVE_AXIS_X], 1200.f, 50.f, KeyMapper::MapperType::JOYSTICK_AXIS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_MOVE_AXIS_Y"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_MOVE_AXIS_Y], 1200.f, 50.f, KeyMapper::MapperType::JOYSTICK_AXIS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_VIEW_AXIS_X"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_VIEW_AXIS_X], 1200.f, 50.f, KeyMapper::MapperType::JOYSTICK_AXIS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_VIEW_AXIS_Y"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_VIEW_AXIS_Y], 1200.f, 50.f, KeyMapper::MapperType::JOYSTICK_AXIS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_EXIT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_EXIT], 1200.f, 50.f, KeyMapper::MapperType::JOYSTICK_KEYS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_SCREENSHOT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_SCREENSHOT], 1200.f, 50.f, KeyMapper::MapperType::JOYSTICK_KEYS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_RESTART"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_RESTART], 1200.f, 50.f, KeyMapper::MapperType::JOYSTICK_KEYS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_MOVE_AXIS_X"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_MOVE_AXIS_X], 800.f, 35.f, KeyMapper::MapperType::JOYSTICK_AXIS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_MOVE_AXIS_Y"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_MOVE_AXIS_Y], 800.f, 35.f, KeyMapper::MapperType::JOYSTICK_AXIS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_VIEW_AXIS_X"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_VIEW_AXIS_X], 800.f, 35.f, KeyMapper::MapperType::JOYSTICK_AXIS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_VIEW_AXIS_Y"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_VIEW_AXIS_Y], 800.f, 35.f, KeyMapper::MapperType::JOYSTICK_AXIS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_EXIT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_EXIT], 800.f, 35.f, KeyMapper::MapperType::JOYSTICK_KEYS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_SCREENSHOT"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_SCREENSHOT], 800.f, 35.f, KeyMapper::MapperType::JOYSTICK_KEYS), Object::Allign::LEFT);
controls.AddObject(&KeyMapper(LOCAL["JOYSTICK_RESTART"], LOCAL["Waiting for input"], &SETTINGS.stg.control_mapping[JOYSTICK_RESTART], 800.f, 35.f, KeyMapper::MapperType::JOYSTICK_KEYS), Object::Allign::LEFT);

AddGlobalObject(controls);
}
Expand Down Expand Up @@ -1330,12 +1330,6 @@ void InitializeATBWindows(float* fps, float *target_fps)
TwAddVarRW(overlays_ptr->settings, "Mouse sensitivity", TW_TYPE_FLOAT, &SETTINGS.stg.mouse_sensitivity, "min=0.001 max=0.02 step=0.001 group='Control settings'");
TwAddVarRW(overlays_ptr->settings, "Wheel sensitivity", TW_TYPE_FLOAT, &SETTINGS.stg.wheel_sensitivity, "min=0.01 max=0.5 step=0.01 group='Control settings'");
TwAddVarRW(overlays_ptr->settings, "Windows touch controls(experimental)", TW_TYPE_BOOLCPP, &SETTINGS.stg.touch_mode, "group='Control settings' help='Use a touchscreen'");
TwAddVarRO(overlays_ptr->settings, "Status", TW_TYPE_STDSTRING, &status_text, " label='STATUS' group='Control settings' ");

TwAddButton(overlays_ptr->settings, "AXIS_X_M", SetButton, &key[0], "group='Control settings' label='Joystick - choose X movement axis' ");
TwAddButton(overlays_ptr->settings, "AXIS_Y_M", SetButton, &key[1], "group='Control settings' label='Joystick - choose Y movement axis' ");
TwAddButton(overlays_ptr->settings, "AXIS_X_V", SetButton, &key[2], "group='Control settings' label='Joystick - choose X view axis' ");
TwAddButton(overlays_ptr->settings, "AXIS_Y_V", SetButton, &key[3], "group='Control settings' label='Joystick - choose Y view axis' ");
TwAddButton(overlays_ptr->settings, "Apply4", ApplySettings, NULL, "group='Control settings' label='Apply settings' ");
int barPos1[2] = { 16, 250 };

Expand Down Expand Up @@ -1414,6 +1408,7 @@ void InitializeATBWindows(float* fps, float *target_fps)
TwAddVarRO(debug, "Replay frame", TW_TYPE_INT32, &cur_frame, "");
TwAddVarRO(debug, "Replay mode", TW_TYPE_BOOLCPP, &replay, "");
TwAddVarRO(debug, "Recording mode", TW_TYPE_BOOLCPP, &recording, "");
TwDefine("Debug_bar visible=false color='0 0 255' alpha=240 size='420 160' valueswidth=200");
#endif

TwDefine(" GLOBAL fontsize=3 ");
Expand Down
8 changes: 1 addition & 7 deletions src/Gamemodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@ void ApplyButton(int NUM, int MODE);

void InitializeATBWindows(float * fps, float * target_fps);

template < typename T > std::string num2str(const T& n)
{
std::ostringstream stm;
if (n < 10) stm << "0";
stm << n;
return stm.str();
}



128 changes: 78 additions & 50 deletions src/Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,8 @@ void KeyMapper::operator=(KeyMapper & A)
Box::operator=(A);
this_type = A.this_type;
key_ptr = A.key_ptr;
waiting = A.waiting;
wait_text = A.wait_text;
CreateCallbacks();
}

Expand All @@ -1246,69 +1248,95 @@ void KeyMapper::operator=(KeyMapper && A)
Box::operator=(A);
std::swap(this_type, A.this_type);
std::swap(key_ptr, A.key_ptr);
waiting = A.waiting;
wait_text = A.wait_text;
CreateCallbacks();
}

void KeyMapper::CreateCallbacks()
{
/*//use lambda funtion
this->objects[1].get()->objects[0].get()->SetMainCallbackFunction([parent = this](sf::RenderWindow * window, InputState & state)
//use a lambda function
this->objects[1].get()->SetMainCallbackFunction([parent = this](sf::RenderWindow * window, InputState & state)
{
float inside_size = parent->objects[0].get()->defaultstate.inside_size;
float height_1 = parent->objects[1].get()->defaultstate.size.y - 2 * parent->objects[1].get()->defaultstate.margin;
float height_2 = parent->objects[1].get()->objects[0].get()->defaultstate.size.y;
float max_slide_scroll = height_1 - height_2;
//relative scroll coefficient
float rel_coef = (inside_size - height_1) / max_slide_scroll;
parent->ScrollBy(state.mouse_speed.y*rel_coef);
}, false);
this->SetMainHoverFunction([parent = this](sf::RenderWindow * window, InputState & state)
{
//wheel scroll
if (state.wheel != 0.f)
{
float ds = 20.f;
parent->ScrollBy(-state.wheel*ds);
}
parent->waiting = true;
//get the text pointer out of the object pointer inside the parent
Text *text_ptr = static_cast<Text*>(parent->objects[1].get()->objects[0].get());
text_ptr->SetString(parent->wait_text);
});


this->SetMainDefaultFunction([parent = this](sf::RenderWindow * window, InputState & state)
{
bool A = false;
if (state.keys[sf::Keyboard::Up])
{
parent->Cursor(-1);
A = 1;
}
if (state.keys[sf::Keyboard::Down])
{
parent->Cursor(1);
A = 1;
}
if (state.keys[sf::Keyboard::Enter])
if (parent->waiting)
{
//run the callback function of the chosen object
A = parent->objects[0].get()->objects[parent->cursor_id].get()->RunCallback(window, state);
}
if (A) parent->action_time = action_dt;
A = false;
if (state.key_press[sf::Keyboard::Up])
{
parent->action_time = action_dt / 4;
if (state.key_press[sf::Keyboard::Escape])
{
parent->SetKeyString(); //exit
}
else switch (parent->this_type)
{
case KEYBOARD:
if (state.isKeyPressed)
{
//search for the pressed key
for (sf::Keyboard::Key i = sf::Keyboard::A; i < sf::Keyboard::KeyCount; i = sf::Keyboard::Key(i + 1))
{
if (state.keys[i]) //found
{
*(parent->key_ptr) = i;
parent->SetKeyString();
break;
}
}
}
break;
case JOYSTICK_AXIS:
//search for the axis
for (int i = 0; i < sf::Joystick::AxisCount; i++)
{
if (abs(sf::Joystick::getAxisPosition(0, sf::Joystick::Axis(i))) > 0.5f )
{
*(parent->key_ptr) = i;
parent->SetKeyString();
break;
}
}
break;
case JOYSTICK_KEYS:
//search for the pressed joystick key
for (int i = 0; i < sf::Joystick::ButtonCount; i++)
{
if (sf::Joystick::isButtonPressed(0, i))
{
*(parent->key_ptr) = i;
parent->SetKeyString();
break;
}
}

break;
}
}
});
}

if (state.key_press[sf::Keyboard::Down])
{
parent->action_time = action_dt / 4;
}
});*/
void KeyMapper::SetKeyString()
{
Text *text_ptr = static_cast<Text*>(objects[1].get()->objects[0].get());
waiting = false;
sf::Keyboard::Key key = sf::Keyboard::Key(*key_ptr);
switch (this_type)
{
case KEYBOARD:
text_ptr->SetString(key_name(key));
break;
case JOYSTICK_AXIS:
text_ptr->SetString("Axis " + num2str(*key_ptr));
break;
case JOYSTICK_KEYS:
text_ptr->SetString("Key " + num2str(*key_ptr));
break;
}
}

Object * KeyMapper::GetCopy()
Expand Down
27 changes: 24 additions & 3 deletions src/Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ static const std::string priority_png = "images/priority.png";
static const std::string done_png = "images/done.png";
extern int focused;

template < typename T > std::string num2str(const T& n)
{
std::ostringstream stm;
if (n < 10) stm << "0";
stm << n;
return stm.str();
}

struct ColorFloat
{
Expand All @@ -54,6 +61,7 @@ ColorFloat ToColorF(sf::Color a);

struct InputState
{
bool isKeyPressed;
bool keys[sf::Keyboard::KeyCount] = { false };
bool key_press[sf::Keyboard::KeyCount] = { false };
bool mouse[3] = { false };
Expand Down Expand Up @@ -324,6 +332,9 @@ class Text : public Object
Text(Text& A);
Text(Text&& A);

template<class T>
void SetString(T str);

void operator=(Text& A);
void operator=(Text&& A);

Expand All @@ -342,6 +353,12 @@ inline Text::Text(T str, sf::Font & f, float size, sf::Color col)
clone_states();
}

template<class T>
inline void Text::SetString(T str)
{
text.get()->setString(str);
}


//a button
class Button: public Box
Expand Down Expand Up @@ -410,25 +427,29 @@ class KeyMapper : public Box
void operator=(KeyMapper&& A);

void CreateCallbacks();
void SetKeyString();

virtual Object* GetCopy();

MapperType this_type;
int *key_ptr;
bool waiting;
std::wstring wait_text;
};

template<class T>
inline KeyMapper::KeyMapper(T label, T act_label, int * key, float w, float h, MapperType type, sf::Color color_active, sf::Color color_hover, sf::Color color_main)
inline KeyMapper::KeyMapper(T label, T act_label, int * key, float w, float h, MapperType type, sf::Color color_active, sf::Color color_hover, sf::Color color_main): waiting(false), this_type(type), wait_text(act_label)
{
SetSize(w, h);
this_type = type;
SetBackgroundColor(color_main);
Box LeftBox(0, 0, float(w * 0.5f), h-defaultstate.margin*2.f, sf::Color(0, 100, 200, 0)),
RightBox(0, 0, float(w * 0.33f), h - defaultstate.margin * 2.f, sf::Color(0, 100, 200, 128));
LeftBox.AddObject(&Text(label, LOCAL("default"), h*0.7f, sf::Color::White), Allign::LEFT);
RightBox.AddObject(&Text(act_label, LOCAL("default"), h*0.7f, sf::Color::White), Allign::RIGHT);
RightBox.AddObject(&Text(act_label, LOCAL("default"), h*0.7f, sf::Color::White), Allign::CENTER);
RightBox.activestate.color_main = color_active;
hoverstate.color_main = color_hover;
this->AddObject(&LeftBox,Allign::LEFT);
this->AddObject(&RightBox, Allign::RIGHT);
key_ptr = key;
SetKeyString();
}
24 changes: 21 additions & 3 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

//Graphics settings
bool TOUCH_MODE = false;

bool DEBUG_BAR = false;

#if defined(_WIN32)
int WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int nCmdShow) {
Expand Down Expand Up @@ -274,6 +274,7 @@ int main(int argc, char *argv[]) {
{
const sf::Keyboard::Key keycode = event.key.code;
all_keys[keycode] = true;
io_state.isKeyPressed = true;
io_state.keys[keycode] = true;
io_state.key_press[keycode] = true;
if (event.key.code < 0 || event.key.code >= sf::Keyboard::KeyCount) { continue; }
Expand All @@ -291,6 +292,11 @@ int main(int argc, char *argv[]) {
credits_music.stop();
scene.StartNextLevel();
}
else if (keycode == sf::Keyboard::D && event.key.control)
{
DEBUG_BAR = !DEBUG_BAR;
TwDefine((std::string("Debug_bar visible=") + ((DEBUG_BAR) ? "true" : "false")).c_str());
}
else if (keycode == sf::Keyboard::Escape)
{
if (game_mode == MAIN_MENU)
Expand Down Expand Up @@ -327,20 +333,26 @@ int main(int argc, char *argv[]) {
}
}
}
else if (keycode == sf::Keyboard::R)
else if (keycode == SETTINGS.stg.control_mapping[RESTART])
{
if (game_mode == PLAYING) {
scene.ResetLevel();
}
}
else if (keycode == SETTINGS.stg.control_mapping[PAUSE])
{
if (game_mode == PLAYING) {
PauseGame(window, &overlays, &scene);
}
}
else if (keycode == sf::Keyboard::F1)
{
if (game_mode == PLAYING) {
show_cheats = !show_cheats;
scene.EnbaleCheats();
}
}
else if (keycode == sf::Keyboard::F5)
else if (keycode == SETTINGS.stg.control_mapping[SCREENSHOT])
{
TakeScreenshot();
}
Expand Down Expand Up @@ -593,6 +605,11 @@ int main(int argc, char *argv[]) {
float cam_ud = float(-mouse_delta.y) * ms;
cam_ud -= 0.05* ms *gamepad_state.axis_value[SETTINGS.stg.control_mapping[JOYSTICK_VIEW_AXIS_Y]];
cam_lr -= 0.05* ms *gamepad_state.axis_value[SETTINGS.stg.control_mapping[JOYSTICK_VIEW_AXIS_X]];

cam_ud += 5*ms * ( (all_keys[SETTINGS.stg.control_mapping[VIEWUP]] ? -1.0f : 0.0f) +
(all_keys[SETTINGS.stg.control_mapping[VIEWDOWN]] ? 1.0f : 0.0f) );
cam_lr += 5*ms * ((all_keys[SETTINGS.stg.control_mapping[VIEWRIGHT]] ? -1.0f : 0.0f) +
(all_keys[SETTINGS.stg.control_mapping[VIEWLEFT]] ? 1.0f : 0.0f));

float cam_z = mouse_wheel * SETTINGS.stg.wheel_sensitivity;

Expand Down Expand Up @@ -674,6 +691,7 @@ int main(int argc, char *argv[]) {
io_state.dt = prev_s;
io_state.time += io_state.dt;
UpdateAllObjects(&window, io_state);
io_state.isKeyPressed = false;
window.setView(default_window_view);

if (!skip_frame) {
Expand Down
Loading

0 comments on commit ea0e70e

Please sign in to comment.