Skip to content

Commit 4cffd1f

Browse files
committed
Android bugfixes and stuff
1 parent 85b7bee commit 4cffd1f

16 files changed

+163
-38
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [2.0.4] - 2024-03-13
9+
10+
### Added
11+
12+
- `RLLoadingCircle`, a better LoadingCircle lol
13+
14+
### Changed
15+
16+
- Cleaned up `#include`s in header files
17+
18+
### Fixed
19+
20+
- 5 Character limit in `RLIntegerInputLayer`
21+
- `LoadingCircle` in wrong position on Android
22+
823
## [2.0.3] - 2024-03-09
924

1025
### Changed

mod.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
{
2-
"geode": "2.0.0-beta.21",
2+
"geode": "2.0.0-beta.22",
33
"gd": {
44
"win": "2.204",
55
"android": "2.205",
66
"mac": "2.200"
77
},
8-
"version": "v2.0.3",
8+
"version": "v2.0.4",
99
"id": "spaghettdev.gd-roulette",
1010
"name": "GD-Roulette",
1111
"developer": "SpaghettDev",
1212
"description": "An in-game level roulette.",
1313
"repository": "https://github.com/SpaghettDev/GD-Roulette",
14+
"links": {
15+
"community": "https://discord.gg/3bShQb6Jz3",
16+
"source": "https://github.com/SpaghettDev/GD-Roulette"
17+
},
1418
"issues": {
1519
"info": "Report any bugs/suggestions here.",
1620
"url": "https://github.com/SpaghettDev/GD-Roulette/issues"

src/custom_layers/RLIntegerInputLayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ bool RLIntegerInputLayer::init(const IntegerInputInfo& iili)
7070
input_node->setString(fmt::format("{}", m_iili.starting_value.value()).c_str());
7171
input_node->setAllowedChars("0123456789");
7272
input_node->setMaxLabelScale(.5f);
73-
input_node->setMaxLabelLength(5);
73+
input_node->setMaxLabelLength(m_iili.max_length);
7474
input_node->setPosition({ .0f, 5.f });
7575
input_node->setID("input-node");
7676
m_buttonMenu->addChild(input_node);
@@ -100,7 +100,7 @@ void RLIntegerInputLayer::onClose(CCObject*)
100100
{
101101
m_integer = m_iili.starting_value.value_or(0);
102102
}
103-
103+
104104
m_iili.onFinish(this);
105105

106106
this->setKeypadEnabled(false);

src/custom_layers/RLIntegerInputLayer.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ struct IntegerInputInfo
1515
int fallback_value;
1616
int max_value; // inclusive
1717
std::optional<int> starting_value;
18+
int max_length;
1819
bool show_arrows;
1920
std::function<void(RLIntegerInputLayer*)> onFinish;
2021
};

src/custom_layers/base/BaseCustomAlertLayer.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#pragma once
22
#include <limits>
3+
#include <string>
34

4-
#include <Geode/Bindings.hpp>
5+
#include <Geode/cocos/include/ccTypes.h>
6+
#include <Geode/cocos/cocoa/CCObject.h>
7+
#include <Geode/binding/CCMenuItemSpriteExtra.hpp>
58

69
using namespace geode::prelude;
710

src/custom_nodes/RLDifficultyNode.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#pragma once
2-
// #include <Geode/cocos/base_nodes/CCNode.h>
3-
// #include <Geode/cocos/sprite_nodes/CCSprite.h>
4-
// #include <Geode/cocos/include/ccTypes.h>
5-
#include <Geode/Geode.hpp>
2+
#include <Geode/cocos/base_nodes/CCNode.h>
3+
#include <Geode/cocos/sprite_nodes/CCSprite.h>
4+
#include <Geode/cocos/include/ccTypes.h>
65

76
using namespace geode::prelude;
87

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// not taken from https://github.com/acaruso-xx/slope-geode/blob/main/src/plate/LoadingCircle.cpp
2+
#include "RLLoadingCircle.hpp"
3+
4+
RLLoadingCircle* RLLoadingCircle::create()
5+
{
6+
auto ret = new RLLoadingCircle();
7+
8+
if (ret && ret->init())
9+
ret->autorelease();
10+
else
11+
{
12+
delete ret;
13+
ret = nullptr;
14+
}
15+
16+
return ret;
17+
}
18+
19+
bool RLLoadingCircle::init()
20+
{
21+
if (!this->initWithFile("loadingCircle.png")) return false;
22+
23+
this->setBlendFunc({ GL_SRC_ALPHA, GL_ONE });
24+
this->setOpacity(0);
25+
this->setZOrder(105);
26+
27+
return true;
28+
}
29+
30+
void RLLoadingCircle::positionCenter()
31+
{
32+
this->setPosition(cocos2d::CCDirector::sharedDirector()->getWinSize() / 2);
33+
}
34+
35+
void RLLoadingCircle::fadeIn()
36+
{
37+
auto* fadeInAction = cocos2d::CCFadeTo::create(.4f, 200);
38+
fadeInAction->setTag(ACTION_TAG::FADE_IN);
39+
40+
this->runAction(fadeInAction);
41+
}
42+
43+
void RLLoadingCircle::fadeOut()
44+
{
45+
this->stopActionByTag(ACTION_TAG::FADE_IN);
46+
this->stopActionByTag(ACTION_TAG::ROTATE);
47+
48+
auto* fadeOutAction = cocos2d::CCFadeTo::create(.4f, 0);
49+
fadeOutAction->setTag(ACTION_TAG::FADE_OUT);
50+
51+
this->runAction(fadeOutAction);
52+
}
53+
54+
void RLLoadingCircle::startRotate()
55+
{
56+
auto* rotateAction = cocos2d::CCRepeatForever::create(
57+
cocos2d::CCRotateBy::create(1.f, 360.f)
58+
);
59+
rotateAction->setTag(ACTION_TAG::ROTATE);
60+
61+
this->runAction(rotateAction);
62+
}
63+
64+
void RLLoadingCircle::stopRotate()
65+
{
66+
this->stopActionByTag(ACTION_TAG::ROTATE);
67+
}
68+
69+
void RLLoadingCircle::show()
70+
{
71+
fadeIn();
72+
startRotate();
73+
}
74+
75+
void RLLoadingCircle::stopAndHide()
76+
{
77+
stopRotate();
78+
fadeOut();
79+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#pragma once
2+
#include <Geode/cocos/sprite_nodes/CCSprite.h>
3+
#include <Geode/cocos/actions/CCActionInterval.h>
4+
5+
class RLLoadingCircle : public cocos2d::CCSprite
6+
{
7+
public:
8+
static RLLoadingCircle* create();
9+
10+
bool init() override;
11+
12+
void positionCenter();
13+
14+
void fadeIn();
15+
void fadeOut();
16+
void startRotate();
17+
void stopRotate();
18+
19+
void show();
20+
void stopAndHide();
21+
22+
private:
23+
enum ACTION_TAG : int
24+
{
25+
FADE_IN,
26+
FADE_OUT,
27+
ROTATE
28+
};
29+
};

src/layers/CreatorLayer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "../roulette/manager/RouletteManager.hpp"
22
#include "../roulette/layers/RLRouletteLayer.hpp"
33

4-
#include <Geode/Geode.hpp>
54
#include <Geode/modify/CreatorLayer.hpp>
65

76
using namespace geode::prelude;

src/layers/LevelInfoLayer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "../roulette/manager/RouletteManager.hpp"
44
#include "../roulette/layers/RLRouletteLayer.hpp"
55

6-
#include <Geode/Geode.hpp>
76
#include <Geode/modify/LevelInfoLayer.hpp>
87

98
using namespace geode::prelude;

0 commit comments

Comments
 (0)