Skip to content

Commit

Permalink
v2.0a
Browse files Browse the repository at this point in the history
refactor to be inline with GManager class, rob's savefile managing system. makes the source more readable for rob, hopefully. also cleaned up visuals a lot and added an options / credits menu.
  • Loading branch information
poweredbypie committed Mar 4, 2021
1 parent fde7117 commit e241cdd
Show file tree
Hide file tree
Showing 215 changed files with 27,037 additions and 688 deletions.
6 changes: 2 additions & 4 deletions include/cocos2dx/base_nodes/CCNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,6 @@ class CC_DLL CCNode : public CCObject
* @return The anchor point in absolute pixels.
*/
virtual const CCPoint& getAnchorPointInPoints();

RT_ADD( virtual CCSize getScaledContentSize(void); )


/**
* Sets the untransformed size of the node.
Expand All @@ -440,7 +437,8 @@ class CC_DLL CCNode : public CCObject
*/
virtual const CCSize& getContentSize() const;


RT_ADD(virtual CCSize getScaledContentSize(void); )

/**
* Sets whether the node is visible
*
Expand Down
4 changes: 4 additions & 0 deletions include/cocos2dx/include/cocos2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,14 @@ THE SOFTWARE.
//robtop
#include "robtop/keyboard_dispatcher/CCKeyboardDelegate.h"
#include "robtop/keyboard_dispatcher/CCKeyboardDispatcher.h"

#include "robtop/mouse_dispatcher/CCMouseDelegate.h"
#include "robtop/mouse_dispatcher/CCMouseDispatcher.h"

#include "robtop/scene_nodes/CCSceneTransitionDelegate.h"

#include "robtop/xml/DS_Dictionary.h"

NS_CC_BEGIN

CC_DLL const char* cocos2dVersion();
Expand Down
9 changes: 9 additions & 0 deletions include/cocos2dx/platform/CCApplicationProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ class CC_DLL CCApplicationProtocol
*/
virtual void applicationWillEnterForeground() = 0;

RT_ADD(
virtual void applicationWillBecomeActive();
virtual void applicationWillResignActive();
virtual void trySaveGame();
virtual void gameDidSave();
)

/**
@brief Callback by CCDirector for limit FPS.
@interval The time, expressed in seconds, between current frame and next.
Expand All @@ -91,6 +98,8 @@ class CC_DLL CCApplicationProtocol
@brief Get target platform
*/
virtual TargetPlatform getTargetPlatform() = 0;

RT_ADD( virtual void openURL(const char* url) );
};

// end of platform group
Expand Down
2 changes: 1 addition & 1 deletion include/cocos2dx/platform/CCPlatformMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ private: \
*/
#if defined(__GNUC__) && (__GNUC__ >= 4)
#define CC_FORMAT_PRINTF(formatPos, argPos) __attribute__((__format__(printf, formatPos, argPos)))
/** @mod CC_FORMAT_PRINTF
/** CC_FORMAT_PRINTF
* Visual Studio 2019 has __has_attribute,
* but __has_attribute(format) is undefined,
* leaving CC_FORMAT_PRINTF undefined by default.
Expand Down
10 changes: 9 additions & 1 deletion include/cocos2dx/platform/win32/CCApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class CC_DLL CCApplication : public CCApplicationProtocol
/**
@brief Run the message loop.
*/
virtual int run();
RT_REMOVE( virtual int run(); )
RT_ADD( virtual void gameDidSave(); )

/**
@brief Get current applicaiton instance.
Expand All @@ -36,6 +37,13 @@ class CC_DLL CCApplication : public CCApplicationProtocol
*/
virtual TargetPlatform getTargetPlatform();

RT_ADD(
virtual void openURL(const char* url);
virtual int run();
virtual void setupGLView();
virtual void platformShutdown();
)

/**
* Sets the Resource root path.
* @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPaths() instead.
Expand Down
10 changes: 5 additions & 5 deletions include/cocos2dx/platform/win32/CCPlatformDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
#define CC_DLL __declspec(dllimport)
#endif*/

/** @mod CC_DLL
* Since we want to use the functions exported by
* libcocos2d.dll used by GeometryDash.exe, we have to
* change the classes to import DLL functions, not export them.
/** CC_DLL
* Since we are linking a lib containing the functions
* provided by libcocos2d.dll used by GeometryDash.exe,
* we do not need to define this macro to do anything.
*/
#define CC_DLL
#define CC_DLL

#include <assert.h>

Expand Down
6 changes: 0 additions & 6 deletions include/cocos2dx/robtop/mouse_dispatcher/CCMouseDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
RT_ADD(
NS_CC_BEGIN

/*no clue if this is accurate.
* https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.13/cocos/base/CCEventMouse.h#L48
* https://github.com/reneklacan/cocos2d-x/wiki/Mouse-keycodes-enum
* not sure which one is which
*/

class CC_DLL CCMouseDelegate
{
public:
Expand Down
94 changes: 94 additions & 0 deletions include/cocos2dx/robtop/xml/DS_Dictionary.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#ifndef __DS_DICTIONARY_H__
#define __DS_DICTIONARY_H__

#include "pugixml.hpp"
#include <vector>
#include <cocos2d.h>

class CC_DLL DS_Dictionary {
private:
pugi::xml_document doc;
std::vector<pugi::xml_node> dictTree;
bool m_bCompatible;

private:
std::string cleanStringWhiteSpace(const std::string&);
void split(const std::string&, char*, const std::vector<std::string>&);
bool splitWithForm(const std::string&, std::vector<std::string>&);
bool rectFromString(const std::string&, cocos2d::CCRect&);
bool vec2FromString(const std::string&, cocos2d::CCPoint&);

public:
DS_Dictionary();
~DS_Dictionary();

static void copyFile(const char*, const char*);

cocos2d::CCObject* decodeObjectForKey(const char*, bool, int);

bool loadRootSubDictFromFile(const char*);
bool loadRootSubDictFromCompressedFile(const char*);
bool loadRootSubDictFromString(std::string);

bool saveRootSubDictToFile(const char*);
bool saveRootSubDictToCompressedFile(const char*);
std::string saveRootSubDictToString();

bool stepIntoSubDictWithKey(const char*);
void stepOutOfSubDict();
void stepBackToRootSubDict();

unsigned int getNumKeys();
std::string getKey(unsigned int);
std::vector<std::string> getAllKeys();
unsigned int getIndexOfKey(const char*);
unsigned int getIndexOfKeyWithClosestAlphaNumericalMatch(const char*);
void removeKey(unsigned int);
void removeKey(const char*);
void removeAllKeys();

int getIntegerForKey(const char*);
bool getBoolForKey(const char*);
float getFloatForKey(const char*);
std::string getStringForKey(const char*);
cocos2d::CCPoint getVec2ForKey(const char*);
cocos2d::CCRect getRectForKey(const char*);
std::vector<std::string> getStringArrayForKey(const char*);
std::vector<cocos2d::CCPoint> getVec2ArrayForKey(const char*);
std::vector<cocos2d::CCRect> getRectArrayForKey(const char*);
cocos2d::CCArray* getArrayForKey(const char*, bool);
cocos2d::CCDictionary* getDictForKey(const char*, bool);
cocos2d::CCObject* getObjectForKey(const char*);

void setIntegerForKey(const char*, int);
void setIntegerForKey(const char*, int, bool);
void setBoolForKey(const char*, bool);
void setBoolForKey(const char*, bool, bool);
void setFloatForKey(const char*, float);
void setFloatForKey(const char*, float, bool);
void setStringForKey(const char*, const std::string&);
void setStringForKey(const char*, const std::string&, bool);
void setVec2ForKey(const char*, const cocos2d::CCPoint&);
void setVec2ForKey(const char*, const cocos2d::CCPoint&, bool);
void setRectForKey(const char*, const cocos2d::CCRect&);
void setRectForKey(const char*, const cocos2d::CCRect&, bool);
void setStringArrayForKey(const char*, const std::vector<std::string>&);
void setStringArrayForKey(const char*, const std::vector<std::string>&, bool);
void setVec2ArrayForKey(const char*, const std::vector<cocos2d::CCPoint>&);
void setVec2ArrayForKey(const char*, const std::vector<cocos2d::CCPoint>&, bool);
void setRectArrayForKey(const char*, const std::vector<cocos2d::CCRect>&);
void setRectArrayForKey(const char*, const std::vector<cocos2d::CCRect>&, bool);
void setArrayForKey(const char*, cocos2d::CCArray*);
void setBoolMapForKey(const char*, const std::map<std::string, bool>&);
void setSubDictForKey(const char*);
void setSubDictForKey(const char*, bool, bool);
void setDictForKey(const char*, cocos2d::CCDictionary*);
void setObjectForKey(const char*, cocos2d::CCObject*);

void addBoolValuesToMapForKey(const std::map<std::string, bool>&, const char*, bool);
void addBoolValuesToMapForKeySpecial(const std::map<std::string, bool>&, const char*, bool);

void checkCompatibility();
};

#endif
69 changes: 69 additions & 0 deletions include/cocos2dx/robtop/xml/pugiconfig.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* pugixml parser - version 1.2
* --------------------------------------------------------
* Copyright (C) 2006-2012, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at http://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
* of this file.
*
* This work is based on the pugxml parser, which is:
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
*/

#ifndef HEADER_PUGICONFIG_HPP
#define HEADER_PUGICONFIG_HPP

// Uncomment this to enable wchar_t mode
// #define PUGIXML_WCHAR_MODE

// Uncomment this to disable XPath
// #define PUGIXML_NO_XPATH

// Uncomment this to disable STL
// #define PUGIXML_NO_STL

// Uncomment this to disable exceptions
// #define PUGIXML_NO_EXCEPTIONS

// Set this to control attributes for public classes/functions, i.e.:
// #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL
// #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL
// #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall
// In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead

// Uncomment this to switch to header-only version
// #define PUGIXML_HEADER_ONLY
// #include "pugixml.cpp"

// Tune these constants to adjust memory-related behavior
// #define PUGIXML_MEMORY_PAGE_SIZE 32768
// #define PUGIXML_MEMORY_OUTPUT_STACK 10240
// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096

#endif

/**
* Copyright (c) 2006-2012 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
Loading

0 comments on commit e241cdd

Please sign in to comment.