Skip to content

[cpp] Root API#12510

Merged
Simn merged 1 commit intoHaxeFoundation:developmentfrom
Aidan63:cpp_root_api
Jan 17, 2026
Merged

[cpp] Root API#12510
Simn merged 1 commit intoHaxeFoundation:developmentfrom
Aidan63:cpp_root_api

Conversation

@Aidan63
Copy link
Contributor

@Aidan63 Aidan63 commented Jan 16, 2026

Expose the existing hxcpp rooting api in a haxe friendly way, eliminating the need to use untyped or cpp glue code to root and pass haxe objects into void pointers.

Using this the SDL coro example doesn't need the untyped, e.g. SdlDispatcher.dispatch

public function dispatch(obj:IScheduleObject) {
	final event = new Event();
	event.type = id;
	event.user.data1 = RootHandle.create(obj).toVoidPointer();

	SDL.pushEvent(event);
}

Event dispatching in the loop.

final root = RootHandle.fromVoidPointer(event.user.data1);

final obj : IScheduleObject = root.getObject();

root.close();

obj.onSchedule();

HaxeFoundation/hxcpp#1292

@Simn Simn merged commit 26d0b67 into HaxeFoundation:development Jan 17, 2026
50 checks passed
@Simn
Copy link
Member

Simn commented Jan 17, 2026

Nice, that example looks really good now!

@Aidan63 Aidan63 deleted the cpp_root_api branch January 17, 2026 09:57
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