-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ce2266
commit 68b5b0a
Showing
11 changed files
with
115 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "SwipePoint.hpp" | ||
|
||
SwipePoint::SwipePoint(cocos2d::CCPoint location, float direction) { | ||
m_location = location; | ||
m_direction = direction; | ||
} | ||
|
||
std::pair<cocos2d::CCPoint, cocos2d::CCPoint> SwipePoint::calculatePointPositions() { | ||
float angle1 = fmod(m_direction + 1.5708f, 2.f * M_PI); | ||
float angle2 = fmod(m_direction - 1.5708f, 2.f * M_PI); | ||
|
||
float dist = getDistanceFromTick(); | ||
|
||
cocos2d::CCPoint p1 = m_location + cocos2d::CCPoint{ cos(angle1)*dist, sin(angle1)*dist }; | ||
cocos2d::CCPoint p2 = m_location + cocos2d::CCPoint{ cos(angle2)*dist, sin(angle2)*dist }; | ||
return { p1, p2 }; | ||
} | ||
|
||
float SwipePoint::getDistanceFromTick() { | ||
// https://www.desmos.com/calculator/mcb1ys1alb | ||
if (m_tick < 0.03f) { | ||
return m_tick * 185.f; | ||
} else { | ||
return -m_tick * 46.f + 6.9f; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
#include <Geode/Geode.hpp> | ||
|
||
class SwipePoint { | ||
public: | ||
SwipePoint(cocos2d::CCPoint location, float direction); | ||
|
||
cocos2d::CCPoint m_location; | ||
float m_direction; | ||
float m_tick = 0.f; | ||
const float m_tickLength = 0.15f; | ||
|
||
std::pair<cocos2d::CCPoint, cocos2d::CCPoint> calculatePointPositions(); | ||
float getDistanceFromTick(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters