From faa0c77304f1817f45f62a91cfd8dd6eae6b864a Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 5 Jun 2023 15:45:12 +0300 Subject: [PATCH] add some cocos stuff --- bindings/Cocos2d.bro | 18 ++++++++++++++++-- .../cocos/draw_nodes/CCDrawingPrimitives.h | 6 ++++++ .../Geode/cocos/misc_nodes/CCMotionStreak.h | 18 ++++++++++++++++-- .../particle_nodes/CCParticleSystemQuad.h | 3 ++- .../Geode/cocos/platform/win32/CCEGLView.h | 5 +++-- .../Geode/cocos/textures/CCTextureAtlas.h | 1 + 6 files changed, 44 insertions(+), 7 deletions(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index fb733dd1..bdc174ed 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -157,9 +157,9 @@ class cocos2d::CCDrawNode { auto drawDot(cocos2d::CCPoint const&, float, cocos2d::_ccColor4F const&) = mac 0x379100; auto getBlendFunc() const = mac 0x379ea0; - auto init() = mac 0x378e00; + virtual auto init() = mac 0x378e00; auto setBlendFunc(cocos2d::_ccBlendFunc const&) = mac 0x379eb0; - auto draw() = mac 0x379020; + virtual auto draw() = mac 0x379020; virtual ~CCDrawNode() = mac 0x378cc0; } @@ -218,6 +218,7 @@ class cocos2d::CCEGLView { virtual void swapBuffers() = mac 0x295510; void updateWindow(int width, int height); void setupWindow(cocos2d::CCRect); + bool initGlew(); void toggleFullScreen(bool fullscreen); void pollEvents(); void onGLFWCharCallback(GLFWwindow* window, unsigned int entered); @@ -511,6 +512,7 @@ class cocos2d::CCMotionStreak { auto resumeStroke() = mac 0x2edb30; auto stopStroke() = mac 0x2edb20; bool initWithFade(float fade, float minSeg, float stroke, cocos2d::ccColor3B const& color, cocos2d::CCTexture2D* texture) = mac 0x2ed6f0; + virtual auto draw(); } class cocos2d::CCMouseDispatcher { @@ -688,6 +690,7 @@ class cocos2d::CCParticleSystem { CCParticleSystem(); virtual ~CCParticleSystem(); virtual auto update(float); + virtual auto draw(); auto initParticle(cocos2d::tCCParticle*); auto resetSystem() = mac 0x46bd50; auto resumeSystem() = mac 0x46bd40; @@ -695,7 +698,11 @@ class cocos2d::CCParticleSystem { } class cocos2d::CCParticleSystemQuad { + CCParticleSystemQuad(); + virtual ~CCParticleSystemQuad(); static cocos2d::CCParticleSystemQuad* create(char const*) = mac 0x36b000; + virtual auto draw(); + auto setupVBO(); } class cocos2d::CCPoolManager { @@ -940,6 +947,13 @@ class cocos2d::CCTexture2D { auto setTexParameters(cocos2d::_ccTexParams*) = mac 0x247980; } +class cocos2d::CCTextureAtlas { + CCTextureAtlas(); + virtual ~CCTextureAtlas(); + auto drawNumberOfQuads(unsigned int, unsigned int); + auto mapBuffers(); +} + class cocos2d::CCTextFieldTTF { static auto textFieldWithPlaceHolder(char const*, char const*, float) = mac 0x126220; } diff --git a/loader/include/Geode/cocos/draw_nodes/CCDrawingPrimitives.h b/loader/include/Geode/cocos/draw_nodes/CCDrawingPrimitives.h index d957df5e..aef83193 100644 --- a/loader/include/Geode/cocos/draw_nodes/CCDrawingPrimitives.h +++ b/loader/include/Geode/cocos/draw_nodes/CCDrawingPrimitives.h @@ -92,6 +92,11 @@ void CC_DLL ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints ); /** draws a line given the origin and destination point measured in points */ void CC_DLL ccDrawLine( const CCPoint& origin, const CCPoint& destination ); +RT_ADD( + /** draws an array of lines. */ + void CC_DLL ccDrawLines( const CCPoint *lines, unsigned int numberOfLines ); +) + /** draws a rectangle given the origin and destination point measured in points. */ void CC_DLL ccDrawRect( CCPoint origin, CCPoint destination ); @@ -112,6 +117,7 @@ void CC_DLL ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoints, c /** draws a circle given the center, radius and number of segments. */ void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY); void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter); +RT_ADD(void CC_DLL ccDrawFilledCircle( const CCPoint& center, float radius, float angle, unsigned int segments);) /** draws a quad bezier path @warning This function could be pretty slow. Use it only for debugging purposes. diff --git a/loader/include/Geode/cocos/misc_nodes/CCMotionStreak.h b/loader/include/Geode/cocos/misc_nodes/CCMotionStreak.h index 21429a8b..81dde2b1 100644 --- a/loader/include/Geode/cocos/misc_nodes/CCMotionStreak.h +++ b/loader/include/Geode/cocos/misc_nodes/CCMotionStreak.h @@ -51,12 +51,13 @@ class CC_DLL CCMotionStreak : public CCGLBufferedNode #endif // EMSCRIPTEN { - + GEODE_FRIEND_MODIFY public: /** * @js ctor */ CCMotionStreak(); + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCMotionStreak, CCNodeRGBA) /** * @js NA * @lua NA @@ -112,7 +113,10 @@ public: virtual void setOpacityModifyRGB(bool bValue); virtual bool isOpacityModifyRGB(void); - RT_ADD(void resumeStroke(); void stopStroke();); + RT_ADD( + void resumeStroke(); + void stopStroke(); + ) /** When fast mode is enabled, new points are added faster but with lower precision */ inline bool isFastMode() { @@ -134,6 +138,7 @@ public: protected: bool m_bFastMode; bool m_bStartingPositionInitialized; + bool m_bStroke; /** texture used for the motion streak */ CCTexture2D* m_pTexture; ccBlendFunc m_tBlendFunc; @@ -155,6 +160,15 @@ protected: ccVertex2F* m_pVertices; GLubyte* m_pColorPointer; ccTex2F* m_pTexCoords; + + RT_ADD( + bool m_bRepeatMode; + float m_fRepeatSpeed; + float m_fRepeatTime; + bool m_idk; + float m_fMaxSeg; + bool m_bDontOpacityFade; + ) }; // end of misc_nodes group diff --git a/loader/include/Geode/cocos/particle_nodes/CCParticleSystemQuad.h b/loader/include/Geode/cocos/particle_nodes/CCParticleSystemQuad.h index 4d2e6cf5..51bbabb7 100644 --- a/loader/include/Geode/cocos/particle_nodes/CCParticleSystemQuad.h +++ b/loader/include/Geode/cocos/particle_nodes/CCParticleSystemQuad.h @@ -55,7 +55,7 @@ class CC_DLL CCParticleSystemQuad : public CCParticleSystem GEODE_FRIEND_MODIFY protected: - + PAD(0x20); ccV3F_C4B_T2F_Quad *m_pQuads; // quads to be rendered GLushort *m_pIndices; // indices @@ -70,6 +70,7 @@ public: * @js ctor */ CCParticleSystemQuad(); + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCParticleSystemQuad, CCParticleSystem) /** * @js NA * @lua NA diff --git a/loader/include/Geode/cocos/platform/win32/CCEGLView.h b/loader/include/Geode/cocos/platform/win32/CCEGLView.h index 6b27a802..5c12e0a7 100644 --- a/loader/include/Geode/cocos/platform/win32/CCEGLView.h +++ b/loader/include/Geode/cocos/platform/win32/CCEGLView.h @@ -64,10 +64,11 @@ public: protected: RT_REMOVE( virtual bool Create(); ) void setupWindow(cocos2d::CCRect rect); + RT_ADD(bool initGlew();) public: - bool initGL(); - void destroyGL(); + RT_REMOVE(bool initGL();) + RT_REMOVE(void destroyGL();) RT_REMOVE( virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); ) diff --git a/loader/include/Geode/cocos/textures/CCTextureAtlas.h b/loader/include/Geode/cocos/textures/CCTextureAtlas.h index f215b061..1aa3fddd 100644 --- a/loader/include/Geode/cocos/textures/CCTextureAtlas.h +++ b/loader/include/Geode/cocos/textures/CCTextureAtlas.h @@ -81,6 +81,7 @@ public: * @js ctor */ CCTextureAtlas(); + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCTextureAtlas, CCObject) /** * @js NA * @lua NA