Skip to content

Commit

Permalink
Merge pull request #19 from Cvolton/controller-crash
Browse files Browse the repository at this point in the history
Fix crash when controller stick is held on startup
  • Loading branch information
altalk23 authored Oct 28, 2023
2 parents d9ffbdf + 2fad842 commit 2c98573
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/DevTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ bool DevTools::pausedGame() const {
return m_pauseGame;
}

bool DevTools::isSetup() const {
return m_setup;
}

CCNode* DevTools::getSelectedNode() const {
return m_selectedNode;
}
Expand Down
1 change: 1 addition & 0 deletions src/DevTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class DevTools {

bool shouldPopGame() const;
bool pausedGame() const;
bool isSetup() const;

CCNode* getSelectedNode() const;
void selectNode(CCNode* node);
Expand Down
2 changes: 2 additions & 0 deletions src/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ static float SCROLL_SENSITIVITY = 10;

class $modify(CCMouseDispatcher) {
bool dispatchScrollMSG(float y, float x) {
if(!DevTools::get()->isSetup()) return true;

auto& io = ImGui::GetIO();
io.AddMouseWheelEvent(x / SCROLL_SENSITIVITY, -y / SCROLL_SENSITIVITY);

Expand Down

0 comments on commit 2c98573

Please # to comment.