summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
Diffstat (limited to 'demos')
-rw-r--r--demos/2d/kinematic_char/engine.cfg7
-rw-r--r--demos/2d/lights_shadows/engine.cfg3
-rw-r--r--demos/2d/motion/engine.cfg9
-rw-r--r--demos/2d/navpoly/engine.cfg7
-rw-r--r--demos/2d/normalmaps/engine.cfg7
-rw-r--r--demos/2d/screen_space_shaders/engine.cfg6
-rw-r--r--demos/2d/screen_space_shaders/screen_shaders.scnbin5896 -> 5936 bytes
-rw-r--r--demos/2d/texscreen/bubbles.scnbin1456 -> 1551 bytes
-rw-r--r--demos/2d/texscreen/engine.cfg7
-rw-r--r--demos/gui/input_mapping/controls.gd49
-rw-r--r--demos/gui/input_mapping/controls.scnbin0 -> 2686 bytes
-rw-r--r--demos/gui/input_mapping/engine.cfg18
12 files changed, 113 insertions, 0 deletions
diff --git a/demos/2d/kinematic_char/engine.cfg b/demos/2d/kinematic_char/engine.cfg
index 0132442c18..4ce8f836ae 100644
--- a/demos/2d/kinematic_char/engine.cfg
+++ b/demos/2d/kinematic_char/engine.cfg
@@ -4,6 +4,13 @@ name="Kinematic Collision"
main_scene="res://colworld.scn"
icon="res://icon.png"
+[display]
+
+width=800
+height=600
+stretch_mode="2d"
+stretch_aspect="keep"
+
[input]
move_up=[key(Up)]
diff --git a/demos/2d/lights_shadows/engine.cfg b/demos/2d/lights_shadows/engine.cfg
index 7e028c3556..771288c209 100644
--- a/demos/2d/lights_shadows/engine.cfg
+++ b/demos/2d/lights_shadows/engine.cfg
@@ -6,6 +6,9 @@ main_scene="res://light_shadows.scn"
[display]
stretch_mode="2d"
+width=800
+height=600
+stretch_aspect="keep"
[rasterizer]
diff --git a/demos/2d/motion/engine.cfg b/demos/2d/motion/engine.cfg
index cf16105b1c..29c4d0da20 100644
--- a/demos/2d/motion/engine.cfg
+++ b/demos/2d/motion/engine.cfg
@@ -3,3 +3,12 @@
name="Motion Test"
main_scene="res://motion.scn"
+<<<<<<< HEAD
+=======
+[display]
+
+width=800
+height=600
+stretch_mode="2d"
+stretch_aspect="keep"
+>>>>>>> ab99671bb835a5fe24a092ec34afe1ad862ac254
diff --git a/demos/2d/navpoly/engine.cfg b/demos/2d/navpoly/engine.cfg
index 51eefd7b77..40515dd3d2 100644
--- a/demos/2d/navpoly/engine.cfg
+++ b/demos/2d/navpoly/engine.cfg
@@ -2,3 +2,10 @@
name="Navigation Polygon (2D)"
main_scene="res://navigation.scn"
+
+[display]
+
+width=800
+height=600
+stretch_mode="2d"
+stretch_aspect="keep"
diff --git a/demos/2d/normalmaps/engine.cfg b/demos/2d/normalmaps/engine.cfg
index 3fc2048716..f0002dc2b8 100644
--- a/demos/2d/normalmaps/engine.cfg
+++ b/demos/2d/normalmaps/engine.cfg
@@ -2,3 +2,10 @@
name="2D Normal Mapping"
main_scene="res://normalmap.scn"
+
+[display]
+
+stretch_mode="2d"
+width=800
+height=600
+stretch_aspect="ignore"
diff --git a/demos/2d/screen_space_shaders/engine.cfg b/demos/2d/screen_space_shaders/engine.cfg
index 108fdeba34..527e2f8f0a 100644
--- a/demos/2d/screen_space_shaders/engine.cfg
+++ b/demos/2d/screen_space_shaders/engine.cfg
@@ -3,3 +3,9 @@
name="Screen-Space Shaders"
main_scene="res://screen_shaders.scn"
+[display]
+
+width=780
+height=600
+stretch_mode="2d"
+stretch_aspect="keep"
diff --git a/demos/2d/screen_space_shaders/screen_shaders.scn b/demos/2d/screen_space_shaders/screen_shaders.scn
index cc62ac8203..fc2be96fc9 100644
--- a/demos/2d/screen_space_shaders/screen_shaders.scn
+++ b/demos/2d/screen_space_shaders/screen_shaders.scn
Binary files differ
diff --git a/demos/2d/texscreen/bubbles.scn b/demos/2d/texscreen/bubbles.scn
index 779cba6930..41026aceed 100644
--- a/demos/2d/texscreen/bubbles.scn
+++ b/demos/2d/texscreen/bubbles.scn
Binary files differ
diff --git a/demos/2d/texscreen/engine.cfg b/demos/2d/texscreen/engine.cfg
index 58193c8c4a..fb683dfc1d 100644
--- a/demos/2d/texscreen/engine.cfg
+++ b/demos/2d/texscreen/engine.cfg
@@ -2,3 +2,10 @@
name="Glass Bubbles (Texscreen)"
main_scene="res://bubbles.scn"
+
+[display]
+
+width=800
+height=600
+stretch_mode="2d"
+stretch_aspect="keep"
diff --git a/demos/gui/input_mapping/controls.gd b/demos/gui/input_mapping/controls.gd
new file mode 100644
index 0000000000..6ca059c812
--- /dev/null
+++ b/demos/gui/input_mapping/controls.gd
@@ -0,0 +1,49 @@
+# Note for the reader:
+#
+# This demo conveniently uses the same names for actions and for the container nodes
+# that hold each remapping button. This allow to get back to the button based simply
+# on the name of the corresponding action, but it might not be so simple in your project.
+#
+# A better approach for large-scale input remapping might be to do the connections between
+# buttons and wait_for_input through the code, passing as arguments both the name of the
+# action and the node, e.g.:
+# button.connect("pressed", self, "wait_for_input", [ button, action ])
+
+extends Control
+
+var player_actions = [ "move_up", "move_down", "move_left", "move_right", "jump" ]
+var action # To register the action the UI is currently handling
+var button # Button node corresponding to the above action
+
+func wait_for_input(action_bind):
+ action = action_bind
+ # See note at the beginning of the script
+ button = get_node("bindings").get_node(action).get_node("Button")
+ get_node("contextual_help").set_text("Press a key to assign to the '" + action + "' action.")
+ set_process_input(true)
+
+func _input(event):
+ # Handle the first pressed key
+ if (event.type == InputEvent.KEY):
+ # Register the event as handled and stop polling
+ get_tree().set_input_as_handled()
+ set_process_input(false)
+ # Reinitialise the contextual help label
+ get_node("contextual_help").set_text("Click a key binding to reassign it, or press the Cancel action.")
+ if (not event.is_action("ui_cancel")):
+ # Display the string corresponding to the pressed key
+ button.set_text(OS.get_scancode_string(event.scancode))
+ # Start by removing previously key binding(s)
+ for old_event in InputMap.get_action_list(action):
+ InputMap.action_erase_event(action, old_event)
+ # Add the new key binding
+ InputMap.action_add_event(action, event)
+
+func _ready():
+ # Initialise each button with the default key binding from InputMap
+ var input_event
+ for action in player_actions:
+ # We assume that the key binding that we want is the first one (0), if there are several
+ input_event = InputMap.get_action_list(action)[0]
+ # See note at the beginning of the script
+ get_node("bindings").get_node(action).get_node("Button").set_text(OS.get_scancode_string(input_event.scancode))
diff --git a/demos/gui/input_mapping/controls.scn b/demos/gui/input_mapping/controls.scn
new file mode 100644
index 0000000000..276712ba22
--- /dev/null
+++ b/demos/gui/input_mapping/controls.scn
Binary files differ
diff --git a/demos/gui/input_mapping/engine.cfg b/demos/gui/input_mapping/engine.cfg
new file mode 100644
index 0000000000..959c0ac7d5
--- /dev/null
+++ b/demos/gui/input_mapping/engine.cfg
@@ -0,0 +1,18 @@
+[application]
+
+name="Input Mapping GUI"
+main_scene="res://controls.scn"
+icon="icon.png"
+
+[display]
+
+width=640
+height=480
+
+[input]
+
+move_up=[key(Up)]
+move_down=[key(Down)]
+move_left=[key(Left)]
+move_right=[key(Right)]
+jump=[key(Space)]