mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-24 16:20:08 +01:00
Only update graph when hitting button or sending command, for now
This commit is contained in:
parent
2a0e2e46bb
commit
5161a8563e
6 changed files with 31 additions and 14 deletions
13
arrow.gd
13
arrow.gd
|
@ -8,12 +8,13 @@ func _ready():
|
|||
pass
|
||||
|
||||
func _process(delta):
|
||||
var t = repository.objects[target]
|
||||
#print(t)
|
||||
$Line.points[1] = t.global_position - global_position
|
||||
$Label.position = ($Line.points[0] + $Line.points[1])/2
|
||||
$Tip.position = ($Line.points[0] + $Line.points[1])/2
|
||||
$Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1])
|
||||
if repository.objects.has(target):
|
||||
var t = repository.objects[target]
|
||||
#print(t)
|
||||
$Line.points[1] = t.global_position - global_position
|
||||
$Label.position = ($Line.points[0] + $Line.points[1])/2
|
||||
$Tip.position = ($Line.points[0] + $Line.points[1])/2
|
||||
$Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1])
|
||||
|
||||
func label_set(new_label):
|
||||
label = new_label
|
||||
|
|
3
main.gd
3
main.gd
|
@ -16,6 +16,9 @@ func _ready():
|
|||
server = TCP_Server.new()
|
||||
server.listen(1234)
|
||||
|
||||
# Load first level.
|
||||
load_level(0)
|
||||
|
||||
func list_levels():
|
||||
var levels = []
|
||||
var dir = Directory.new()
|
||||
|
|
13
node.gd
13
node.gd
|
@ -14,12 +14,13 @@ func _ready():
|
|||
|
||||
func _process(delta):
|
||||
for c in children.keys():
|
||||
var other = get_node("..").objects[c]
|
||||
var d = other.position.distance_to(position)
|
||||
var dir = (other.position - position).normalized()
|
||||
var f = (d*0.05)
|
||||
position += dir*f
|
||||
other.position -= dir*f
|
||||
if get_node("..").objects.has(c):
|
||||
var other = get_node("..").objects[c]
|
||||
var d = other.position.distance_to(position)
|
||||
var dir = (other.position - position).normalized()
|
||||
var f = (d*0.05)
|
||||
position += dir*f
|
||||
other.position -= dir*f
|
||||
|
||||
func id_set(new_id):
|
||||
id = new_id
|
||||
|
|
|
@ -10,20 +10,20 @@ func _ready():
|
|||
|
||||
func _process(delta):
|
||||
if path:
|
||||
update_everything()
|
||||
apply_forces()
|
||||
|
||||
func update_everything():
|
||||
update_head()
|
||||
update_refs()
|
||||
update_index()
|
||||
update_objects()
|
||||
apply_forces()
|
||||
|
||||
func set_path(new_path):
|
||||
path = new_path
|
||||
for o in objects.values():
|
||||
o.queue_free()
|
||||
objects = {}
|
||||
update_everything()
|
||||
|
||||
func get_path():
|
||||
return path
|
||||
|
|
|
@ -25,3 +25,14 @@ text = "Index:"
|
|||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
margin_left = 36.5602
|
||||
margin_top = 67.9891
|
||||
margin_right = 94.5602
|
||||
margin_bottom = 109.989
|
||||
text = "Update"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[connection signal="pressed" from="Button" to="." method="update_everything"]
|
||||
|
|
|
@ -12,3 +12,4 @@ func run_command_in_a_thread(command):
|
|||
$Input.text = ""
|
||||
$Output.text = $Output.text + "$ " + command + "\n" + output
|
||||
$Output.scroll_vertical = 999999
|
||||
$"../ActiveRepository".update_everything()
|
||||
|
|
Loading…
Reference in a new issue