Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alphalaneous committed Nov 19, 2024
1 parent 56c7978 commit dcf35c7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/ui/hooks/FLAlertLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class $modify(MyFLAlertLayer, FLAlertLayer){

bool init(FLAlertLayerProtocol* p0, char const* p1, gd::string p2, char const* p3, char const* p4, float p5, bool p6, float p7, float p8){
bool init(FLAlertLayerProtocol* p0, char const* p1, std::string p2, char const* p3, char const* p4, float p5, bool p6, float p7, float p8){

if(!FLAlertLayer::init(p0, p1, p2, p3, p4, p5, p6, p7, p8)){
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/nodes/MCButton.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#include "MCButton.h"
#include "MCButtonChild.h"

MCButton* MCButton::create(gd::string text, float width, CCObject* target, SEL_MenuHandler selector){
MCButton* MCButton::create(std::string text, float width, CCObject* target, SEL_MenuHandler selector){

MCButton *ret = new (std::nothrow) MCButton();

MCButtonChild* child = MCButtonChild::create(text, width, target, selector);
ret->child = child;
if (ret && ret->init()) {
ret->autorelease();
ret->setContentSize(child->getScaledContentSize());
ret->addChild(child);
ret->ignoreAnchorPointForPosition(false);
ret->autorelease();
ret->scheduleUpdate();
} else {
delete ret;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/nodes/MCButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MCButton : public CCMenu

bool isBeingTouched = false;

static MCButton* create(gd::string text, float width, CCObject* target, SEL_MenuHandler selector);
static MCButton* create(std::string text, float width, CCObject* target, SEL_MenuHandler selector);

MCButtonChild* child;
void setInvisible();
Expand Down
18 changes: 8 additions & 10 deletions src/ui/nodes/MCButtonChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using namespace geode::prelude;

CCSprite* generateEdgeSprite(gd::string textureName){
CCSprite* generateEdgeSprite(std::string textureName){

float scale = CCDirector::sharedDirector()->getContentScaleFactor()/4;

Expand All @@ -19,7 +19,7 @@ CCSprite* generateEdgeSprite(gd::string textureName){
return sprite;
}

CCSprite* generateSprite(MCButtonChild* parent, gd::string textureName, float width){
CCSprite* generateSprite(MCButtonChild* parent, std::string textureName, float width){

float scale = CCDirector::sharedDirector()->getContentScaleFactor()/4;

Expand All @@ -45,9 +45,9 @@ CCSprite* generateSprite(MCButtonChild* parent, gd::string textureName, float wi
return sprite;
}

MCButtonChild* MCButtonChild::create(gd::string text, float width, CCObject* target, SEL_MenuHandler selector){
MCButtonChild* MCButtonChild::create(std::string text, float width, CCObject* target, SEL_MenuHandler selector){

MCButtonChild *ret = new (std::nothrow) MCButtonChild();
MCButtonChild *ret = new MCButtonChild();
ret->width = width;

CCSprite* buttonSprite = generateSprite(ret, "button.png"_spr, width);
Expand Down Expand Up @@ -131,8 +131,8 @@ void MCButtonChild::onHoverExit(){
}
}

/*void MCButtonChild::unselected(){
//onHoverExit();
void MCButtonChild::unselected(){
onHoverExit();
}

void MCButtonChild::doClick(){
Expand Down Expand Up @@ -169,7 +169,7 @@ void MCButtonChild::doClick(){

void MCButtonChild::selected(){

//onHover();
onHover();

#ifndef GEODE_IS_ANDROID
doClick();
Expand All @@ -180,7 +180,7 @@ void MCButtonChild::activate(){
#ifdef GEODE_IS_ANDROID
doClick();
#endif
}*/
}

void MCButtonChild::update(float dt) {

Expand Down Expand Up @@ -208,6 +208,4 @@ void MCButtonChild::update(float dt) {
isHovering = false;
}
}

}

10 changes: 5 additions & 5 deletions src/ui/nodes/MCButtonChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@

using namespace geode::prelude;

class MCButtonChild : public CCMenuItemSpriteExtra
class MCButtonChild : public CCMenuItemSprite
{
public:
CCSprite* edgeTexture;
static MCButtonChild* create(gd::string text, float width, CCObject* target, SEL_MenuHandler selector);
static MCButtonChild* create(std::string text, float width, CCObject* target, SEL_MenuHandler selector);
void update(float dt);
void onHover();
void onHoverExit();
//void selected();
//void unselected();
//void activate();
void selected();
void unselected();
void activate();
void doClick();
void setInvisible();
void setVisibleFade();
Expand Down
6 changes: 3 additions & 3 deletions src/utils/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Utils {
}


static CCSprite* createSprite(gd::string path){
static CCSprite* createSprite(std::string path){

float scale = CCDirector::sharedDirector()->getContentScaleFactor()/4;

Expand All @@ -115,7 +115,7 @@ class Utils {
return spr;
}

static CCSprite* createPanoSprite(gd::string path){
static CCSprite* createPanoSprite(std::string path){

float scale = CCDirector::sharedDirector()->getContentScaleFactor()/4;

Expand All @@ -127,7 +127,7 @@ class Utils {
return spr;
}

static CCSprite* createPixelSprite(gd::string path){
static CCSprite* createPixelSprite(std::string path){

float scale = CCDirector::sharedDirector()->getContentScaleFactor()/4;

Expand Down

0 comments on commit dcf35c7

Please sign in to comment.