Skip to content

Commit

Permalink
tables and more
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimjasmine00 committed Aug 20, 2024
1 parent 097fedf commit fa1c46b
Show file tree
Hide file tree
Showing 10 changed files with 265 additions and 279 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

project(FakeRate VERSION 1.4.3)
project(FakeRate VERSION 1.4.4)

add_library(${PROJECT_NAME} SHARED
src/FakeRate.cpp
src/FREditPopup.cpp
src/FREffects.cpp
src/main.cpp
src/TableNode.cpp
)

if (NOT DEFINED ENV{GEODE_SDK})
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A mod that allows you to assign a fake rating to online levels.

## Features
- Ability to give online levels a fake rating, which can be done either through a button in the level info screen or by editing save data
- A popup that allows you to independently rate the level's difficulty, stars, feature status, and coin verification status
- A popup that allows you to independently rate the level's difficulty, stars/moons, feature status, and coin verification status
- Support for More Difficulties, Grandpa Demon, Demons In Between, and GDDP Integration

## Credits
Expand Down
14 changes: 7 additions & 7 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A mod that allows you to assign a fake rating to online levels.

## Features
- Ability to give online levels a fake rating, which can be done either through a button in the level info screen or by editing save data
- A popup that allows you to independently rate the level's difficulty, stars, feature status, and coin verification status
- A popup that allows you to independently rate the level's difficulty, stars/moons, feature status, and coin verification status
- Support for More Difficulties, Grandpa Demon, Demons In Between, and GDDP Integration

## Credits
Expand All @@ -13,10 +13,10 @@ A mod that allows you to assign a fake rating to online levels.
- [hiimjustin000](user:7466002) - Creator of the Demons In Between mod and this mod

## Gallery
![Fake Rate Popup](hiimjustin000.fake_rate/fake-rate-popup.png?scale=0.9)\
![Difficulty Popup](hiimjustin000.fake_rate/difficulty-popup.png?scale=0.9)\
![Fake Rate Popup](hiimjustin000.fake_rate/fake-rate-popup.png?scale=0.9375)\
![Difficulty Popup](hiimjustin000.fake_rate/difficulty-popup.png?scale=0.9375)\
![Grandpa Demon Popup](hiimjustin000.fake_rate/grd-popup.png?scale=1.2)\
![Demons In Between Popup](hiimjustin000.fake_rate/dib-popup.png?scale=0.9)\
![GDDP Integration Popup](hiimjustin000.fake_rate/gddp-popup.png?scale=0.9)\
![Stars Popup](hiimjustin000.fake_rate/stars-popup.png?scale=1.2)\
![Feature Popup](hiimjustin000.fake_rate/feature-popup.png?scale=0.9)
![Demons In Between Popup](hiimjustin000.fake_rate/dib-popup.png?scale=0.9231)\
![GDDP Integration Popup](hiimjustin000.fake_rate/gddp-popup.png?scale=0.9231)\
![Stars Popup](hiimjustin000.fake_rate/stars-popup.png?scale=1.25)\
![Feature Popup](hiimjustin000.fake_rate/feature-popup.png?scale=0.9375)
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Fake Rate Changelog
## v1.4.4 (2024-08-19)
- Fixed the weird positioning of difficulty faces in the difficulty selection popup if More Difficulties is disabled
- Changed references of stars to moons in the set stars popup if the level is in platformer mode
- Aligned the images' widths in the about page gallery

## v1.4.3 (2024-08-18)
- Added GDDP Integration background colors
- Fixed a bug where editing a fake rate would not save the GDDP difficulty
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"win": "2.206",
"mac": "2.206"
},
"version": "v1.4.3",
"version": "v1.4.4",
"id": "hiimjustin000.fake_rate",
"name": "Fake Rate",
"developer": "hiimjustin000",
Expand Down
418 changes: 155 additions & 263 deletions src/FREditPopup.cpp

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/FREditPopup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ class FREditPopup : public Popup<GJGameLevel*, FakeRateSaveData, UpdateFakeRateC

class FRSetDifficultyPopup : public Popup<FakeRateSaveData, bool, SetDifficultyCallback> {
protected:
inline static std::vector<std::pair<int, int>> DIFFICULTIES = {
{ 0, 0 }, { -1, 0 }, { 1, 0 }, { 2, 0 }, { 3, 4 }, { 3, 0 }, { 4, 0 }, { 4, 7 },
{ 5, 0 }, { 5, 9 }, { 6, 0 }, { 7, 0 }, { 8, 0 }, { 9, 0 }, { 10, 0 }
};

int m_difficulty;
int m_moreDifficultiesOverride;
int m_grandpaDemonOverride;
Expand All @@ -45,7 +50,6 @@ class FRSetDifficultyPopup : public Popup<FakeRateSaveData, bool, SetDifficultyC
CCMenuItemSpriteExtra* m_selected;

bool setup(FakeRateSaveData, bool, SetDifficultyCallback) override;
void createDifficultyToggle(CCMenu*, int, int);
public:
static FRSetDifficultyPopup* create(FakeRateSaveData, bool, SetDifficultyCallback);
};
Expand Down Expand Up @@ -74,7 +78,6 @@ class FRSetFeaturePopup : public Popup<FakeRateSaveData, bool, SetIntCallback> {
CCMenuItemSpriteExtra* m_selected;

bool setup(FakeRateSaveData, bool, SetIntCallback) override;
void createFeatureToggle(CCMenu*, GJFeatureState);
public:
static FRSetFeaturePopup* create(FakeRateSaveData, bool, SetIntCallback);
};
Expand All @@ -85,7 +88,6 @@ class FRGRDPopup : public Popup<int, SetIntCallback> {
CCMenuItemSpriteExtra* m_selected;

bool setup(int, SetIntCallback) override;
void createGRDToggle(CCMenu*, int);
public:
static FRGRDPopup* create(int, SetIntCallback);
};
Expand All @@ -96,7 +98,6 @@ class FRDIBPopup : public Popup<int, SetIntCallback> {
CCMenuItemSpriteExtra* m_selected;

bool setup(int, SetIntCallback) override;
void createDIBToggle(CCMenu*, int);
public:
static FRDIBPopup* create(int, SetIntCallback);
};
Expand All @@ -107,7 +108,6 @@ class FRGDDPPopup : public Popup<int, SetIntCallback> {
CCMenuItemSpriteExtra* m_selected;

bool setup(int, SetIntCallback) override;
void createGDDPToggle(CCMenu*, int);
public:
static FRGDDPPopup* create(int, SetIntCallback);
};
2 changes: 1 addition & 1 deletion src/FREffects.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "FakeRate.hpp"
#include "TableNode.hpp"

class FREffects {
public:
Expand Down
65 changes: 65 additions & 0 deletions src/TableNode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#include "TableNode.hpp"

TableNode* TableNode::create(int columns, int rows) {
auto ret = new TableNode();
if (ret->init(columns, rows)) {
ret->autorelease();
return ret;
}
delete ret;
return nullptr;
}

bool TableNode::init(int columns, int rows) {
if (!CCNode::init()) return false;

m_menus = CCArray::create();
m_menus->retain();
m_columns = columns;
m_rows = rows;

return true;
}

void TableNode::setColumnLayout(AxisLayout* columnLayout) {
m_columnLayout = columnLayout;
setLayout(m_columnLayout);
}

void TableNode::setRowLayout(AxisLayout* rowLayout) {
m_rowLayout = rowLayout;
for (auto menu : CCArrayExt<CCMenu*>(m_menus)) {
menu->setLayout(m_rowLayout);
}
}

void TableNode::setRowHeight(float rowHeight) {
m_rowHeight = rowHeight;
for (auto menu : CCArrayExt<CCMenu*>(m_menus)) {
menu->setContentSize({ m_obContentSize.width, rowHeight });
}
}

void TableNode::updateAllLayouts() {
for (auto menu : CCArrayExt<CCMenu*>(m_menus)) {
menu->updateLayout();
}
updateLayout();
}

void TableNode::addButton(CCMenuItemSpriteExtra* button) {
CCMenu* menu = nullptr;
if (m_menus->count() <= 0 || static_cast<CCMenu*>(m_menus->objectAtIndex(m_menus->count() - 1))->getChildrenCount() >= m_columns) {
menu = CCMenu::create();
menu->setContentSize({ m_obContentSize.width, m_rowHeight });
menu->setLayout(m_rowLayout);
addChild(menu);
m_menus->addObject(menu);
} else menu = static_cast<CCMenu*>(m_menus->objectAtIndex(m_menus->count() - 1));

menu->addChild(button);
}

TableNode::~TableNode() {
CC_SAFE_RELEASE(m_menus);
}
23 changes: 23 additions & 0 deletions src/TableNode.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "FakeRate.hpp"

class TableNode : public CCNode {
protected:
CCArray* m_menus;
AxisLayout* m_columnLayout;
AxisLayout* m_rowLayout;
int m_columns;
int m_rows;
float m_rowHeight;

bool init(int columns, int rows);
public:
static TableNode* create(int columns, int rows);

void setColumnLayout(AxisLayout*);
void setRowLayout(AxisLayout*);
void setRowHeight(float);
void updateAllLayouts();
void addButton(CCMenuItemSpriteExtra*);

~TableNode() override;
};

0 comments on commit fa1c46b

Please sign in to comment.