Skip to content

Commit d0ad6ef

Browse files
committed
1.0.6
1 parent 930c839 commit d0ad6ef

7 files changed

Lines changed: 32 additions & 65 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ file(GLOB SOURCES src/*.cpp)
1010

1111
add_library(${PROJECT_NAME} SHARED ${SOURCES})
1212

13-
include_directories(${OPENGL_INCLUDE_DIRS})
14-
1513
if(NOT DEFINED ENV{GEODE_SDK})
1614
message(
1715
FATAL_ERROR

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# v1.0.6
2+
3+
* backup file size is now shown
4+
* you can now save your backups in any directory
5+
* fixed backup sorting and added sorting option
6+
* fixed being unable to name backups
7+
* added exporting and importing backups to android
8+
19
# v1.0.5
210

311
* improved backup exporting and importing stuff (old exported backups will not works anymore) and removed exporting and importing backups from android, this might be supported in the future but idk

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"version": "v1.0.6",
88
"id": "abb2k.backup",
99
"name": "Backup",
10-
"developer": "abb2k",
10+
"developers": ["abb2k", "Bearodactyl"],
1111
"description": "allows you to easily backup your save file :D",
1212
"repository": "https://github.com/abb2k/Backup",
1313
"settings": {

src/CreateBackupLayer.cpp

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
#include "CreateBackupLayer.h"
22
#include <BackupCell.h>
3-
#include <Geode/Geode.hpp>
43
#include <Geode/ui/TextInput.hpp>
54
#include <string>
65

7-
using namespace geode::prelude;
8-
9-
CreateBackupLayer* CreateBackupLayer::create(BackupsLayer* _parentLayer) {
6+
CreateBackupLayer* CreateBackupLayer::create(BackupsLayer* const& _parentLayer) {
107
auto ret = new CreateBackupLayer();
11-
if (ret && ret->init(280, 99, _parentLayer, "GJ_square01.png")) {
8+
if (ret && ret->init(280, 99, _parentLayer, "GJ_square01.png", {0.f, 0.f, 80.f, 80.f})) {
129
ret->autorelease();
1310
} else {
1411
delete ret;
@@ -17,7 +14,7 @@ CreateBackupLayer* CreateBackupLayer::create(BackupsLayer* _parentLayer) {
1714
return ret;
1815
}
1916

20-
bool CreateBackupLayer::init(float _w, float _h, BackupsLayer* _parentLayer, const char* _spr) {
17+
bool CreateBackupLayer::setup(BackupsLayer* const& _parentLayer) {
2118
// create window
2219
auto winSize = CCDirector::sharedDirector()->getWinSize();
2320

@@ -27,26 +24,6 @@ bool CreateBackupLayer::init(float _w, float _h, BackupsLayer* _parentLayer, con
2724
m_mainLayer = CCLayer::create();
2825
this->addChild(m_mainLayer);
2926

30-
CCScale9Sprite* bg = CCScale9Sprite::create(_spr, {0.0f, 0.0f, 80.0f, 80.0f});
31-
bg->setContentSize(parentLayer->GetResFixedScale({_w, _h}));
32-
bg->setPosition(winSize.width / 2, winSize.height / 2);
33-
m_mainLayer->addChild(bg);
34-
35-
m_buttonMenu = CCMenu::create();
36-
m_mainLayer->addChild(m_buttonMenu);
37-
38-
// create close window button
39-
auto CloseS = CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
40-
CloseS->setScale(parentLayer->GetFixedScale(1));
41-
42-
auto CloseButton = CCMenuItemSpriteExtra::create(CloseS, nullptr, this, menu_selector(CreateBackupLayer::backButtonCallback));
43-
CloseButton->setUserData(reinterpret_cast<void*>(this));
44-
45-
m_buttonMenu->addChild(CloseButton);
46-
47-
CloseButton->setPosition(parentLayer->GetResFixedScale({-_w, _h}, 2.1f, true));
48-
CloseButton->setZOrder(1);
49-
5027
CCLabelBMFont* Label = CCLabelBMFont::create("Create Backup", "bigFont.fnt");
5128
Label->setPosition(parentLayer->GetResFixedScale({285, 194}));
5229
Label->setScale(0.75f);
@@ -96,7 +73,7 @@ bool CreateBackupLayer::init(float _w, float _h, BackupsLayer* _parentLayer, con
9673
void CreateBackupLayer::show(CCNode* parent) {
9774
this->setZOrder(100);
9875

99-
m_mainLayer->runAction(CCEaseElasticOut::create(CCScaleTo::create(0.6f, 1.1f), 0.5f));
76+
this->runAction(CCEaseElasticOut::create(CCScaleTo::create(0.6f, 1.1f), 0.5f));
10077
this->runAction(CCFadeTo::create(0.14f, 100));
10178

10279
auto readBackups = file::readDirectory(Mod::get()->getSaveDir() / "Backups/Auto-Backups");
@@ -110,7 +87,7 @@ void CreateBackupLayer::keyBackClicked() {
11087
this->removeFromParentAndCleanup(true);
11188
}
11289

113-
void CreateBackupLayer::backButtonCallback(CCObject* object) { keyBackClicked(); }
90+
void CreateBackupLayer::onClose(CCObject* object) { keyBackClicked(); }
11491

11592
void CreateBackupLayer::DoneAndSave(CCObject* object) {
11693
std::string custom_backup_path = Mod::get()->getSettingValue<std::string>("Backup_Save_Path");

src/CreateBackupLayer.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
#pragma once
2+
#include <Geode/Geode.hpp>
23
#include "Geode/ui/TextInput.hpp"
34
#include <BackupsLayer.h>
4-
#include <include.h>
5-
#include <string>
65

7-
class CreateBackupLayer : public FLAlertLayer {
6+
using namespace geode::prelude;
7+
8+
class CreateBackupLayer : public Popup<BackupsLayer* const&> {
89
protected:
9-
virtual bool init(float _w, float _h, BackupsLayer* _parentLayer, const char* _spr = "GJ_square01.png");
10+
bool setup(BackupsLayer* const& Level);
11+
//bool init(float _w, float _h, , const char* _spr = "GJ_square01.png");
1012

1113
public:
12-
static CreateBackupLayer* create(BackupsLayer* parentLayer);
14+
static CreateBackupLayer* create(BackupsLayer* const& parentLayer);
1315

14-
virtual void show(CCNode* parent);
16+
void show(CCNode* parent);
1517

1618
void keyBackClicked();
1719

18-
void backButtonCallback(CCObject* object);
20+
void onClose(cocos2d::CCObject*);
1921

2022
TextInput* NameInput;
2123

src/RenameBackupLayer.cpp

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
using namespace geode::prelude;
88

9-
RenameBackupLayer* RenameBackupLayer::create(BackupsLayer* _parentLayer, BackupCell* cell) {
9+
RenameBackupLayer* RenameBackupLayer::create(BackupsLayer* const& _parentLayer, BackupCell* const& cell) {
1010
auto ret = new RenameBackupLayer();
1111
if (ret && ret->init(280, 97, _parentLayer, cell, "GJ_square01.png")) {
1212
ret->autorelease();
@@ -17,7 +17,7 @@ RenameBackupLayer* RenameBackupLayer::create(BackupsLayer* _parentLayer, BackupC
1717
return ret;
1818
}
1919

20-
bool RenameBackupLayer::init(float _w, float _h, BackupsLayer* _parentLayer, BackupCell* cell, const char* _spr) {
20+
bool RenameBackupLayer::setup(BackupsLayer* const& _parentLayer, BackupCell* const& cell) {
2121
// create window
2222
auto winSize = CCDirector::sharedDirector()->getWinSize();
2323

@@ -29,29 +29,11 @@ bool RenameBackupLayer::init(float _w, float _h, BackupsLayer* _parentLayer, Bac
2929
m_mainLayer = CCLayer::create();
3030
this->addChild(m_mainLayer);
3131

32-
CCScale9Sprite* bg = CCScale9Sprite::create(_spr, {0.0f, 0.0f, 80.0f, 80.0f});
33-
bg->setContentSize(parentLayer->GetResFixedScale({_w, _h}));
34-
bg->setPosition(winSize.width / 2, winSize.height / 2);
35-
m_mainLayer->addChild(bg);
36-
37-
m_buttonMenu = CCMenu::create();
38-
m_mainLayer->addChild(m_buttonMenu);
39-
40-
// create close window button
41-
auto CloseS = CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
42-
CloseS->setScale(parentLayer->GetFixedScale(1));
43-
44-
auto CloseButton = CCMenuItemSpriteExtra::create(CloseS, nullptr, this, menu_selector(RenameBackupLayer::backButtonCallback));
45-
CloseButton->setUserData(reinterpret_cast<void*>(this));
46-
m_buttonMenu->addChild(CloseButton);
47-
CloseButton->setPosition(parentLayer->GetResFixedScale({-_w, _h}, 2.1f, true));
48-
CloseButton->setZOrder(1);
49-
5032
// add export button
5133
auto exportBackupSprite = CCSprite::createWithSpriteFrameName("accountBtn_myLevels_001.png");
5234
exportBackupSprite->setScale(parentLayer->GetFixedScale(1));
5335
auto exportBackupButton = CCMenuItemSpriteExtra::create(exportBackupSprite, nullptr, this, menu_selector(RenameBackupLayer::OnExport));
54-
exportBackupButton->setPosition(parentLayer->GetResFixedScale({_w, -_h}, 2.1f, true));
36+
exportBackupButton->setPosition(parentLayer->GetResFixedScale({m_size.width, -m_size.height}, 2.1f, true));
5537
m_buttonMenu->addChild(exportBackupButton);
5638

5739
CCLabelBMFont* Label = CCLabelBMFont::create("Backup Settings", "bigFont.fnt");
@@ -98,7 +80,7 @@ bool RenameBackupLayer::init(float _w, float _h, BackupsLayer* _parentLayer, Bac
9880
void RenameBackupLayer::show(CCNode* parent) {
9981
this->setZOrder(100);
10082

101-
m_mainLayer->runAction(CCEaseElasticOut::create(CCScaleTo::create(0.6f, 1.1f), 0.5f));
83+
this->runAction(CCEaseElasticOut::create(CCScaleTo::create(0.6f, 1.1f), 0.5f));
10284
this->runAction(CCFadeTo::create(0.14f, 100));
10385

10486
parent->addChild(this);
@@ -115,7 +97,7 @@ void RenameBackupLayer::keyBackClicked() {
11597
this->removeFromParentAndCleanup(true);
11698
}
11799

118-
void RenameBackupLayer::backButtonCallback(CCObject* object) { keyBackClicked(); }
100+
void RenameBackupLayer::onClose(CCObject* object) { keyBackClicked(); }
119101

120102
void RenameBackupLayer::DoneAndSave(CCObject* object) {
121103
if (NameInput->getString() != "") {

src/RenameBackupLayer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
#include <BackupsLayer.h>
55
#include <include.h>
66

7-
class RenameBackupLayer : public FLAlertLayer, public FLAlertLayerProtocol {
7+
class RenameBackupLayer : public Popup<BackupsLayer* const&, BackupCell* const&>, public FLAlertLayerProtocol {
88
protected:
9-
virtual bool init(float _w, float _h, BackupsLayer* _parentLayer, BackupCell* cell, const char* _spr = "GJ_square01.png");
9+
virtual bool setup(BackupsLayer* const& _parentLayer, BackupCell* const& cell);
1010

1111
public:
12-
static RenameBackupLayer* create(BackupsLayer* parentLayer, BackupCell* cell);
12+
static RenameBackupLayer* create(BackupsLayer* const& parentLayer, BackupCell* const& cell);
1313

1414
virtual void show(CCNode* parent);
1515

1616
void keyBackClicked();
1717

18-
void backButtonCallback(CCObject* object);
18+
void onClose(CCObject* object);
1919

2020
TextInput* NameInput;
2121

0 commit comments

Comments
 (0)