Skip to content

Commit

Permalink
add gdscript demo
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Jan 20, 2024
1 parent d05595e commit 411a560
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 1 deletion.
8 changes: 8 additions & 0 deletions doc/examples/GdsDemo/addons.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"addons": {
"imgui-godot": {
"url": "../../../../addons/imgui-godot",
"source": "symlink"
}
}
}
17 changes: 17 additions & 0 deletions doc/examples/GdsDemo/demo.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends Node

var myfloat := [0.0]
var mystr := [""]

func _ready():
var io := ImGui.GetIO()
io.ConfigFlags |= ImGui.ConfigFlags_ViewportsEnable

func _process(_delta):
ImGui.Begin("hello")
ImGui.Text("hello from GDScript")
ImGui.DragFloat("myfloat", myfloat)
ImGui.Text(str(myfloat[0]))
ImGui.InputText("mystr", mystr, 32)
ImGui.Text(mystr[0])
ImGui.End()
1 change: 1 addition & 0 deletions doc/examples/GdsDemo/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions doc/examples/GdsDemo/icon.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://p5eschom80xn"
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
12 changes: 12 additions & 0 deletions doc/examples/GdsDemo/main.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://dcv44scldjibq"]

[ext_resource type="Script" path="res://demo.gd" id="1_dqw6r"]

[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_dqw6r")
28 changes: 28 additions & 0 deletions doc/examples/GdsDemo/project.godot
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
; 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="GdsDemo"
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"

[display]

window/subwindows/embed_subwindows=false

[editor_plugins]

enabled=PackedStringArray("res://addons/imgui-godot/plugin.cfg")
2 changes: 1 addition & 1 deletion gdext/gds_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def gen_def(self):
return rv

def gen_bindings(self):
return f"ClassDB::register_internal_class<{self.name}>(); \\\n"
return f"ClassDB::register_class<{self.name}>(); \\\n"


class JsonParser:
Expand Down

0 comments on commit 411a560

Please sign in to comment.