Added autofocus to edit dialogs first editline, added tab support for selecting next focusable element in edit dialogs, made valid? method be called in edit dialogs when fields change, simulator robot can now strafe side to side

This commit is contained in:
2021-02-11 09:28:04 -06:00
parent 3cc4c204a7
commit 75d6de0b00
6 changed files with 112 additions and 5 deletions

View File

@@ -7,6 +7,8 @@ module TAC
menu_bar.clear do
button get_image("#{TAC::ROOT_PATH}/media/icons/right.png"), tip: "Run Simulation", image_height: 1.0 do
save_source
begin
@simulation_start_time = Gosu.milliseconds
@simulation = TAC::Simulator::Simulation.new(source_code: @source_code.value, field_container: @field_container)
@@ -23,8 +25,7 @@ module TAC
end
button get_image("#{TAC::ROOT_PATH}/media/icons/save.png"), tip: "Save", image_height: 1.0 do
File.open(SOURCE_FILE_PATH, "w") { |f| f.write @source_code.value }
@simulation_status.value = "Saved source to #{SOURCE_FILE_PATH}"
save_source
end
end
@@ -57,8 +58,14 @@ robot.forward 100"
end
end
def save_source
File.open(SOURCE_FILE_PATH, "w") { |f| f.write @source_code.value }
@simulation_status.value = "Saved source to #{SOURCE_FILE_PATH}"
end
def blur
@simulation.robots.each { |robot| robot.queue.clear } if @simulation
save_source
end
def draw