File tree Expand file tree Collapse file tree 8 files changed +6
-25
lines changed
Expand file tree Collapse file tree 8 files changed +6
-25
lines changed Original file line number Diff line number Diff line change @@ -505,7 +505,6 @@ class Engine {
505505 virtual bool windowRequestsClose () = 0;
506506 virtual void pollEvents () = 0;
507507 virtual bool isKeyPressed (char c) = 0; // for lowercase a-z and 0-9 only
508- virtual int getKeyCode (char c) = 0; // for lowercase a-z and 0-9 only
509508 virtual std::string getClipboardText () = 0;
510509 virtual void setClipboardText (std::string text) = 0;
511510
Original file line number Diff line number Diff line change @@ -353,7 +353,6 @@ class MockGLEngine : public Engine {
353353 bool windowRequestsClose () override ;
354354 void pollEvents () override ;
355355 bool isKeyPressed (char c) override ; // for lowercase a-z and 0-9 only
356- int getKeyCode (char c) override ; // for lowercase a-z and 0-9 only
357356 std::string getClipboardText () override ;
358357 void setClipboardText (std::string text) override ;
359358
Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ class GLEngineEGL : public GLEngine {
6262 bool windowRequestsClose () override ;
6363
6464 bool isKeyPressed (char c) override ; // for lowercase a-z and 0-9 only
65- int getKeyCode (char c) override ; // for lowercase a-z and 0-9 only
6665 std::string getClipboardText () override ;
6766 void setClipboardText (std::string text) override ;
6867
Original file line number Diff line number Diff line change @@ -67,7 +67,6 @@ class GLEngineGLFW : public GLEngine {
6767 bool windowRequestsClose () override ;
6868
6969 bool isKeyPressed (char c) override ; // for lowercase a-z and 0-9 only
70- int getKeyCode (char c) override ; // for lowercase a-z and 0-9 only
7170 std::string getClipboardText () override ;
7271 void setClipboardText (std::string text) override ;
7372
Original file line number Diff line number Diff line change @@ -1649,8 +1649,6 @@ void MockGLEngine::pollEvents() {}
16491649
16501650bool MockGLEngine::isKeyPressed (char c) { return false ; }
16511651
1652- int MockGLEngine::getKeyCode (char c) { return 77 ; }
1653-
16541652void MockGLEngine::ImGuiNewFrame () {
16551653
16561654 // ImGUI seems to crash without a backend if we don't do this
Original file line number Diff line number Diff line change @@ -466,11 +466,6 @@ bool GLEngineEGL::isKeyPressed(char c) {
466466 return false ;
467467}
468468
469- int GLEngineEGL::getKeyCode (char c) {
470- // not defined in headless mode
471- return -1 ;
472- }
473-
474469std::string GLEngineEGL::getClipboardText () {
475470 // not defined in headless mode
476471 return " " ;
Original file line number Diff line number Diff line change @@ -234,14 +234,6 @@ bool GLEngineGLFW::isKeyPressed(char c) {
234234 return false ;
235235}
236236
237- int GLEngineGLFW::getKeyCode (char c) {
238- if (c >= ' 0' && c <= ' 9' ) return static_cast <int >(ImGuiKey_0) + (c - ' 0' );
239- if (c >= ' a' && c <= ' z' ) return static_cast <int >(ImGuiKey_A) + (c - ' a' );
240- if (c >= ' A' && c <= ' Z' ) return static_cast <int >(ImGuiKey_A) + (c - ' A' );
241- exception (" getKeyCode only supports 0-9, a-z, A-Z" );
242- return -1 ;
243- }
244-
245237std::string GLEngineGLFW::getClipboardText () {
246238 std::string clipboardData = ImGui::GetClipboardText ();
247239 return clipboardData;
Original file line number Diff line number Diff line change @@ -297,12 +297,12 @@ void processKeyboardNavigation(ImGuiIO& io) {
297297
298298 glm::vec3 delta{0 .f , 0 .f , 0 .f };
299299
300- if (ImGui::IsKeyDown (static_cast <ImGuiKey>(render::engine-> getKeyCode ( ' a ' )) )) delta.x += 1 .f ;
301- if (ImGui::IsKeyDown (static_cast <ImGuiKey>(render::engine-> getKeyCode ( ' d ' )) )) delta.x += -1 .f ;
302- if (ImGui::IsKeyDown (static_cast <ImGuiKey>(render::engine-> getKeyCode ( ' q ' )) )) delta.y += 1 .f ;
303- if (ImGui::IsKeyDown (static_cast <ImGuiKey>(render::engine-> getKeyCode ( ' e ' )) )) delta.y += -1 .f ;
304- if (ImGui::IsKeyDown (static_cast <ImGuiKey>(render::engine-> getKeyCode ( ' w ' )) )) delta.z += 1 .f ;
305- if (ImGui::IsKeyDown (static_cast <ImGuiKey>(render::engine-> getKeyCode ( ' s ' )) )) delta.z += -1 .f ;
300+ if (ImGui::IsKeyDown (ImGuiKey_A )) delta.x += 1 .f ;
301+ if (ImGui::IsKeyDown (ImGuiKey_D )) delta.x += -1 .f ;
302+ if (ImGui::IsKeyDown (ImGuiKey_Q )) delta.y += 1 .f ;
303+ if (ImGui::IsKeyDown (ImGuiKey_E )) delta.y += -1 .f ;
304+ if (ImGui::IsKeyDown (ImGuiKey_W )) delta.z += 1 .f ;
305+ if (ImGui::IsKeyDown (ImGuiKey_S )) delta.z += -1 .f ;
306306
307307 if (glm::length (delta) > 0 .) {
308308 hasMovement = true ;
You can’t perform that action at this time.
0 commit comments