Redid math to a zero center
This commit is contained in:
parent
d1d68d1cdd
commit
3ed63d81b9
25
Bezel.gd
25
Bezel.gd
|
@ -1,27 +1,28 @@
|
||||||
extends "res://main.gd"
|
extends "res://main.gd"
|
||||||
|
|
||||||
# Draw the bezel for radial gamemode
|
# Draw the bezel for radial gamemode
|
||||||
|
var center := Vector2(0.0, 0.0)
|
||||||
|
|
||||||
func _draw():
|
func _draw():
|
||||||
var bezel_color := Color.black
|
var bezel_colors := PoolColorArray([theme.bezel_color])
|
||||||
var bezel_colors := PoolColorArray([bezel_color])
|
|
||||||
var bezel_points: PoolVector2Array
|
var bezel_points: PoolVector2Array
|
||||||
|
var screen_height2 := screen_height/2.0
|
||||||
|
|
||||||
draw_rect(Rect2(0, 0, x_margin, screen_height), bezel_color)
|
draw_rect(Rect2(-screen_height2, -screen_height2, -x_margin, screen_height), theme.bezel_color)
|
||||||
draw_rect(Rect2(1920-x_margin, 0, x_margin, screen_height), bezel_color)
|
draw_rect(Rect2(screen_height2, -screen_height2, x_margin, screen_height), theme.bezel_color)
|
||||||
|
|
||||||
bezel_points = arc_point_list(screen_center, screen_height/2, 0, -90)
|
bezel_points = arc_point_list(center, screen_height2, 0, -90)
|
||||||
bezel_points.push_back(Vector2(1920-x_margin, 0))
|
bezel_points.push_back(Vector2(screen_height2, -screen_height2))
|
||||||
draw_polygon(bezel_points, bezel_colors)
|
draw_polygon(bezel_points, bezel_colors)
|
||||||
|
|
||||||
bezel_points = arc_point_list(screen_center, screen_height/2, -90, -180)
|
bezel_points = arc_point_list(center, screen_height2, -90, -180)
|
||||||
bezel_points.push_back(Vector2(x_margin, 0))
|
bezel_points.push_back(Vector2(-screen_height2, -screen_height2))
|
||||||
draw_polygon(bezel_points, bezel_colors)
|
draw_polygon(bezel_points, bezel_colors)
|
||||||
|
|
||||||
bezel_points = arc_point_list(screen_center, screen_height/2, -180, -270)
|
bezel_points = arc_point_list(center, screen_height2, -180, -270)
|
||||||
bezel_points.push_back(Vector2(x_margin, screen_height))
|
bezel_points.push_back(Vector2(-screen_height2, screen_height2))
|
||||||
draw_polygon(bezel_points, bezel_colors)
|
draw_polygon(bezel_points, bezel_colors)
|
||||||
|
|
||||||
bezel_points = arc_point_list(screen_center, screen_height/2, -270, -360)
|
bezel_points = arc_point_list(center, screen_height2, -270, -360)
|
||||||
bezel_points.push_back(Vector2(1920-x_margin, screen_height))
|
bezel_points.push_back(Vector2(screen_height2, screen_height2))
|
||||||
draw_polygon(bezel_points, bezel_colors)
|
draw_polygon(bezel_points, bezel_colors)
|
||||||
|
|
12
Receptors.gd
12
Receptors.gd
|
@ -4,15 +4,15 @@ var ring_px := 4
|
||||||
var receptor_px := 24
|
var receptor_px := 24
|
||||||
var shadow_px := 5
|
var shadow_px := 5
|
||||||
var shadow_color := Color.black
|
var shadow_color := Color.black
|
||||||
var receptor_color := Color.blue
|
var center := Vector2(0.0, 0.0)
|
||||||
|
|
||||||
func _draw():
|
func _draw():
|
||||||
# Screen filter
|
# Screen filter
|
||||||
draw_rect(Rect2(x_margin, 0, screen_height, screen_height), theme.screen_filter)
|
draw_rect(Rect2(-screen_height/2, -screen_height/2, screen_height, screen_height), theme.screen_filter)
|
||||||
|
|
||||||
# Receptor ring
|
# Receptor ring
|
||||||
var receptor_circle := arc_point_list(screen_center, theme.receptor_ring_radius, 0.0, 360.0, 360)
|
var receptor_circle := arc_point_list(center, theme.receptor_ring_radius, 0.0, 360.0, 360)
|
||||||
var receptor_centers := arc_point_list(screen_center, theme.receptor_ring_radius, Rules.FIRST_COLUMN_ANGLE_DEG, Rules.FIRST_COLUMN_ANGLE_DEG+360.0-Rules.COLS_ANGLE_DEG, Rules.COLS)
|
var receptor_centers := arc_point_list(center, theme.receptor_ring_radius, Rules.FIRST_COLUMN_ANGLE_DEG, Rules.FIRST_COLUMN_ANGLE_DEG+360.0-Rules.COLS_ANGLE_DEG, Rules.COLS)
|
||||||
|
|
||||||
# Shadows
|
# Shadows
|
||||||
for i in range(len(receptor_circle)-1):
|
for i in range(len(receptor_circle)-1):
|
||||||
|
@ -22,7 +22,7 @@ func _draw():
|
||||||
|
|
||||||
# Foregrounds
|
# Foregrounds
|
||||||
for i in range(len(receptor_circle)-1):
|
for i in range(len(receptor_circle)-1):
|
||||||
draw_line(receptor_circle[i], receptor_circle[i+1], receptor_color, ring_px, true)
|
draw_line(receptor_circle[i], receptor_circle[i+1], theme.receptor_color, ring_px, true)
|
||||||
for i in range(len(receptor_centers)):
|
for i in range(len(receptor_centers)):
|
||||||
draw_circle(receptor_centers[i], receptor_px/2, receptor_color)
|
draw_circle(receptor_centers[i], receptor_px/2, theme.receptor_color)
|
||||||
|
|
||||||
|
|
18
main.tscn
18
main.tscn
|
@ -31,12 +31,17 @@ shader_param/held_color = null
|
||||||
shader_param/screen_size = null
|
shader_param/screen_size = null
|
||||||
|
|
||||||
[node name="main" type="Node2D"]
|
[node name="main" type="Node2D"]
|
||||||
|
position = Vector2( 960, 540 )
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_vertical_guides_": [ 1450.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
[node name="video" type="VideoPlayer" parent="."]
|
[node name="video" type="VideoPlayer" parent="."]
|
||||||
margin_left = 420.0
|
margin_left = -540.0
|
||||||
margin_right = 1500.0
|
margin_top = -540.0
|
||||||
margin_bottom = 1080.0
|
margin_right = 540.0
|
||||||
|
margin_bottom = 540.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
rect_pivot_offset = Vector2( 540, 540 )
|
rect_pivot_offset = Vector2( 540, 540 )
|
||||||
|
@ -52,7 +57,6 @@ __meta__ = {
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 4 )
|
||||||
|
|
||||||
[node name="NoteHandler" type="Node2D" parent="."]
|
[node name="NoteHandler" type="Node2D" parent="."]
|
||||||
position = Vector2( 960, 540 )
|
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
|
|
||||||
[node name="SlideTrailHandler" type="Node2D" parent="NoteHandler"]
|
[node name="SlideTrailHandler" type="Node2D" parent="NoteHandler"]
|
||||||
|
@ -67,8 +71,10 @@ material = SubResource( 2 )
|
||||||
script = ExtResource( 8 )
|
script = ExtResource( 8 )
|
||||||
|
|
||||||
[node name="InputHandler" type="Label" parent="."]
|
[node name="InputHandler" type="Label" parent="."]
|
||||||
margin_right = 424.0
|
margin_left = -960.0
|
||||||
margin_bottom = 216.0
|
margin_top = -540.0
|
||||||
|
margin_right = 960.0
|
||||||
|
margin_bottom = 540.0
|
||||||
custom_fonts/font = ExtResource( 9 )
|
custom_fonts/font = ExtResource( 9 )
|
||||||
text = "Fingers on the screen:"
|
text = "Fingers on the screen:"
|
||||||
script = ExtResource( 10 )
|
script = ExtResource( 10 )
|
||||||
|
|
2
theme.gd
2
theme.gd
|
@ -34,6 +34,8 @@ var COLOR_ARRAY_DOUBLE_8 := PoolColorArray([
|
||||||
])
|
])
|
||||||
|
|
||||||
var screen_filter := Color(0.0, 0.0, 0.0, 0.2)
|
var screen_filter := Color(0.0, 0.0, 0.0, 0.2)
|
||||||
|
var receptor_color := Color.blue
|
||||||
|
var bezel_color := Color.black
|
||||||
|
|
||||||
var RADIAL_COL_ANGLES := PoolRealArray() # ideally const
|
var RADIAL_COL_ANGLES := PoolRealArray() # ideally const
|
||||||
var RADIAL_UNIT_VECTORS := PoolVector2Array() # ideally const
|
var RADIAL_UNIT_VECTORS := PoolVector2Array() # ideally const
|
||||||
|
|
4
video.gd
4
video.gd
|
@ -9,5 +9,5 @@ func update_aspect_ratio(ratio: float):
|
||||||
# e.g. for a 1920x1080 video you'd call update_aspect_ratio(1920.0/1080.0)
|
# e.g. for a 1920x1080 video you'd call update_aspect_ratio(1920.0/1080.0)
|
||||||
# e.g. for a 1440x1080 video you'd call update_aspect_ratio(1440.0/1080.0)
|
# e.g. for a 1440x1080 video you'd call update_aspect_ratio(1440.0/1080.0)
|
||||||
var height = 1080/ratio
|
var height = 1080/ratio
|
||||||
margin_top = (1080 - height)/2.0
|
margin_top = -height/2.0
|
||||||
margin_bottom = margin_top + height
|
margin_bottom = height/2.0
|
||||||
|
|
Loading…
Reference in New Issue