Updated theming, added dangerous (red) button style, replaced Simulator edit_line with edit_box, tweaked various styles

This commit is contained in:
2020-06-16 00:08:56 -05:00
parent 79b53fdd7a
commit b19826d51f
10 changed files with 142 additions and 111 deletions

View File

@@ -5,9 +5,9 @@ module TAC
theme(THEME)
stack width: 1.0, height: 0.1 do
background [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY]
label "#{TAC::NAME} ― Simulator", text_size: 28, color: Gosu::Color::BLACK
button "Close", text_size: 18 do
background THEME_HEADER_BACKGROUND
label "#{TAC::NAME} ― Simulator", bold: true, text_size: THEME_HEADING_TEXT_SIZE
button "Close" do
pop_state
end
end
@@ -21,20 +21,24 @@ module TAC
background Gosu::Color.new(0x88_ff8800)
flow width: 1.0, height: 0.05 do
button get_image("#{TAC::ROOT_PATH}/media/icons/right.png"), image_width: 18, width: 0.49 do
@simulation = TAC::Simulator::Simulation.new(source_code: @source_code.value, field_container: @field_container)
@simulation.__start
button get_image("#{TAC::ROOT_PATH}/media/icons/right.png"), image_width: THEME_ICON_SIZE, width: 0.49 do
begin
@simulation = TAC::Simulator::Simulation.new(source_code: @source_code.value, field_container: @field_container)
@simulation.__start
rescue SyntaxError, NameError, NoMethodError, TypeError, ArgumentError => e
push_state(Dialog::AlertDialog, title: "#{e.class}", message: e)
end
end
button get_image("#{TAC::ROOT_PATH}/media/icons/stop.png"), image_width: 18, width: 0.49 do
button get_image("#{TAC::ROOT_PATH}/media/icons/stop.png"), image_width: THEME_ICON_SIZE, width: 0.49 do
@simulation.__queue.clear if @simulation
end
button get_image("#{TAC::ROOT_PATH}/media/icons/save.png"), image_width: 18, width: 0.49
button get_image("#{TAC::ROOT_PATH}/media/icons/save.png"), image_width: THEME_ICON_SIZE, width: 0.49
@simulation_status = label "", text_size:18
@simulation_status = label ""
end
stack width: 1.0, height: 0.95 do
@source_code = edit_line "backward 100; turn 90; forward 100; turn -90; forward 100; turn -90; forward 100", width: 1.0, height: 1.0, text_size: 18
@source_code = edit_box "backward 100\nturn 90\nforward 100\nturn -90\nforward 100\nturn -90\nforward 100", width: 1.0, height: 1.0
end
end
end