mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-15 03:25:01 -05:00
symbols, macros, utils
This commit is contained in:
parent
a484bd739a
commit
0e405496ef
6 changed files with 52 additions and 13 deletions
|
@ -356,6 +356,7 @@ class cocos2d::CCMenu {
|
|||
auto addChild(cocos2d::CCNode*, int, int) = mac 0x438bc0, ios 0x131ed0;
|
||||
auto addChild(cocos2d::CCNode*, int) = mac 0xbbb50, ios 0x131ecc;
|
||||
auto addChild(cocos2d::CCNode*) = mac 0xbbb40, ios 0x131ec8;
|
||||
auto itemForTouch(cocos2d::CCTouch*) = mac 0x438dd0;
|
||||
}
|
||||
|
||||
class cocos2d::CCMenuItem {
|
||||
|
|
|
@ -2991,6 +2991,7 @@ class GameObject : CCSpritePlus {
|
|||
bool m_objectPoweredOn;
|
||||
cocos2d::CCSize m_objectSize;
|
||||
bool m_modifier;
|
||||
bool unknown2e5;
|
||||
bool m_active;
|
||||
bool m_animationFinished;
|
||||
cocos2d::CCParticleSystemQuad* m_particleSystem;
|
||||
|
@ -3014,7 +3015,10 @@ class GameObject : CCSpritePlus {
|
|||
bool m_isSaw;
|
||||
int m_customRotateSpeed;
|
||||
bool m_sawIsDisabled;
|
||||
PAD = mac 0x4, win 0x4, android 0x0;
|
||||
bool m_unknownVisibility345;
|
||||
bool m_unknown346;
|
||||
bool m_unknownVisibility347;
|
||||
cocos2d::CCSprite* m_baseSprite;
|
||||
cocos2d::CCSprite* m_detailSprite;
|
||||
PAD = mac 0x8, win 0x8, android 0x0;
|
||||
bool m_isRotatedSide;
|
||||
|
@ -3043,7 +3047,7 @@ class GameObject : CCSpritePlus {
|
|||
int m_targetColorID;
|
||||
float m_scale;
|
||||
int m_objectID;
|
||||
PAD = mac 0x4, win 0x4, android 0x0;
|
||||
PAD = mac 0x8, win 0x4, android 0x0;
|
||||
bool m_unk368;
|
||||
bool m_unk369;
|
||||
bool m_unk36A;
|
||||
|
@ -3071,7 +3075,7 @@ class GameObject : CCSpritePlus {
|
|||
int m_slopeType;
|
||||
float m_slopeAngle;
|
||||
bool m_hazardousSlope;
|
||||
float m_unkWin18C;
|
||||
float m_realOpacity;
|
||||
GJSpriteColor* m_baseColor;
|
||||
GJSpriteColor* m_detailColor;
|
||||
int m_unknown420;
|
||||
|
@ -3844,8 +3848,8 @@ class OptionsLayer : GJDropDownLayer, FLAlertLayerProtocol {
|
|||
class PauseLayer : CCBlockLayer {
|
||||
static PauseLayer* create(bool) = mac 0x20b1e0, win 0x1e4570, ios 0x0;
|
||||
void onEdit(cocos2d::CCObject*) = mac 0x20c630, win 0x1e60e0, ios 0x0;
|
||||
void createToggleButton(cocos2d::SEL_MenuHandler callback, bool on, cocos2d::CCMenu* menu, gd::string caption, cocos2d::CCPoint pos) = mac 0x0, win 0x1e5570, ios 0x0;
|
||||
virtual void customSetup() = mac 0x0, win 0x1e4620, ios 0x0;
|
||||
void createToggleButton(gd::string caption, cocos2d::SEL_MenuHandler callback, bool on, cocos2d::CCMenu* menu, cocos2d::CCPoint pos) = mac 0x20c890, win 0x1e5570, ios 0x0;
|
||||
virtual void customSetup() = mac 0x20b300, win 0x1e4620, ios 0x0;
|
||||
void onRestart(cocos2d::CCObject* sender) = mac 0x0, win 0x1e6040, ios 0x0;
|
||||
void keyDown(cocos2d::enumKeyCodes) = mac 0x20cc80;
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ function(create_geode_file proname)
|
|||
endif()
|
||||
|
||||
add_custom_command(
|
||||
TARGET ${proname} POST_BUILD
|
||||
DEPENDS ${proname}
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/runEveryTime
|
||||
COMMAND ${GEODE_CLI} pkg ${CMAKE_CURRENT_SOURCE_DIR} $<TARGET_FILE_DIR:${proname}> $<TARGET_FILE_DIR:${proname}>/${proname}.geode ${INSTALL_FLAGS} --cached
|
||||
VERBATIM USES_TERMINAL
|
||||
)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include <type_traits>
|
||||
|
||||
/**
|
||||
* Main class implementation, it has the structure
|
||||
*
|
||||
|
@ -57,6 +59,13 @@ template <> struct GEODE_HIDDEN _##derived<derived##ID> \
|
|||
#define $modify(...) GEODE_INVOKE(GEODE_CONCAT(GEODE_CRTP, GEODE_NUMBER_OF_ARGS(__VA_ARGS__)), __VA_ARGS__)
|
||||
#define $(...) $modify(__VA_ARGS__)
|
||||
|
||||
|
||||
/**
|
||||
* Get current hook class without needing to name it.
|
||||
* Useful for callbacks
|
||||
*/
|
||||
#define $cls std::remove_pointer<decltype(this)>::type
|
||||
|
||||
#define GEODE_ONLY_FIELD(type, field_, default_) private: field<type> field_ = default_; public:
|
||||
#define GEODE_INTERNAL_FIELD(type, field, name) inline type& name() { return this->*field; }
|
||||
//#define GEODE_EXTERNAL_FIELD(type, field, name) static inline type& name##From(void* self) { return reinterpret_cast<decltype(this)>(self)->*field; }
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <iostream>
|
||||
|
||||
namespace geode::cast {
|
||||
/**
|
||||
|
@ -43,4 +46,17 @@ namespace geode::cast {
|
|||
static constexpr T base_cast(F obj) {
|
||||
return reinterpret_cast<T>(dynamic_cast<void*>(obj));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cast based on RTTI. This is a replacement for
|
||||
* dynamic_cast, since it doesn't work for gd.
|
||||
*/
|
||||
template <typename T, typename F>
|
||||
static T typeid_cast(F obj) {
|
||||
if (std::string(typeid(*obj).name()) == typeid(std::remove_pointer_t<T>).name())
|
||||
return reinterpret_cast<T>(obj);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode.hpp>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace geode::cocos {
|
||||
/**
|
||||
|
@ -69,13 +71,18 @@ namespace geode::cocos {
|
|||
*/
|
||||
GEODE_DLL bool nodeIsVisible(cocos2d::CCNode* node);
|
||||
|
||||
|
||||
/**
|
||||
* Gets a node by tag by traversing
|
||||
* children recursively
|
||||
*
|
||||
* @param node Parent node
|
||||
* @param tag Target tag
|
||||
* @return Child node with specified tag, or
|
||||
* null if there is none
|
||||
*/
|
||||
GEODE_DLL cocos2d::CCNode* getChildByTagRecursive(cocos2d::CCNode* node, int tag);
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a given file exists in CCFileUtils
|
||||
* search paths.
|
||||
|
@ -108,10 +115,11 @@ namespace geode::cocos {
|
|||
friend bool operator!= (const CCArrayIterator<T>& a, const CCArrayIterator<T>& b) { return a.m_ptr != b.m_ptr; };
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
template <typename _Type>
|
||||
class CCArrayExt {
|
||||
protected:
|
||||
cocos2d::CCArray* m_arr;
|
||||
using T = std::remove_pointer_t<_Type>;
|
||||
public:
|
||||
CCArrayExt() : m_arr(cocos2d::CCArray::create()) {
|
||||
m_arr->retain();
|
||||
|
@ -131,21 +139,21 @@ namespace geode::cocos {
|
|||
}
|
||||
|
||||
auto begin() {
|
||||
return CCArrayIterator<T*>(reinterpret_cast<T*>(m_arr->data->arr));
|
||||
return CCArrayIterator<T*>(reinterpret_cast<T**>(m_arr->data->arr));
|
||||
}
|
||||
auto end() {
|
||||
return CCArrayIterator<T*>(reinterpret_cast<T*>(m_arr->data->arr) + m_arr->count());
|
||||
return CCArrayIterator<T*>(reinterpret_cast<T**>(m_arr->data->arr) + m_arr->count());
|
||||
}
|
||||
auto size() const {
|
||||
return m_arr->count();
|
||||
}
|
||||
T operator[](size_t index) {
|
||||
return reinterpret_cast<T>(m_arr->objectAtIndex(index));
|
||||
return reinterpret_cast<T*>(m_arr->objectAtIndex(index));
|
||||
}
|
||||
void push_back(T item) {
|
||||
void push_back(T* item) {
|
||||
m_arr->addObject(item);
|
||||
}
|
||||
T pop_back() {
|
||||
T* pop_back() {
|
||||
T ret = m_arr->lastObject();
|
||||
m_arr->removeLastObject();
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue