docs stuff i think

This commit is contained in:
HJfod 2023-01-21 14:17:33 +02:00
parent 4813dbb5ee
commit f8737dde43
5 changed files with 62 additions and 21 deletions

View file

@ -10,27 +10,24 @@ tree = "https://github.com/geode-sdk/geode/tree/main"
[[sources]]
name = "Geode"
dir = "loader/include/Geode"
# todo: Make flash infer this from cmake
strip-include-prefix = "loader/include"
dir = "loader/include"
include = [
"**/*.hpp",
"**/*.h",
"Geode/**/*.hpp",
"Geode/**/*.h",
]
exclude = [
"modify/Comparer.hpp",
"platform/*.hpp",
"c++stl/*.hpp",
"Geode/modify/Comparer.hpp",
"Geode/platform/*.hpp",
"Geode/c++stl/*.hpp",
# All of the relevant cocos headers are included through Geode headers
"cocos/**/*.h"
"Geode/cocos/**/*.h"
]
[[sources]]
name = "Bindings"
dir = "build-docs/codegenned/Geode/binding"
strip-include-prefix = "build-docs/codegenned"
dir = "build-docs/codegenned"
include = [
"*.hpp"
"Geode/binding/*.hpp"
]
# Bindings are generated at compile time
exists-online = false
@ -51,6 +48,7 @@ config-args = [
"-DCMAKE_CXX_FLAGS=-m32",
"-DWIN32=On"
]
# We want to build codegen in order to get the bindings
build = true
build-dir = "build-docs"

View file

@ -1375,7 +1375,7 @@ public:
*
* @note The additional transform will be concatenated at the end of nodeToParentTransform.
* It could be used to simulate `parent-child` relationship between two nodes (e.g. one is in BatchNode, another isn't).
* @code
* @example
// create a batchNode
CCSpriteBatchNode* batch= CCSpriteBatchNode::create("Icon-114.png");
this->addChild(batch);
@ -1416,7 +1416,6 @@ public:
// Sets the additional transform to spriteB, spriteB's rotation will based on its pseudo parent i.e. spriteA.
spriteB->setAdditionalTransform(t);
* @endcode
*/
void setAdditionalTransform(const CCAffineTransform& additionalTransform);

View file

@ -36,8 +36,8 @@ namespace geode {
class ModImpl;
/**
* @class Mod
* Represents a Mod ingame.
* @class Mod
*/
class GEODE_DLL Mod {
protected:
@ -361,6 +361,3 @@ namespace geode {
inline char const* operator"" _spr(char const* str, size_t) {
return geode::Mod::get()->expandSpriteName(str);
}
// this header uses Mod
#include "ModEvent.hpp"

View file

@ -1,11 +1,13 @@
#pragma once
#include "Event.hpp"
#include "Mod.hpp"
#include <optional>
namespace geode {
class Mod;
inline Mod* getMod();
enum class ModEventType {
Loaded,
Unloaded,
@ -49,7 +51,7 @@ namespace { \
} \
static inline auto GEODE_CONCAT(Exec, __LINE__) = (new geode::EventListener( \
&GEODE_CONCAT(geodeExecFunction, __LINE__)<GEODE_CONCAT(ExecFuncUnique, __LINE__)>,\
geode::ModStateFilter(geode::Mod::get(), geode::ModEventType::type)\
geode::ModStateFilter(geode::getMod(), geode::ModEventType::type)\
), 0); \
template<class> \
void GEODE_CONCAT(geodeExecFunction, __LINE__)(ModStateEvent*)

View file

@ -193,13 +193,57 @@ namespace geode {
*
* Use-cases include, for example, non-CCNode class members, or nodes that
* are not always in the scene tree.
*
* @tparam T A type that inherits from CCObject.
*
* @example class MyNode : public CCNode {
* @example[flash]
* #include <Geode/utils/cocos.hpp>
*
* USE_GEODE_NAMESPACE();
*
* //!flash-snippet-start
* class MyNode : public CCNode {
* protected:
* // no need to manually call retain or
* // release on this array; Ref manages it
* // for you :3
* Ref<CCArray> m_list = CCArray::create();
*
* bool init() {
* if (!CCNode::init())
* return false;
*
* // No need to do m_list = CCArray::create()
* // or m_list->retain() :3
*
* return true;
* }
* };
* //!flash-snippet-end
*
* @example[flash]
* #include <Geode/utils/cocos.hpp>
* #include <Geode/modify/MenuLayer.hpp>
*
* USE_GEODE_NAMESPACE();
*
* class ModifyMenuLayer : public MenuLayer {
* bool init() {
* if (!MenuLayer::init())
* return false;
*
* //!flash-snippet-start
* // Save a child from the current layer into a menu
* Ref<CCMenu> menu = static_cast<CCMenu*>(this->getChildByID("main-menu"));
*
* // Remove the menu from its parent
* menu->removeFromParent();
*
* // Menu will still point to a valid CCMenu as long as the menu variable exist
* //!flash-snippet-end
*
* return true;
* }
* };
*/
template <class T>
@ -215,6 +259,7 @@ namespace geode {
/**
* Construct a Ref of an object. The object will be retained and
* managed until Ref goes out of scope
* @param obj Object to construct the Ref from
*/
Ref(T* obj) : m_obj(obj) {
CC_SAFE_RETAIN(obj);