-
Notifications
You must be signed in to change notification settings - Fork 1
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
85b7bee
commit 4cffd1f
Showing
16 changed files
with
163 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// not taken from https://github.com/acaruso-xx/slope-geode/blob/main/src/plate/LoadingCircle.cpp | ||
#include "RLLoadingCircle.hpp" | ||
|
||
RLLoadingCircle* RLLoadingCircle::create() | ||
{ | ||
auto ret = new RLLoadingCircle(); | ||
|
||
if (ret && ret->init()) | ||
ret->autorelease(); | ||
else | ||
{ | ||
delete ret; | ||
ret = nullptr; | ||
} | ||
|
||
return ret; | ||
} | ||
|
||
bool RLLoadingCircle::init() | ||
{ | ||
if (!this->initWithFile("loadingCircle.png")) return false; | ||
|
||
this->setBlendFunc({ GL_SRC_ALPHA, GL_ONE }); | ||
this->setOpacity(0); | ||
this->setZOrder(105); | ||
|
||
return true; | ||
} | ||
|
||
void RLLoadingCircle::positionCenter() | ||
{ | ||
this->setPosition(cocos2d::CCDirector::sharedDirector()->getWinSize() / 2); | ||
} | ||
|
||
void RLLoadingCircle::fadeIn() | ||
{ | ||
auto* fadeInAction = cocos2d::CCFadeTo::create(.4f, 200); | ||
fadeInAction->setTag(ACTION_TAG::FADE_IN); | ||
|
||
this->runAction(fadeInAction); | ||
} | ||
|
||
void RLLoadingCircle::fadeOut() | ||
{ | ||
this->stopActionByTag(ACTION_TAG::FADE_IN); | ||
this->stopActionByTag(ACTION_TAG::ROTATE); | ||
|
||
auto* fadeOutAction = cocos2d::CCFadeTo::create(.4f, 0); | ||
fadeOutAction->setTag(ACTION_TAG::FADE_OUT); | ||
|
||
this->runAction(fadeOutAction); | ||
} | ||
|
||
void RLLoadingCircle::startRotate() | ||
{ | ||
auto* rotateAction = cocos2d::CCRepeatForever::create( | ||
cocos2d::CCRotateBy::create(1.f, 360.f) | ||
); | ||
rotateAction->setTag(ACTION_TAG::ROTATE); | ||
|
||
this->runAction(rotateAction); | ||
} | ||
|
||
void RLLoadingCircle::stopRotate() | ||
{ | ||
this->stopActionByTag(ACTION_TAG::ROTATE); | ||
} | ||
|
||
void RLLoadingCircle::show() | ||
{ | ||
fadeIn(); | ||
startRotate(); | ||
} | ||
|
||
void RLLoadingCircle::stopAndHide() | ||
{ | ||
stopRotate(); | ||
fadeOut(); | ||
} |
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,29 @@ | ||
#pragma once | ||
#include <Geode/cocos/sprite_nodes/CCSprite.h> | ||
#include <Geode/cocos/actions/CCActionInterval.h> | ||
|
||
class RLLoadingCircle : public cocos2d::CCSprite | ||
{ | ||
public: | ||
static RLLoadingCircle* create(); | ||
|
||
bool init() override; | ||
|
||
void positionCenter(); | ||
|
||
void fadeIn(); | ||
void fadeOut(); | ||
void startRotate(); | ||
void stopRotate(); | ||
|
||
void show(); | ||
void stopAndHide(); | ||
|
||
private: | ||
enum ACTION_TAG : int | ||
{ | ||
FADE_IN, | ||
FADE_OUT, | ||
ROTATE | ||
}; | ||
}; |
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