mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
add missing stuff like members + CCContentManager
This commit is contained in:
parent
9b2303ef6b
commit
8347f458e6
4 changed files with 73 additions and 7 deletions
|
@ -307,6 +307,8 @@ THE SOFTWARE.
|
|||
#include "robtop/mouse_dispatcher/CCMouseDelegate.h"
|
||||
#include "robtop/mouse_dispatcher/CCMouseDispatcher.h"
|
||||
|
||||
#include "robtop/content/CCContentManager.h"
|
||||
|
||||
#include "robtop/scene_nodes/CCSceneTransitionDelegate.h"
|
||||
|
||||
#include "robtop/xml/DS_Dictionary.h"
|
||||
|
|
24
include/cocos/cocos2dx/robtop/content/CCContentManager.h
Normal file
24
include/cocos/cocos2dx/robtop/content/CCContentManager.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef __CCCONTENT_MANAGER_H__
|
||||
#define __CCCONTENT_MANAGER_H__
|
||||
|
||||
#include "ccMacros.h"
|
||||
#include "cocoa/CCObject.h"
|
||||
#include "cocoa/CCDictionary.h"
|
||||
|
||||
RT_ADD(
|
||||
// not in cocos2d namespace
|
||||
class CC_DLL CCContentManager : public cocos2d::CCObject
|
||||
{
|
||||
public:
|
||||
static CCContentManager* sharedManager();
|
||||
CCContentManager();
|
||||
bool init();
|
||||
|
||||
cocos2d::CCDictionary* addDict(const char* dict, bool unk);
|
||||
cocos2d::CCDictionary* addDictDS(const char* dict);
|
||||
|
||||
void clearCache();
|
||||
};
|
||||
);
|
||||
|
||||
#endif
|
|
@ -23,27 +23,57 @@ namespace geode::utils {
|
|||
|
||||
public:
|
||||
Timer() {
|
||||
this->m_start = Clock::now();
|
||||
m_start = Clock::now();
|
||||
}
|
||||
|
||||
void reset() {
|
||||
m_start = Clock::now();
|
||||
}
|
||||
|
||||
clock_point time() const { return m_start; }
|
||||
|
||||
template<typename Duration = std::chrono::milliseconds>
|
||||
int64_t time() const {
|
||||
int64_t elapsed() const {
|
||||
static_assert(is_chrono_duration<Duration>::value, "Duration must be a std::chrono::duration");
|
||||
auto end = Clock::now();
|
||||
return std::chrono::duration_cast<Duration>(end - m_start).count();
|
||||
}
|
||||
|
||||
template<typename Duration = std::chrono::milliseconds>
|
||||
std::string timeToString() const {
|
||||
std::string elapsedAsString() const {
|
||||
static_assert(is_chrono_duration<Duration>::value, "Duration must be a std::chrono::duration");
|
||||
if constexpr (std::is_same<Duration, std::chrono::milliseconds>::value) {
|
||||
return std::to_string(this->time<Duration>()) + "ms";
|
||||
return std::to_string(this->elapsed<Duration>()) + "ms";
|
||||
}
|
||||
if constexpr (std::is_same<Duration, std::chrono::microseconds>::value) {
|
||||
return std::to_string(this->time<Duration>()) + u8"\u00b5s";
|
||||
else if constexpr (std::is_same<Duration, std::chrono::microseconds>::value) {
|
||||
return std::to_string(this->elapsed<Duration>()) + "us";
|
||||
}
|
||||
else if constexpr (std::is_same<Duration, std::chrono::nanoseconds>::value) {
|
||||
return std::to_string(this->elapsed<Duration>()) + "ns";
|
||||
}
|
||||
else {
|
||||
static_assert(!std::is_same_v<bool, bool>, "Unsupported duration type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<
|
||||
typename Duration = std::chrono::milliseconds,
|
||||
class Clock = std::chrono::high_resolution_clock
|
||||
>
|
||||
struct LogPerformance {
|
||||
std::ostream& m_output;
|
||||
std::string m_msg;
|
||||
Timer<Clock> m_timer;
|
||||
|
||||
LogPerformance(
|
||||
std::string const& msg = "",
|
||||
std::ostream& out = std::cout
|
||||
) : m_msg(msg), m_output(out) {
|
||||
m_timer = Timer<Clock>();
|
||||
};
|
||||
~LogPerformance() {
|
||||
m_output << "Running \"" << m_msg << "\" took " << m_timer.elapsedAsString<Duration>() << std::endl;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -186,6 +186,11 @@ class CCAnimatedSprite : cocos2d::CCSprite {
|
|||
PAD = mac 0x0, win 0x4, android 0x0;
|
||||
}
|
||||
|
||||
class CCAnimateFrameCache : cocos2d::CCObject {
|
||||
static CCAnimateFrameCache* sharedSpriteFrameCache() = mac 0x0, win 0x158f0, ios 0x0;
|
||||
void addSpriteFramesWithFile(const char* file) = mac 0x0, win 0x159b0, ios 0x0;
|
||||
}
|
||||
|
||||
class CCBlockLayer : cocos2d::CCLayerColor {
|
||||
void disableUI() = mac 0x2a5a80, win 0x0, ios 0x0;
|
||||
void draw() = mac 0x2a5c20, win 0x0, ios 0x0;
|
||||
|
@ -3382,7 +3387,7 @@ class LoadingLayer : cocos2d::CCLayer {
|
|||
TextArea* m_textArea;
|
||||
cocos2d::CCSprite* m_sliderBar;
|
||||
float m_sliderGrooveXPos;
|
||||
float m_unknown3;
|
||||
float m_sliderGrooveHeight;
|
||||
bool m_fromRefresh;
|
||||
}
|
||||
|
||||
|
@ -3481,6 +3486,11 @@ class OBB2D : cocos2d::CCNode {
|
|||
cocos2d::CCPoint m_center;
|
||||
}
|
||||
|
||||
class ObjectManager : cocos2d::CCNode {
|
||||
static ObjectManager* instance() = mac 0x0, win 0x2c2c0, ios 0x0;
|
||||
void setup() = mac 0x0, win 0x2c3b0, ios 0x0;
|
||||
}
|
||||
|
||||
class ObjectToolbox : cocos2d::CCNode {
|
||||
cocos2d::CCArray* allKeys() {
|
||||
return m_frameToKeyDict->allKeys();
|
||||
|
|
Loading…
Reference in a new issue