Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
Fix triple tap issue
Browse files Browse the repository at this point in the history
  • Loading branch information
foxhatleo committed Mar 27, 2021
1 parent 9c40cfb commit fc8a5d1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build-win10/PanicPainter/PanicPainter.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
<ClCompile Include="..\..\source\PPApp.cpp" />
<ClCompile Include="..\..\source\scenes\gameplay\PPCanvas.cpp" />
<ClCompile Include="..\..\source\scenes\gameplay\PPCanvasBlock.cpp" />
<ClCompile Include="..\..\source\scenes\gameplay\PPColorPaletteView.cpp" />
<ClCompile Include="..\..\source\scenes\gameplay\PPGlobalTimer.cpp" />
<ClCompile Include="..\..\source\scenes\gameplay\PPColorPalette.cpp" />
<ClCompile Include="..\..\source\scenes\gameplay\PPColorStrip.cpp" />
Expand Down Expand Up @@ -224,6 +225,7 @@
<ClInclude Include="..\..\source\PPApp.h" />
<ClInclude Include="..\..\source\scenes\gameplay\PPCanvas.h" />
<ClInclude Include="..\..\source\scenes\gameplay\PPCanvasBlock.h" />
<ClInclude Include="..\..\source\scenes\gameplay\PPColorPaletteView.h" />
<ClInclude Include="..\..\source\scenes\gameplay\PPGlobalTimer.h" />
<ClInclude Include="..\..\source\scenes\gameplay\PPColorPalette.h" />
<ClInclude Include="..\..\source\scenes\gameplay\PPColorStrip.h" />
Expand Down
6 changes: 6 additions & 0 deletions build-win10/PanicPainter/PanicPainter.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
<ClCompile Include="..\..\source\scenes\pause\PPPauseScene.cpp">
<Filter>Scenes\Pause</Filter>
</ClCompile>
<ClCompile Include="..\..\source\scenes\gameplay\PPColorPaletteView.cpp">
<Filter>Scenes\Gameplay</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="PanicPainter.rc">
Expand Down Expand Up @@ -145,5 +148,8 @@
<ClInclude Include="..\..\source\scenes\pause\PPPauseScene.h">
<Filter>Scenes\Pause</Filter>
</ClInclude>
<ClInclude Include="..\..\source\scenes\gameplay\PPColorPaletteView.h">
<Filter>Scenes\Gameplay</Filter>
</ClInclude>
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions source/controllers/PPActionController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ void ActionController::update(const set<pair<uint, uint>> &activeCanvases,
if (input.didTripleTap() && input.justReleased() &&
startingPointIn && currentPointIn) {
_state.clearColor(i, i2, selectedColor);
input.clearPreviousTaps();
}

if (input.isPressing() && startingPointIn && currentPointIn) {
Expand Down
7 changes: 7 additions & 0 deletions source/controllers/PPInputController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,10 @@ bool InputController::didTripleTap() const {
_inputs[2]->isJustTap() &&
_inputs[1]->timeSinceLastInstance <= _consecutiveTapThreshold;
}

void InputController::clearPreviousTaps() {
_inputs.clear();
if (_currentInput != nullptr) {
_inputs.push_front(_currentInput);
}
}
2 changes: 2 additions & 0 deletions source/controllers/PPInputController.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ class InputController {
/** Check if last input resulted in a triple tap. */
bool didTripleTap() const;

void clearPreviousTaps();

/** Utility function to check if a point is in a scene node. */
static bool inScene(const Vec2 &point, const ptr<SceneNode> &scene);

Expand Down

0 comments on commit fc8a5d1

Please sign in to comment.