mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 07:50:22 +01:00
Merge pull request #172 from RandomShaper/adpod-mt
Examples about (multi)touch events
This commit is contained in:
125
misc/multitouch_cubes/CubeScene.tscn
Normal file
125
misc/multitouch_cubes/CubeScene.tscn
Normal file
@@ -0,0 +1,125 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://default_env.tres" type="Environment" id=1]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
|
||||
render_priority = 0
|
||||
flags_transparent = false
|
||||
flags_unshaded = false
|
||||
flags_vertex_lighting = false
|
||||
flags_no_depth_test = false
|
||||
flags_use_point_size = false
|
||||
flags_world_triplanar = false
|
||||
flags_fixed_size = false
|
||||
vertex_color_use_as_albedo = false
|
||||
vertex_color_is_srgb = false
|
||||
params_diffuse_mode = 1
|
||||
params_specular_mode = 0
|
||||
params_blend_mode = 0
|
||||
params_cull_mode = 0
|
||||
params_depth_draw_mode = 0
|
||||
params_line_width = 1.0
|
||||
params_point_size = 1.0
|
||||
params_billboard_mode = 0
|
||||
params_grow = false
|
||||
params_use_alpha_scissor = false
|
||||
albedo_color = Color( 0.149414, 0.796875, 0.569252, 1 )
|
||||
metallic = 0.0
|
||||
metallic_specular = 0.5
|
||||
metallic_texture_channel = 0
|
||||
roughness = 0.0
|
||||
roughness_texture_channel = 0
|
||||
emission_enabled = false
|
||||
normal_enabled = false
|
||||
rim_enabled = false
|
||||
clearcoat_enabled = false
|
||||
anisotropy_enabled = false
|
||||
ao_enabled = false
|
||||
depth_enabled = false
|
||||
subsurf_scatter_enabled = false
|
||||
transmission_enabled = false
|
||||
refraction_enabled = false
|
||||
detail_enabled = false
|
||||
uv1_scale = Vector3( 1, 1, 1 )
|
||||
uv1_offset = Vector3( 0, 0, 0 )
|
||||
uv1_triplanar = false
|
||||
uv1_triplanar_sharpness = 1.0
|
||||
uv2_scale = Vector3( 1, 1, 1 )
|
||||
uv2_offset = Vector3( 0, 0, 0 )
|
||||
uv2_triplanar = false
|
||||
uv2_triplanar_sharpness = 1.0
|
||||
proximity_fade_enable = false
|
||||
distance_fade_enable = false
|
||||
|
||||
[sub_resource type="CubeMesh" id=2]
|
||||
|
||||
size = Vector3( 2, 2, 2 )
|
||||
subdivide_width = 0
|
||||
subdivide_height = 0
|
||||
subdivide_depth = 0
|
||||
|
||||
[node name="Spatial" type="Spatial"]
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
|
||||
transform = Transform( 0.707107, 0, -0.707107, -0.353553, 0.866025, -0.353553, 0.612372, 0.5, 0.612372, 0, 0, 0 )
|
||||
layers = 1
|
||||
material_override = SubResource( 1 )
|
||||
cast_shadow = 1
|
||||
extra_cull_margin = 0.0
|
||||
use_in_baked_light = false
|
||||
lod_min_distance = 0.0
|
||||
lod_min_hysteresis = 0.0
|
||||
lod_max_distance = 0.0
|
||||
lod_max_hysteresis = 0.0
|
||||
mesh = SubResource( 2 )
|
||||
skeleton = NodePath("..")
|
||||
material/0 = null
|
||||
|
||||
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
||||
|
||||
transform = Transform( 0.926535, 0.11439, -0.358396, 0.199614, 0.658013, 0.726067, 0.318884, -0.744267, 0.586839, 0, 4.14991, 0 )
|
||||
layers = 1
|
||||
light_color = Color( 1, 1, 1, 1 )
|
||||
light_energy = 1.0
|
||||
light_indirect_energy = 1.0
|
||||
light_negative = false
|
||||
light_specular = 0.5
|
||||
light_cull_mask = -1
|
||||
shadow_enabled = false
|
||||
shadow_color = Color( 0, 0, 0, 1 )
|
||||
shadow_bias = 0.1
|
||||
shadow_contact = 0.0
|
||||
shadow_reverse_cull_face = false
|
||||
editor_only = false
|
||||
directional_shadow_mode = 2
|
||||
directional_shadow_split_1 = 0.1
|
||||
directional_shadow_split_2 = 0.2
|
||||
directional_shadow_split_3 = 0.5
|
||||
directional_shadow_blend_splits = false
|
||||
directional_shadow_normal_bias = 0.8
|
||||
directional_shadow_bias_split_scale = 0.25
|
||||
directional_shadow_depth_range = 0
|
||||
directional_shadow_max_distance = 200.0
|
||||
|
||||
[node name="Camera" type="Camera" parent="."]
|
||||
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 7.09558 )
|
||||
projection = 0
|
||||
fov = 50.0
|
||||
near = 0.1
|
||||
far = 100.0
|
||||
keep_aspect = 1
|
||||
current = false
|
||||
cull_mask = 1048575
|
||||
environment = null
|
||||
h_offset = 0.0
|
||||
v_offset = 0.0
|
||||
doppler/tracking = 0
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
|
||||
environment = ExtResource( 1 )
|
||||
|
||||
|
||||
131
misc/multitouch_cubes/GestureArea.gd
Normal file
131
misc/multitouch_cubes/GestureArea.gd
Normal file
@@ -0,0 +1,131 @@
|
||||
extends Control
|
||||
|
||||
export(NodePath) var target
|
||||
export var min_scale = 0.1
|
||||
export var max_scale = 3.0
|
||||
export var one_finger_rot_x = true
|
||||
export var one_finger_rot_y = true
|
||||
export var two_fingers_rot_z = true
|
||||
export var two_fingers_zoom = true
|
||||
|
||||
var base_state
|
||||
var curr_state
|
||||
|
||||
var target_node
|
||||
|
||||
# We keep here a copy of the state before the number of fingers changed to avoid accumulation errors
|
||||
var base_xform
|
||||
|
||||
func _ready():
|
||||
base_state = {}
|
||||
curr_state = {}
|
||||
target_node = get_node(target)
|
||||
|
||||
func _gui_input(event):
|
||||
# We must start touching inside, but we can drag or unpress outside
|
||||
# if !(event is InputEventScreenDrag ||
|
||||
# (event is InputEventScreenTouch && (!event.pressed || get_global_rect().has_point(event.position)))):
|
||||
# return
|
||||
|
||||
var finger_count_changed = false
|
||||
var finger_count = base_state.size()
|
||||
|
||||
if finger_count == 0:
|
||||
# No fingers => Accept press
|
||||
|
||||
if event is InputEventScreenTouch:
|
||||
if event.pressed:
|
||||
# A finger started touching
|
||||
|
||||
base_state = {
|
||||
event.index: event.position,
|
||||
}
|
||||
|
||||
elif finger_count == 1:
|
||||
# One finger => For rotating around X and Y
|
||||
# Accept one more press, unpress or drag
|
||||
|
||||
if event is InputEventScreenTouch:
|
||||
if event.pressed:
|
||||
# One more finger started touching
|
||||
|
||||
# Reset the base state to the only current and the new fingers
|
||||
base_state = {
|
||||
curr_state.keys()[0]: curr_state.values()[0],
|
||||
event.index: event.position,
|
||||
}
|
||||
else:
|
||||
if base_state.has(event.index):
|
||||
# Only touching finger released
|
||||
|
||||
base_state.clear()
|
||||
|
||||
elif event is InputEventScreenDrag:
|
||||
if curr_state.has(event.index):
|
||||
# Touching finger dragged
|
||||
|
||||
var unit_drag = _px2unit(base_state[base_state.keys()[0]] - event.position)
|
||||
if one_finger_rot_x:
|
||||
target_node.global_rotate(Vector3(0, 1, 0), deg2rad(180.0 * unit_drag.x))
|
||||
if one_finger_rot_y:
|
||||
target_node.global_rotate(Vector3(1, 0, 0), deg2rad(180.0 * unit_drag.y))
|
||||
# Since rotating around two axes, we have to reset the base constantly
|
||||
curr_state[event.index] = event.position
|
||||
base_state[event.index] = event.position
|
||||
base_xform = target_node.get_transform()
|
||||
|
||||
elif finger_count == 2:
|
||||
# Two fingers => To pinch-zoom and rotate around Z
|
||||
# Accept unpress or drag
|
||||
|
||||
if event is InputEventScreenTouch:
|
||||
if !event.pressed && base_state.has(event.index):
|
||||
# Some known touching finger released
|
||||
|
||||
# Remove released finger from the base state
|
||||
base_state.erase(event.index)
|
||||
# Reset the base state to the now only toyching finger
|
||||
base_state = {
|
||||
curr_state.keys()[0]: curr_state.values()[0],
|
||||
}
|
||||
|
||||
elif event is InputEventScreenDrag:
|
||||
if curr_state.has(event.index):
|
||||
# Some known touching finger dragged
|
||||
|
||||
# Update
|
||||
curr_state[event.index] = event.position
|
||||
|
||||
# Compute base and current inter-finger vectors
|
||||
var base_segment = base_state[base_state.keys()[0]] - base_state[base_state.keys()[1]]
|
||||
var new_segment = curr_state[curr_state.keys()[0]] - curr_state[curr_state.keys()[1]]
|
||||
|
||||
# Get the base scale from the base matrix
|
||||
var base_scale = Vector3(base_xform.basis.x.x, base_xform.basis.y.y, base_xform.basis.z.z).length()
|
||||
|
||||
if two_fingers_zoom:
|
||||
# Compute the new scale limiting it and taking into account the base scale
|
||||
var new_scale = clamp(base_scale * (new_segment.length() / base_segment.length()), min_scale, max_scale) / base_scale
|
||||
target_node.set_transform(base_xform.scaled(new_scale * Vector3(1, 1, 1)))
|
||||
else:
|
||||
target_node.set_transform(base_xform)
|
||||
|
||||
if two_fingers_rot_z:
|
||||
# Apply rotation between base inter-finger vector and the current one
|
||||
var rot = new_segment.angle_to(base_segment)
|
||||
target_node.global_rotate(Vector3(0, 0, 1), rot)
|
||||
|
||||
# Finger count changed?
|
||||
if base_state.size() != finger_count:
|
||||
# Copy new base state to the current state
|
||||
curr_state = {}
|
||||
for idx in base_state.keys():
|
||||
curr_state[idx] = base_state[idx]
|
||||
# Remember the base transform
|
||||
base_xform = target_node.get_transform()
|
||||
|
||||
# Converts a vector in pixels to a unitary magnitude,
|
||||
# considering the number of pixels of the shorter axis is the unit
|
||||
func _px2unit(v):
|
||||
var shortest = min(get_size().x, get_size().y)
|
||||
return v * (1.0 / shortest)
|
||||
376
misc/multitouch_cubes/Main.tscn
Normal file
376
misc/multitouch_cubes/Main.tscn
Normal file
@@ -0,0 +1,376 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://GestureArea.gd" type="Script" id=1]
|
||||
[ext_resource path="res://CubeScene.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 1
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
alignment = 0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 512.0
|
||||
margin_bottom = 254.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 1
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
alignment = 0
|
||||
|
||||
[node name="ViewportContainer" type="ViewportContainer" parent="HBoxContainer"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 254.0
|
||||
margin_bottom = 254.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
stretch = true
|
||||
stretch_shrink = 1
|
||||
script = ExtResource( 1 )
|
||||
target = NodePath("Viewport/Spatial/MeshInstance")
|
||||
min_scale = 0.1
|
||||
max_scale = 3.0
|
||||
one_finger_rot_x = true
|
||||
one_finger_rot_y = false
|
||||
two_fingers_rot_z = false
|
||||
two_fingers_zoom = false
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="HBoxContainer/ViewportContainer"]
|
||||
|
||||
arvr = false
|
||||
size = Vector2( 254, 254 )
|
||||
own_world = true
|
||||
world = null
|
||||
transparent_bg = true
|
||||
msaa = 0
|
||||
hdr = false
|
||||
disable_3d = false
|
||||
usage = 2
|
||||
debug_draw = 0
|
||||
render_target_v_flip = false
|
||||
render_target_clear_mode = 0
|
||||
render_target_update_mode = 3
|
||||
audio_listener_enable_2d = false
|
||||
audio_listener_enable_3d = false
|
||||
physics_object_picking = false
|
||||
gui_disable_input = false
|
||||
gui_snap_controls_to_pixels = true
|
||||
shadow_atlas_size = 0
|
||||
shadow_atlas_quad_0 = 2
|
||||
shadow_atlas_quad_1 = 2
|
||||
shadow_atlas_quad_2 = 3
|
||||
shadow_atlas_quad_3 = 4
|
||||
|
||||
[node name="Spatial" parent="HBoxContainer/ViewportContainer/Viewport" instance=ExtResource( 2 )]
|
||||
|
||||
[node name="DirectionalLight" parent="HBoxContainer/ViewportContainer/Viewport/Spatial"]
|
||||
|
||||
light_cull_mask = -1
|
||||
|
||||
[node name="Camera" parent="HBoxContainer/ViewportContainer/Viewport/Spatial"]
|
||||
|
||||
current = true
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxContainer/ViewportContainer"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 7.0
|
||||
margin_top = 11.0
|
||||
margin_right = 157.0
|
||||
margin_bottom = 25.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 4
|
||||
text = "One-finger rot around X"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="ViewportContainer2" type="ViewportContainer" parent="HBoxContainer"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 258.0
|
||||
margin_right = 512.0
|
||||
margin_bottom = 254.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
stretch = true
|
||||
stretch_shrink = 1
|
||||
script = ExtResource( 1 )
|
||||
target = NodePath("Viewport/Spatial/MeshInstance")
|
||||
min_scale = 0.1
|
||||
max_scale = 3.0
|
||||
one_finger_rot_x = true
|
||||
one_finger_rot_y = true
|
||||
two_fingers_rot_z = false
|
||||
two_fingers_zoom = false
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="HBoxContainer/ViewportContainer2"]
|
||||
|
||||
arvr = false
|
||||
size = Vector2( 254, 254 )
|
||||
own_world = true
|
||||
world = null
|
||||
transparent_bg = true
|
||||
msaa = 0
|
||||
hdr = false
|
||||
disable_3d = false
|
||||
usage = 2
|
||||
debug_draw = 0
|
||||
render_target_v_flip = false
|
||||
render_target_clear_mode = 0
|
||||
render_target_update_mode = 3
|
||||
audio_listener_enable_2d = false
|
||||
audio_listener_enable_3d = false
|
||||
physics_object_picking = false
|
||||
gui_disable_input = false
|
||||
gui_snap_controls_to_pixels = true
|
||||
shadow_atlas_size = 0
|
||||
shadow_atlas_quad_0 = 2
|
||||
shadow_atlas_quad_1 = 2
|
||||
shadow_atlas_quad_2 = 3
|
||||
shadow_atlas_quad_3 = 4
|
||||
|
||||
[node name="Spatial" parent="HBoxContainer/ViewportContainer2/Viewport" instance=ExtResource( 2 )]
|
||||
|
||||
[node name="DirectionalLight" parent="HBoxContainer/ViewportContainer2/Viewport/Spatial"]
|
||||
|
||||
light_cull_mask = -1
|
||||
|
||||
[node name="Camera" parent="HBoxContainer/ViewportContainer2/Viewport/Spatial"]
|
||||
|
||||
current = true
|
||||
|
||||
[node name="Label2" type="Label" parent="HBoxContainer/ViewportContainer2"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 8.0
|
||||
margin_top = 11.0
|
||||
margin_right = 196.0
|
||||
margin_bottom = 25.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 4
|
||||
text = "One-finger rot around X and Y"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="."]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_top = 258.0
|
||||
margin_right = 512.0
|
||||
margin_bottom = 512.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 1
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
alignment = 0
|
||||
|
||||
[node name="ViewportContainer" type="ViewportContainer" parent="HBoxContainer2"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 254.0
|
||||
margin_bottom = 254.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
stretch = true
|
||||
stretch_shrink = 1
|
||||
script = ExtResource( 1 )
|
||||
target = NodePath("Viewport/Spatial/MeshInstance")
|
||||
min_scale = 0.1
|
||||
max_scale = 3.0
|
||||
one_finger_rot_x = true
|
||||
one_finger_rot_y = true
|
||||
two_fingers_rot_z = true
|
||||
two_fingers_zoom = false
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="HBoxContainer2/ViewportContainer"]
|
||||
|
||||
arvr = false
|
||||
size = Vector2( 254, 254 )
|
||||
own_world = true
|
||||
world = null
|
||||
transparent_bg = true
|
||||
msaa = 0
|
||||
hdr = false
|
||||
disable_3d = false
|
||||
usage = 2
|
||||
debug_draw = 0
|
||||
render_target_v_flip = false
|
||||
render_target_clear_mode = 0
|
||||
render_target_update_mode = 3
|
||||
audio_listener_enable_2d = false
|
||||
audio_listener_enable_3d = false
|
||||
physics_object_picking = false
|
||||
gui_disable_input = false
|
||||
gui_snap_controls_to_pixels = true
|
||||
shadow_atlas_size = 0
|
||||
shadow_atlas_quad_0 = 2
|
||||
shadow_atlas_quad_1 = 2
|
||||
shadow_atlas_quad_2 = 3
|
||||
shadow_atlas_quad_3 = 4
|
||||
|
||||
[node name="Spatial" parent="HBoxContainer2/ViewportContainer/Viewport" instance=ExtResource( 2 )]
|
||||
|
||||
[node name="DirectionalLight" parent="HBoxContainer2/ViewportContainer/Viewport/Spatial"]
|
||||
|
||||
light_cull_mask = -1
|
||||
|
||||
[node name="Camera" parent="HBoxContainer2/ViewportContainer/Viewport/Spatial"]
|
||||
|
||||
current = true
|
||||
|
||||
[node name="Label3" type="Label" parent="HBoxContainer2/ViewportContainer"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 8.0
|
||||
margin_top = 9.0
|
||||
margin_right = 236.0
|
||||
margin_bottom = 23.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 4
|
||||
text = "One-finger X/Y rot + two-finger Z rot"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="ViewportContainer2" type="ViewportContainer" parent="HBoxContainer2"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 258.0
|
||||
margin_right = 512.0
|
||||
margin_bottom = 254.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
stretch = true
|
||||
stretch_shrink = 1
|
||||
script = ExtResource( 1 )
|
||||
target = NodePath("Viewport/Spatial/MeshInstance")
|
||||
min_scale = 0.1
|
||||
max_scale = 3.0
|
||||
one_finger_rot_x = true
|
||||
one_finger_rot_y = true
|
||||
two_fingers_rot_z = true
|
||||
two_fingers_zoom = true
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="HBoxContainer2/ViewportContainer2"]
|
||||
|
||||
arvr = false
|
||||
size = Vector2( 254, 254 )
|
||||
own_world = true
|
||||
world = null
|
||||
transparent_bg = true
|
||||
msaa = 0
|
||||
hdr = false
|
||||
disable_3d = false
|
||||
usage = 2
|
||||
debug_draw = 0
|
||||
render_target_v_flip = false
|
||||
render_target_clear_mode = 0
|
||||
render_target_update_mode = 3
|
||||
audio_listener_enable_2d = false
|
||||
audio_listener_enable_3d = false
|
||||
physics_object_picking = false
|
||||
gui_disable_input = false
|
||||
gui_snap_controls_to_pixels = true
|
||||
shadow_atlas_size = 0
|
||||
shadow_atlas_quad_0 = 2
|
||||
shadow_atlas_quad_1 = 2
|
||||
shadow_atlas_quad_2 = 3
|
||||
shadow_atlas_quad_3 = 4
|
||||
|
||||
[node name="Spatial" parent="HBoxContainer2/ViewportContainer2/Viewport" instance=ExtResource( 2 )]
|
||||
|
||||
[node name="DirectionalLight" parent="HBoxContainer2/ViewportContainer2/Viewport/Spatial"]
|
||||
|
||||
light_cull_mask = -1
|
||||
|
||||
[node name="Camera" parent="HBoxContainer2/ViewportContainer2/Viewport/Spatial"]
|
||||
|
||||
current = true
|
||||
|
||||
[node name="Label2" type="Label" parent="HBoxContainer2/ViewportContainer2"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 12.0
|
||||
margin_top = 9.0
|
||||
margin_right = 279.0
|
||||
margin_bottom = 23.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 4
|
||||
text = "One-finger X/Y, two-finger Z + pinch"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
|
||||
[editable path="HBoxContainer/ViewportContainer/Viewport/Spatial"]
|
||||
[editable path="HBoxContainer/ViewportContainer2/Viewport/Spatial"]
|
||||
[editable path="HBoxContainer2/ViewportContainer/Viewport/Spatial"]
|
||||
[editable path="HBoxContainer2/ViewportContainer2/Viewport/Spatial"]
|
||||
80
misc/multitouch_cubes/default_env.tres
Normal file
80
misc/multitouch_cubes/default_env.tres
Normal file
@@ -0,0 +1,80 @@
|
||||
[gd_resource type="Environment" format=2]
|
||||
|
||||
[resource]
|
||||
|
||||
background_mode = 0
|
||||
background_sky_custom_fov = 0.0
|
||||
background_color = Color( 0, 0, 0, 1 )
|
||||
background_energy = 1.0
|
||||
background_canvas_max_layer = 0
|
||||
ambient_light_color = Color( 0.307434, 0.362682, 0.539063, 1 )
|
||||
ambient_light_energy = 1.0
|
||||
ambient_light_sky_contribution = 1.0
|
||||
fog_enabled = false
|
||||
fog_color = Color( 0.5, 0.6, 0.7, 1 )
|
||||
fog_sun_color = Color( 1, 0.9, 0.7, 1 )
|
||||
fog_sun_amount = 0.0
|
||||
fog_depth_enabled = true
|
||||
fog_depth_begin = 10.0
|
||||
fog_depth_curve = 1.0
|
||||
fog_transmit_enabled = false
|
||||
fog_transmit_curve = 1.0
|
||||
fog_height_enabled = false
|
||||
fog_height_min = 0.0
|
||||
fog_height_max = 100.0
|
||||
fog_height_curve = 1.0
|
||||
tonemap_mode = 0
|
||||
tonemap_exposure = 1.0
|
||||
tonemap_white = 1.0
|
||||
auto_exposure_enabled = false
|
||||
auto_exposure_scale = 0.4
|
||||
auto_exposure_min_luma = 0.05
|
||||
auto_exposure_max_luma = 8.0
|
||||
auto_exposure_speed = 0.5
|
||||
ss_reflections_enabled = false
|
||||
ss_reflections_max_steps = 64
|
||||
ss_reflections_fade_in = 0.15
|
||||
ss_reflections_fade_out = 2.0
|
||||
ss_reflections_depth_tolerance = 0.2
|
||||
ss_reflections_roughness = true
|
||||
ssao_enabled = false
|
||||
ssao_radius = 1.0
|
||||
ssao_intensity = 1.0
|
||||
ssao_radius2 = 0.0
|
||||
ssao_intensity2 = 1.0
|
||||
ssao_bias = 0.01
|
||||
ssao_light_affect = 0.0
|
||||
ssao_color = Color( 0, 0, 0, 1 )
|
||||
ssao_quality = 0
|
||||
ssao_blur = 3
|
||||
ssao_edge_sharpness = 4.0
|
||||
dof_blur_far_enabled = false
|
||||
dof_blur_far_distance = 10.0
|
||||
dof_blur_far_transition = 5.0
|
||||
dof_blur_far_amount = 0.1
|
||||
dof_blur_far_quality = 1
|
||||
dof_blur_near_enabled = false
|
||||
dof_blur_near_distance = 2.0
|
||||
dof_blur_near_transition = 1.0
|
||||
dof_blur_near_amount = 0.1
|
||||
dof_blur_near_quality = 1
|
||||
glow_enabled = false
|
||||
glow_levels/1 = false
|
||||
glow_levels/2 = false
|
||||
glow_levels/3 = true
|
||||
glow_levels/4 = false
|
||||
glow_levels/5 = true
|
||||
glow_levels/6 = false
|
||||
glow_levels/7 = false
|
||||
glow_intensity = 0.8
|
||||
glow_strength = 1.0
|
||||
glow_bloom = 0.0
|
||||
glow_blend_mode = 2
|
||||
glow_hdr_threshold = 1.0
|
||||
glow_hdr_scale = 2.0
|
||||
glow_bicubic_upscale = false
|
||||
adjustment_enabled = false
|
||||
adjustment_brightness = 1.0
|
||||
adjustment_contrast = 1.0
|
||||
adjustment_saturation = 1.0
|
||||
|
||||
BIN
misc/multitouch_cubes/icon.png
Normal file
BIN
misc/multitouch_cubes/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
24
misc/multitouch_cubes/project.godot
Normal file
24
misc/multitouch_cubes/project.godot
Normal file
@@ -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=3
|
||||
|
||||
[application]
|
||||
|
||||
config/name="InteractiveCubes"
|
||||
run/main_scene="res://Main.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[gdnative]
|
||||
|
||||
singletons=[ ]
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_clear_color=Color( 0.113725, 0.133333, 0.196078, 1 )
|
||||
environment/default_environment="res://default_env.tres"
|
||||
20
misc/multitouch_view/Main.gd
Normal file
20
misc/multitouch_view/Main.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
extends Node2D
|
||||
|
||||
func _process(delta):
|
||||
# To keep redrawing on every frame
|
||||
update()
|
||||
|
||||
func _draw():
|
||||
# Get the touch helper singleton
|
||||
var touch_helper = get_node("/root/TouchHelper")
|
||||
# Draw every pointer as a circle
|
||||
for ptr_id in touch_helper.state.keys():
|
||||
var pos = touch_helper.state[ptr_id]
|
||||
var color = _get_color_for_ptr_id(ptr_id)
|
||||
color.a = 0.75
|
||||
draw_circle(pos, 40.0, color)
|
||||
|
||||
# Just a way of getting different colors
|
||||
func _get_color_for_ptr_id(id):
|
||||
var x = (id % 7) + 1
|
||||
return Color(float(bool(x & 1)), float(bool(x & 2)), float(bool(x & 4)))
|
||||
9
misc/multitouch_view/Main.tscn
Normal file
9
misc/multitouch_view/Main.tscn
Normal file
@@ -0,0 +1,9 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Main.gd" type="Script" id=1]
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
|
||||
script = ExtResource( 1 )
|
||||
|
||||
|
||||
43
misc/multitouch_view/TouchHelper.gd
Normal file
43
misc/multitouch_view/TouchHelper.gd
Normal file
@@ -0,0 +1,43 @@
|
||||
# This will track the position of every pointer in its public `state` property, which is a
|
||||
# Dictionary, in which each key is a pointer id (integer) and each value its position (Vector2).
|
||||
# It works by listening to input events not handled by other means.
|
||||
# It also remaps the pointer indices coming from the OS to the lowest available to be friendlier.
|
||||
# It can be conveniently setup as a singleton.
|
||||
|
||||
extends Node
|
||||
|
||||
var state = {}
|
||||
var _os2own = {}
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventScreenTouch:
|
||||
if event.pressed:
|
||||
# Down
|
||||
if !_os2own.has(event.index): # Defensively discard index if already known
|
||||
var ptr_id = _find_free_pointer_id()
|
||||
state[ptr_id] = event.position
|
||||
_os2own[event.index] = ptr_id
|
||||
else:
|
||||
# Up
|
||||
if _os2own.has(event.index): # Defensively discard index if not known
|
||||
var ptr_id = _os2own[event.index]
|
||||
state.erase(ptr_id)
|
||||
_os2own.erase(event.index)
|
||||
return true
|
||||
|
||||
elif event is InputEventScreenDrag:
|
||||
# Move
|
||||
if _os2own.has(event.index): # Defensively discard index if not known
|
||||
var ptr_id = _os2own[event.index]
|
||||
state[ptr_id] = event.position
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
func _find_free_pointer_id():
|
||||
var used = state.keys()
|
||||
var i = 0
|
||||
while i in used:
|
||||
i += 1
|
||||
return i
|
||||
|
||||
101
misc/multitouch_view/default_env.tres
Normal file
101
misc/multitouch_view/default_env.tres
Normal file
@@ -0,0 +1,101 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
radiance_size = 4
|
||||
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 )
|
||||
sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 )
|
||||
sky_curve = 0.25
|
||||
sky_energy = 1.0
|
||||
ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 )
|
||||
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 )
|
||||
ground_curve = 0.01
|
||||
ground_energy = 1.0
|
||||
sun_color = Color( 1, 1, 1, 1 )
|
||||
sun_latitude = 35.0
|
||||
sun_longitude = 0.0
|
||||
sun_angle_min = 1.0
|
||||
sun_angle_max = 100.0
|
||||
sun_curve = 0.05
|
||||
sun_energy = 16.0
|
||||
texture_size = 2
|
||||
|
||||
[resource]
|
||||
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
background_sky_custom_fov = 0.0
|
||||
background_color = Color( 0, 0, 0, 1 )
|
||||
background_energy = 1.0
|
||||
background_canvas_max_layer = 0
|
||||
ambient_light_color = Color( 0, 0, 0, 1 )
|
||||
ambient_light_energy = 1.0
|
||||
ambient_light_sky_contribution = 1.0
|
||||
fog_enabled = false
|
||||
fog_color = Color( 0.5, 0.6, 0.7, 1 )
|
||||
fog_sun_color = Color( 1, 0.9, 0.7, 1 )
|
||||
fog_sun_amount = 0.0
|
||||
fog_depth_enabled = true
|
||||
fog_depth_begin = 10.0
|
||||
fog_depth_curve = 1.0
|
||||
fog_transmit_enabled = false
|
||||
fog_transmit_curve = 1.0
|
||||
fog_height_enabled = false
|
||||
fog_height_min = 0.0
|
||||
fog_height_max = 100.0
|
||||
fog_height_curve = 1.0
|
||||
tonemap_mode = 0
|
||||
tonemap_exposure = 1.0
|
||||
tonemap_white = 1.0
|
||||
auto_exposure_enabled = false
|
||||
auto_exposure_scale = 0.4
|
||||
auto_exposure_min_luma = 0.05
|
||||
auto_exposure_max_luma = 8.0
|
||||
auto_exposure_speed = 0.5
|
||||
ss_reflections_enabled = false
|
||||
ss_reflections_max_steps = 64
|
||||
ss_reflections_fade_in = 0.15
|
||||
ss_reflections_fade_out = 2.0
|
||||
ss_reflections_depth_tolerance = 0.2
|
||||
ss_reflections_roughness = true
|
||||
ssao_enabled = false
|
||||
ssao_radius = 1.0
|
||||
ssao_intensity = 1.0
|
||||
ssao_radius2 = 0.0
|
||||
ssao_intensity2 = 1.0
|
||||
ssao_bias = 0.01
|
||||
ssao_light_affect = 0.0
|
||||
ssao_color = Color( 0, 0, 0, 1 )
|
||||
ssao_quality = 0
|
||||
ssao_blur = 3
|
||||
ssao_edge_sharpness = 4.0
|
||||
dof_blur_far_enabled = false
|
||||
dof_blur_far_distance = 10.0
|
||||
dof_blur_far_transition = 5.0
|
||||
dof_blur_far_amount = 0.1
|
||||
dof_blur_far_quality = 1
|
||||
dof_blur_near_enabled = false
|
||||
dof_blur_near_distance = 2.0
|
||||
dof_blur_near_transition = 1.0
|
||||
dof_blur_near_amount = 0.1
|
||||
dof_blur_near_quality = 1
|
||||
glow_enabled = false
|
||||
glow_levels/1 = false
|
||||
glow_levels/2 = false
|
||||
glow_levels/3 = true
|
||||
glow_levels/4 = false
|
||||
glow_levels/5 = true
|
||||
glow_levels/6 = false
|
||||
glow_levels/7 = false
|
||||
glow_intensity = 0.8
|
||||
glow_strength = 1.0
|
||||
glow_bloom = 0.0
|
||||
glow_blend_mode = 2
|
||||
glow_hdr_threshold = 1.0
|
||||
glow_hdr_scale = 2.0
|
||||
glow_bicubic_upscale = false
|
||||
adjustment_enabled = false
|
||||
adjustment_brightness = 1.0
|
||||
adjustment_contrast = 1.0
|
||||
adjustment_saturation = 1.0
|
||||
|
||||
BIN
misc/multitouch_view/icon.png
Normal file
BIN
misc/multitouch_view/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
28
misc/multitouch_view/project.godot
Normal file
28
misc/multitouch_view/project.godot
Normal file
@@ -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=3
|
||||
|
||||
[application]
|
||||
|
||||
config/name="TouchesView"
|
||||
run/main_scene="res://Main.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
TouchHelper="*res://TouchHelper.gd"
|
||||
|
||||
[gdnative]
|
||||
|
||||
singletons=[ ]
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_clear_color=Color( 0.113725, 0.133333, 0.196078, 1 )
|
||||
environment/default_environment="res://default_env.tres"
|
||||
37
visual_script/circle_pop/Circle.tscn
Normal file
37
visual_script/circle_pop/Circle.tscn
Normal file
@@ -0,0 +1,37 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://white-circle.png" type="Texture" id=1]
|
||||
[ext_resource path="res://CircleArea.vs" type="Script" id=2]
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id=1]
|
||||
|
||||
render_priority = 0
|
||||
blend_mode = 1
|
||||
light_mode = 0
|
||||
|
||||
[sub_resource type="CircleShape2D" id=2]
|
||||
|
||||
custom_solver_bias = 0.0
|
||||
radius = 128.0
|
||||
|
||||
[node name="Sprite" type="Sprite"]
|
||||
|
||||
material = SubResource( 1 )
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
input_pickable = true
|
||||
gravity_vec = Vector2( 0, 1 )
|
||||
gravity = 98.0
|
||||
linear_damp = 0.1
|
||||
angular_damp = 1.0
|
||||
audio_bus_override = false
|
||||
audio_bus_name = "Master"
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
|
||||
shape = SubResource( 2 )
|
||||
|
||||
|
||||
BIN
visual_script/circle_pop/CircleArea.vs
Normal file
BIN
visual_script/circle_pop/CircleArea.vs
Normal file
Binary file not shown.
18
visual_script/circle_pop/Main.tscn
Normal file
18
visual_script/circle_pop/Main.tscn
Normal file
@@ -0,0 +1,18 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Main.vs" type="Script" id=1]
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
|
||||
process_mode = 1
|
||||
wait_time = 1.0
|
||||
one_shot = false
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
|
||||
|
||||
BIN
visual_script/circle_pop/Main.vs
Normal file
BIN
visual_script/circle_pop/Main.vs
Normal file
Binary file not shown.
101
visual_script/circle_pop/default_env.tres
Normal file
101
visual_script/circle_pop/default_env.tres
Normal file
@@ -0,0 +1,101 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
radiance_size = 4
|
||||
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 )
|
||||
sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 )
|
||||
sky_curve = 0.25
|
||||
sky_energy = 1.0
|
||||
ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 )
|
||||
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 )
|
||||
ground_curve = 0.01
|
||||
ground_energy = 1.0
|
||||
sun_color = Color( 1, 1, 1, 1 )
|
||||
sun_latitude = 35.0
|
||||
sun_longitude = 0.0
|
||||
sun_angle_min = 1.0
|
||||
sun_angle_max = 100.0
|
||||
sun_curve = 0.05
|
||||
sun_energy = 16.0
|
||||
texture_size = 2
|
||||
|
||||
[resource]
|
||||
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
background_sky_custom_fov = 0.0
|
||||
background_color = Color( 0, 0, 0, 1 )
|
||||
background_energy = 1.0
|
||||
background_canvas_max_layer = 0
|
||||
ambient_light_color = Color( 0, 0, 0, 1 )
|
||||
ambient_light_energy = 1.0
|
||||
ambient_light_sky_contribution = 1.0
|
||||
fog_enabled = false
|
||||
fog_color = Color( 0.5, 0.6, 0.7, 1 )
|
||||
fog_sun_color = Color( 1, 0.9, 0.7, 1 )
|
||||
fog_sun_amount = 0.0
|
||||
fog_depth_enabled = true
|
||||
fog_depth_begin = 10.0
|
||||
fog_depth_curve = 1.0
|
||||
fog_transmit_enabled = false
|
||||
fog_transmit_curve = 1.0
|
||||
fog_height_enabled = false
|
||||
fog_height_min = 0.0
|
||||
fog_height_max = 100.0
|
||||
fog_height_curve = 1.0
|
||||
tonemap_mode = 0
|
||||
tonemap_exposure = 1.0
|
||||
tonemap_white = 1.0
|
||||
auto_exposure_enabled = false
|
||||
auto_exposure_scale = 0.4
|
||||
auto_exposure_min_luma = 0.05
|
||||
auto_exposure_max_luma = 8.0
|
||||
auto_exposure_speed = 0.5
|
||||
ss_reflections_enabled = false
|
||||
ss_reflections_max_steps = 64
|
||||
ss_reflections_fade_in = 0.15
|
||||
ss_reflections_fade_out = 2.0
|
||||
ss_reflections_depth_tolerance = 0.2
|
||||
ss_reflections_roughness = true
|
||||
ssao_enabled = false
|
||||
ssao_radius = 1.0
|
||||
ssao_intensity = 1.0
|
||||
ssao_radius2 = 0.0
|
||||
ssao_intensity2 = 1.0
|
||||
ssao_bias = 0.01
|
||||
ssao_light_affect = 0.0
|
||||
ssao_color = Color( 0, 0, 0, 1 )
|
||||
ssao_quality = 0
|
||||
ssao_blur = 3
|
||||
ssao_edge_sharpness = 4.0
|
||||
dof_blur_far_enabled = false
|
||||
dof_blur_far_distance = 10.0
|
||||
dof_blur_far_transition = 5.0
|
||||
dof_blur_far_amount = 0.1
|
||||
dof_blur_far_quality = 1
|
||||
dof_blur_near_enabled = false
|
||||
dof_blur_near_distance = 2.0
|
||||
dof_blur_near_transition = 1.0
|
||||
dof_blur_near_amount = 0.1
|
||||
dof_blur_near_quality = 1
|
||||
glow_enabled = false
|
||||
glow_levels/1 = false
|
||||
glow_levels/2 = false
|
||||
glow_levels/3 = true
|
||||
glow_levels/4 = false
|
||||
glow_levels/5 = true
|
||||
glow_levels/6 = false
|
||||
glow_levels/7 = false
|
||||
glow_intensity = 0.8
|
||||
glow_strength = 1.0
|
||||
glow_bloom = 0.0
|
||||
glow_blend_mode = 2
|
||||
glow_hdr_threshold = 1.0
|
||||
glow_hdr_scale = 2.0
|
||||
glow_bicubic_upscale = false
|
||||
adjustment_enabled = false
|
||||
adjustment_brightness = 1.0
|
||||
adjustment_contrast = 1.0
|
||||
adjustment_saturation = 1.0
|
||||
|
||||
BIN
visual_script/circle_pop/icon.png
Normal file
BIN
visual_script/circle_pop/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
24
visual_script/circle_pop/project.godot
Normal file
24
visual_script/circle_pop/project.godot
Normal file
@@ -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=3
|
||||
|
||||
[application]
|
||||
|
||||
config/name="CirclePop"
|
||||
run/main_scene="res://Main.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[gdnative]
|
||||
|
||||
singletons=[ ]
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_clear_color=Color( 0.113725, 0.133333, 0.196078, 1 )
|
||||
environment/default_environment="res://default_env.tres"
|
||||
BIN
visual_script/circle_pop/white-circle.png
Normal file
BIN
visual_script/circle_pop/white-circle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
9
visual_script/multitouch_view/Main.tscn
Normal file
9
visual_script/multitouch_view/Main.tscn
Normal file
@@ -0,0 +1,9 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Main.vs" type="Script" id=1]
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
|
||||
script = ExtResource( 1 )
|
||||
|
||||
|
||||
BIN
visual_script/multitouch_view/Main.vs
Normal file
BIN
visual_script/multitouch_view/Main.vs
Normal file
Binary file not shown.
43
visual_script/multitouch_view/TouchHelper.gd
Normal file
43
visual_script/multitouch_view/TouchHelper.gd
Normal file
@@ -0,0 +1,43 @@
|
||||
# This will track the position of every pointer in its public `state` property, which is a
|
||||
# Dictionary, in which each key is a pointer id (integer) and each value its position (Vector2).
|
||||
# It works by listening to input events not handled by other means.
|
||||
# It also remaps the pointer indices coming from the OS to the lowest available to be friendlier.
|
||||
# It can be conveniently setup as a singleton.
|
||||
|
||||
extends Node
|
||||
|
||||
var state = {}
|
||||
var _os2own = {}
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventScreenTouch:
|
||||
if event.pressed:
|
||||
# Down
|
||||
if !_os2own.has(event.index): # Defensively discard index if already known
|
||||
var ptr_id = _find_free_pointer_id()
|
||||
state[ptr_id] = event.position
|
||||
_os2own[event.index] = ptr_id
|
||||
else:
|
||||
# Up
|
||||
if _os2own.has(event.index): # Defensively discard index if not known
|
||||
var ptr_id = _os2own[event.index]
|
||||
state.erase(ptr_id)
|
||||
_os2own.erase(event.index)
|
||||
return true
|
||||
|
||||
elif event is InputEventScreenDrag:
|
||||
# Move
|
||||
if _os2own.has(event.index): # Defensively discard index if not known
|
||||
var ptr_id = _os2own[event.index]
|
||||
state[ptr_id] = event.position
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
func _find_free_pointer_id():
|
||||
var used = state.keys()
|
||||
var i = 0
|
||||
while i in used:
|
||||
i += 1
|
||||
return i
|
||||
|
||||
101
visual_script/multitouch_view/default_env.tres
Normal file
101
visual_script/multitouch_view/default_env.tres
Normal file
@@ -0,0 +1,101 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
radiance_size = 4
|
||||
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 )
|
||||
sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 )
|
||||
sky_curve = 0.25
|
||||
sky_energy = 1.0
|
||||
ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 )
|
||||
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 )
|
||||
ground_curve = 0.01
|
||||
ground_energy = 1.0
|
||||
sun_color = Color( 1, 1, 1, 1 )
|
||||
sun_latitude = 35.0
|
||||
sun_longitude = 0.0
|
||||
sun_angle_min = 1.0
|
||||
sun_angle_max = 100.0
|
||||
sun_curve = 0.05
|
||||
sun_energy = 16.0
|
||||
texture_size = 2
|
||||
|
||||
[resource]
|
||||
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
background_sky_custom_fov = 0.0
|
||||
background_color = Color( 0, 0, 0, 1 )
|
||||
background_energy = 1.0
|
||||
background_canvas_max_layer = 0
|
||||
ambient_light_color = Color( 0, 0, 0, 1 )
|
||||
ambient_light_energy = 1.0
|
||||
ambient_light_sky_contribution = 1.0
|
||||
fog_enabled = false
|
||||
fog_color = Color( 0.5, 0.6, 0.7, 1 )
|
||||
fog_sun_color = Color( 1, 0.9, 0.7, 1 )
|
||||
fog_sun_amount = 0.0
|
||||
fog_depth_enabled = true
|
||||
fog_depth_begin = 10.0
|
||||
fog_depth_curve = 1.0
|
||||
fog_transmit_enabled = false
|
||||
fog_transmit_curve = 1.0
|
||||
fog_height_enabled = false
|
||||
fog_height_min = 0.0
|
||||
fog_height_max = 100.0
|
||||
fog_height_curve = 1.0
|
||||
tonemap_mode = 0
|
||||
tonemap_exposure = 1.0
|
||||
tonemap_white = 1.0
|
||||
auto_exposure_enabled = false
|
||||
auto_exposure_scale = 0.4
|
||||
auto_exposure_min_luma = 0.05
|
||||
auto_exposure_max_luma = 8.0
|
||||
auto_exposure_speed = 0.5
|
||||
ss_reflections_enabled = false
|
||||
ss_reflections_max_steps = 64
|
||||
ss_reflections_fade_in = 0.15
|
||||
ss_reflections_fade_out = 2.0
|
||||
ss_reflections_depth_tolerance = 0.2
|
||||
ss_reflections_roughness = true
|
||||
ssao_enabled = false
|
||||
ssao_radius = 1.0
|
||||
ssao_intensity = 1.0
|
||||
ssao_radius2 = 0.0
|
||||
ssao_intensity2 = 1.0
|
||||
ssao_bias = 0.01
|
||||
ssao_light_affect = 0.0
|
||||
ssao_color = Color( 0, 0, 0, 1 )
|
||||
ssao_quality = 0
|
||||
ssao_blur = 3
|
||||
ssao_edge_sharpness = 4.0
|
||||
dof_blur_far_enabled = false
|
||||
dof_blur_far_distance = 10.0
|
||||
dof_blur_far_transition = 5.0
|
||||
dof_blur_far_amount = 0.1
|
||||
dof_blur_far_quality = 1
|
||||
dof_blur_near_enabled = false
|
||||
dof_blur_near_distance = 2.0
|
||||
dof_blur_near_transition = 1.0
|
||||
dof_blur_near_amount = 0.1
|
||||
dof_blur_near_quality = 1
|
||||
glow_enabled = false
|
||||
glow_levels/1 = false
|
||||
glow_levels/2 = false
|
||||
glow_levels/3 = true
|
||||
glow_levels/4 = false
|
||||
glow_levels/5 = true
|
||||
glow_levels/6 = false
|
||||
glow_levels/7 = false
|
||||
glow_intensity = 0.8
|
||||
glow_strength = 1.0
|
||||
glow_bloom = 0.0
|
||||
glow_blend_mode = 2
|
||||
glow_hdr_threshold = 1.0
|
||||
glow_hdr_scale = 2.0
|
||||
glow_bicubic_upscale = false
|
||||
adjustment_enabled = false
|
||||
adjustment_brightness = 1.0
|
||||
adjustment_contrast = 1.0
|
||||
adjustment_saturation = 1.0
|
||||
|
||||
BIN
visual_script/multitouch_view/icon.png
Normal file
BIN
visual_script/multitouch_view/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
28
visual_script/multitouch_view/project.godot
Normal file
28
visual_script/multitouch_view/project.godot
Normal file
@@ -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=3
|
||||
|
||||
[application]
|
||||
|
||||
config/name="TouchesView"
|
||||
run/main_scene="res://Main.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
TouchHelper="*res://TouchHelper.gd"
|
||||
|
||||
[gdnative]
|
||||
|
||||
singletons=[ ]
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_clear_color=Color( 0.113725, 0.133333, 0.196078, 1 )
|
||||
environment/default_environment="res://default_env.tres"
|
||||
Reference in New Issue
Block a user