generated from ParadoxV5/template-ruby-gem
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iterate now fix later, agile software companies be like
except fixing takes forever ☠️ also … there is no `Kernel#tap` 🤑
- Loading branch information
Showing
6 changed files
with
53 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
#include "variants.h" | ||
|
||
void godot_rb_init_Engine(void) { | ||
GDExtensionStringName engine_string_name = godot_rb_chars_to_string_name("Engine"); | ||
GDExtensionObjectPtr engine_object = ( | ||
(GDExtensionInterfaceGlobalGetSingleton)godot_rb_get_proc("global_get_singleton") | ||
)(&engine_string_name); | ||
godot_rb_gdextension.string_name_destroy(&engine_string_name); | ||
GDExtensionVariantPtr engine_variant = godot_rb_variant_alloc(); | ||
godot_rb_gdextension.object_from_variant(&engine_object, engine_variant); | ||
GDExtensionInterfaceGlobalGetSingleton gdext_global_get_singleton; | ||
/** code around the general method call API so the singleton subclasses from Object rather than the singleton class */ | ||
VALUE godot_rb_Engine_impl_get_singleton(GDExtensionStringName name) { | ||
GDExtensionObjectPtr object_ptr = gdext_global_get_singleton(&name); | ||
godot_rb_gdextension.string_name_destroy(&name); | ||
GDExtensionVariantPtr variant = godot_rb_variant_alloc(); | ||
godot_rb_gdextension.variant_from_object_ptr(variant, &object_ptr); | ||
// Probably should not free an actually-returned pointer | ||
VALUE m_Engine = godot_rb_wrap_variant(godot_rb_cObject, engine_variant); | ||
rb_const_set(godot_rb_mGodot, rb_intern("Engine"), m_Engine); | ||
return godot_rb_wrap_variant(godot_rb_cObject, variant); | ||
} | ||
VALUE godot_rb_Engine_get_singleton(__attribute__((unused)) VALUE self, VALUE name) { | ||
return godot_rb_Engine_impl_get_singleton(godot_rb_obj_to_string_name(name)); | ||
} | ||
|
||
void godot_rb_init_Engine(void) { | ||
gdext_global_get_singleton = (GDExtensionInterfaceGlobalGetSingleton)godot_rb_get_proc("global_get_singleton"); | ||
VALUE Engine = godot_rb_Engine_impl_get_singleton(godot_rb_chars_to_string_name("Engine")); | ||
rb_const_set(godot_rb_mGodot, rb_intern("Engine"), Engine); | ||
rb_define_singleton_method(Engine, "get_singleton", godot_rb_Engine_get_singleton, 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters