-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
225 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python | ||
|
||
IMGUI_PATH = "../../../gdext/imgui" | ||
IMGUI_GODOT_INCLUDE = "../../../addons/imgui-godot/include" | ||
|
||
env = SConscript("../../../gdext/godot-cpp/SConstruct") | ||
env = env.Clone() | ||
|
||
env.Append(CPPPATH=["src/"]) | ||
sources = Glob("src/*.cpp") | ||
|
||
# Dear ImGui | ||
sources += Glob(f"{IMGUI_PATH}/*.cpp") | ||
env.Append(CPPDEFINES=['IMGUI_USER_CONFIG="\\"imconfig-godot.h\\""']) | ||
env.Append(CPPPATH=[IMGUI_PATH, IMGUI_GODOT_INCLUDE]) | ||
|
||
if env["platform"] == "macos": | ||
library = env.SharedLibrary( | ||
"project/bin/libgdexample.{}.{}.framework/libgdexample.{}.{}".format( | ||
env["platform"], env["target"], env["platform"], env["target"] | ||
), | ||
source=sources, | ||
) | ||
else: | ||
library = env.SharedLibrary( | ||
"project/bin/libgdexample{}{}".format(env["suffix"], env["SHLIBSUFFIX"]), | ||
source=sources, | ||
) | ||
|
||
Default(library) |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"addons": { | ||
"imgui-godot": { | ||
"url": "../../../../../addons/imgui-godot", | ||
"source": "symlink" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[configuration] | ||
|
||
entry_symbol = "example_library_init" | ||
compatibility_minimum = "4.2" | ||
|
||
[libraries] | ||
|
||
macos.debug = "res://bin/libgdexample.macos.template_debug.framework" | ||
macos.release = "res://bin/libgdexample.macos.template_release.framework" | ||
windows.debug.x86_64 = "res://bin/libgdexample.windows.template_debug.x86_64.dll" | ||
windows.release.x86_64 = "res://bin/libgdexample.windows.template_release.x86_64.dll" | ||
linux.debug.x86_64 = "res://bin/libgdexample.linux.template_debug.x86_64.so" | ||
linux.release.x86_64 = "res://bin/libgdexample.linux.template_release.x86_64.so" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://cr045l23wjmqc" | ||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://icon.svg" | ||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 | ||
svg/scale=1.0 | ||
editor/scale_with_editor_scale=false | ||
editor/convert_colors_with_editor_theme=false |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[gd_scene format=3 uid="uid://c08lt0b17jqog"] | ||
|
||
[node name="Node2D" type="Node2D"] | ||
|
||
[node name="Example" type="Example" parent="."] |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
; Engine configuration file. | ||
; It's best edited using the editor UI and not directly, | ||
; since the parameters that go here are not all obvious. | ||
; | ||
; Format: | ||
; [section] ; section goes between [] | ||
; param=value ; assign values to parameters | ||
|
||
config_version=5 | ||
|
||
[application] | ||
|
||
config/name="GDExt" | ||
run/main_scene="res://main.tscn" | ||
config/features=PackedStringArray("4.2", "Forward Plus") | ||
config/icon="res://icon.svg" | ||
|
||
[autoload] | ||
|
||
ImGuiRoot="*res://addons/imgui-godot/data/ImGuiRoot.tscn" | ||
|
||
[editor_plugins] | ||
|
||
enabled=PackedStringArray("res://addons/imgui-godot/plugin.cfg") |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "example.h" | ||
#include <imgui-godot.h> | ||
|
||
using namespace godot; | ||
|
||
void Example::_bind_methods() | ||
{ | ||
} | ||
|
||
Example::Example() | ||
{ | ||
} | ||
|
||
Example::~Example() | ||
{ | ||
} | ||
|
||
void Example::_ready() | ||
{ | ||
ImGui::Godot::SyncImGuiPtrs(); | ||
} | ||
|
||
void Example::_process(double delta) | ||
{ | ||
#ifdef DEBUG_ENABLED | ||
if (Engine::get_singleton()->is_editor_hint()) | ||
return; | ||
#endif | ||
|
||
static int x = 0; | ||
|
||
ImGui::SetNextWindowSize({200, 200}, ImGuiCond_Once); | ||
ImGui::Begin("GDExtension Example"); | ||
ImGui::DragInt("x", &x); | ||
ImGui::Text("x = %d", x); | ||
ImGui::End(); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
#include <godot_cpp/classes/node.hpp> | ||
|
||
using namespace godot; | ||
|
||
class Example : public Node | ||
{ | ||
GDCLASS(Example, Node); | ||
|
||
protected: | ||
static void _bind_methods(); | ||
|
||
public: | ||
Example(); | ||
~Example(); | ||
|
||
void _ready() override; | ||
void _process(double delta) override; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "register_types.h" | ||
#include "example.h" | ||
|
||
#include <gdextension_interface.h> | ||
#include <godot_cpp/core/class_db.hpp> | ||
#include <godot_cpp/core/defs.hpp> | ||
#include <godot_cpp/godot.hpp> | ||
|
||
using namespace godot; | ||
|
||
void initialize_example_module(ModuleInitializationLevel p_level) | ||
{ | ||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) | ||
{ | ||
return; | ||
} | ||
|
||
GDREGISTER_CLASS(Example); | ||
} | ||
|
||
void uninitialize_example_module(ModuleInitializationLevel p_level) | ||
{ | ||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) | ||
{ | ||
return; | ||
} | ||
} | ||
|
||
extern "C" { | ||
GDExtensionBool GDE_EXPORT example_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, | ||
GDExtensionClassLibraryPtr p_library, | ||
GDExtensionInitialization* r_initialization) | ||
{ | ||
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization); | ||
|
||
init_obj.register_initializer(initialize_example_module); | ||
init_obj.register_terminator(uninitialize_example_module); | ||
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE); | ||
|
||
return init_obj.init(); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
#include <godot_cpp/core/class_db.hpp> | ||
|
||
using namespace godot; | ||
|
||
void initialize_example_module(ModuleInitializationLevel p_level); | ||
void uninitialize_example_module(ModuleInitializationLevel p_level); |
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