Skip to content

NodeEvent, MenuItemActivatedEvent#1964

Open
Alphalaneous wants to merge 7 commits intogeode-sdk:mainfrom
Alphalaneous:node-events
Open

NodeEvent, MenuItemActivatedEvent#1964
Alphalaneous wants to merge 7 commits intogeode-sdk:mainfrom
Alphalaneous:node-events

Conversation

@Alphalaneous
Copy link
Copy Markdown
Contributor

@Alphalaneous Alphalaneous commented Mar 29, 2026

Uses the Cocos Script Engine system to add new events for CCNodes and CCMenuItems. Since Geometry Dash never sets these up itself, we can make our own and use them for useful events. None of these require hooks.

NodeEvent

  • Can be filtered by OnEnter, OnExit, OnEnterTransitionDidFinish, OnExitTransitionDidStart, and OnCleanup, which match their corresponding methods.
  • Has helper methods in CCNode.h to add callbacks easily
  • Is global in case a developer wants to listen to every time these are called (Me, I am that developer)

MenuItemActivatedEvent

  • Will run when a CCMenuItem is pressed (after the callback)
  • Has a helper method in CCMenuItem.h so you can add callbacks easily to menu items.

If this PR is merged and a Geode Update is prepared, it will need to be synchronized with an Alpha's Geode Utils update, or else things will break.

Copy link
Copy Markdown
Member

@dankmeme01 dankmeme01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is hacky and i love it!

most of the PR looks fine to me, but there is one concern i have with ObjectDestroyedEvent. does this end up running on every CCObject ever created (and destroyed)? because there are multiple potential issues with this:

  1. thread safety - it is common for things like CCImage, CCTexture2D, etc. to be created in a thread. if this event fires for those, that would likely cause UB in the current implementation, as you are not using ThreadSafeGlobalEvent
  2. performance hit - going through the event machinery on every destroyed CCObject sounds like it can have real performance implications, and this will especially be worse if thread-safe events are used. would need to benchmark it by creating & deleting a huge amount of objects and comparing the time taken with & without the event being sent

Maybe can be revisited in the future
@Alphalaneous Alphalaneous changed the title NodeEvent, MenuItemActivatedEvent, ObjectDestroyedEvent NodeEvent, MenuItemActivatedEvent Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants