diff --git a/README.md b/README.md index bb74b9a..cc012b5 100644 --- a/README.md +++ b/README.md @@ -1 +1,42 @@ # TimeCrafters Configuration Tool for Desktop +A desktop app for editing, either locally or remotely, JSON configuration files on the Robot Controller/Rev Control Hub. + +![Screenshot of Editor](https://raw.githubusercontent.com/TimeCrafters/timecrafters_configuration_tool_desktop/master/media/screenshots/screenshot_editor.png) + +## Features +* TACNET - **T**imeCrafters **A**uxiliary **C**onfiguration **NET**work. + * Enables syncing configurations between devices. + +* Multiple Configurations + * Create multiple configurations for specific robots/projects. + +* Presets + * Save Groups or Actions as Presets to quickly add pre-configurated Groups and Actions. + +* Search + * Search through the active configurations Groups, Actions, Variables and Presets. + +* Built-in practice clock + * Supports multiple screens or network remote control. + * Supports official clock sounds (must be added manually.) + * Built-in jukebox. + +* Simulator + * Create a simple 2D simulation of your robot's path. + +* Field Planner + * Estimate distances on the field using imperial or metric units. + +## Usage +* Download from [Releases](https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop/releases/latest) + +## Developing +* Install [Ruby](https://ruby-lang.org) +* Run `bundle install` +* Run `bundle exec ruby timecrafters_configuration_tool.rb` + +## Contributing +* Clone this repo and create a new branch for your feature/patch. +* Author your changes +* Commit your changes and push to your fork +* Open a pull request diff --git a/lib/game_clock/particle_emitter.rb b/lib/game_clock/particle_emitter.rb index d6a91bc..9adf37c 100644 --- a/lib/game_clock/particle_emitter.rb +++ b/lib/game_clock/particle_emitter.rb @@ -71,6 +71,10 @@ module TAC end end + def particle_count + @particles.size + end + def clock_active! @clock_active = true @particles.each(&:clock_active!) diff --git a/lib/game_clock/view.rb b/lib/game_clock/view.rb index efba8e6..eef790f 100644 --- a/lib/game_clock/view.rb +++ b/lib/game_clock/view.rb @@ -17,6 +17,7 @@ module TAC @clock = Clock.new @clock.controller = nil @last_clock_display_value = @clock.value + @last_clock_title_value = @clock.title.text @particle_emitters = [ PracticeGameClock::ParticleEmitter.new @@ -72,17 +73,17 @@ module TAC stack width: 0.4, padding_left: 50 do background @menu_background - flow do + flow(width: 1.0) do label "♫ Now playing:" @current_song_label = label "♫ ♫ ♫" end - flow do + flow(width: 1.0) do label "Volume:" @current_volume_label = label "100%" end - flow do + flow(width: 1.0) do button get_image("#{ROOT_PATH}/media/icons/previous.png") do @jukebox.previous_track end @@ -137,7 +138,7 @@ module TAC end end - stack width: 1.0 do + stack(width: 1.0) do button "Randomizer", width: 1.0, **TAC::THEME_DANGER_BUTTON do unless @clock.active? push_state(Randomizer) @@ -195,11 +196,19 @@ module TAC if @clock.value != @last_clock_display_value @last_clock_display_value = @clock.value + request_repaint + if @remote_control_mode && @server.active_client @server.active_client.puts(ClockNet::PacketHandler.packet_clock_time(@last_clock_display_value)) end end + if @clock.title.text != @last_clock_title_value + @last_clock_title_value = @clock.title.text + + request_repaint + end + if @last_track_name != @jukebox.current_track track_changed(@jukebox.current_track) end @@ -213,6 +222,14 @@ module TAC @last_clock_state = @clock.active? end + def request_repaint + if @particle_emitters && @particle_emitters.map(&:particle_count).sum.positive? + true + else + super + end + end + def update_non_gui if @remote_control_mode while (o = RemoteControl.server.proxy_object.queue.shift) diff --git a/lib/pages/drive_team_rotation_generator.rb b/lib/pages/drive_team_rotation_generator.rb index 8a0643a..2d55489 100644 --- a/lib/pages/drive_team_rotation_generator.rb +++ b/lib/pages/drive_team_rotation_generator.rb @@ -7,18 +7,20 @@ module TAC header_bar("Drive Team Rotation Generator") @roster ||= [ - "Alexander", "Aubrey", "Cayden", + "Dan", "Gabe", "Spencer", - "Olivia" + "Sodi", + "Trent" ] @roles ||= [ "Coach", "Driver A", - "Driver B" + "Driver B", + "Human" ] menu_bar.clear do @@ -37,12 +39,12 @@ module TAC body.clear do flow(margin_left: 20, width: 1.0, height: 1.0) do - stack(width: 0.25) do + stack(width: 0.25, height: 1.0) do title "Roles", width: 1.0, margin_bottom: 4, text_align: :center - flow(width: 1.0, margin_bottom: 20) do - @role_name = edit_line "", placeholder: "Add role", width: 0.9 - button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: 0.1, tip: "Add role" do + flow(width: 1.0, height: 32, margin_bottom: 20) do + @role_name = edit_line "", placeholder: "Add role", fill: true, height: 1.0 + button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_height: 1.0, tip: "Add role" do if @role_name.value.strip.length.positive? @roles.push(@role_name.value.strip) @role_name.value = "" @@ -52,16 +54,16 @@ module TAC end end - @roles_container = stack(width: 1.0, height: 0.835, scroll: true) do + @roles_container = stack(width: 1.0, fill: true, scroll: true) do end end stack(margin_left: 20, width: 0.25, height: 1.0) do title "Roster", width: 1.0, margin_bottom: 4, text_align: :center - flow(width: 1.0, margin_bottom: 20) do - @roster_name = edit_line "", placeholder: "Add name", width: 0.9 - button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: 0.1, tip: "Add name" do + flow(width: 1.0, height: 32, margin_bottom: 20) do + @roster_name = edit_line "", placeholder: "Add name", height: 1.0, fill: true + button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_height: 1.0, tip: "Add name" do if @roster_name.value.strip.length.positive? @roster.push(@roster_name.value.strip) @roster_name.value = "" @@ -71,14 +73,14 @@ module TAC end end - @roster_container = stack(width: 1.0, height: 0.835, scroll: true) do + @roster_container = stack(width: 1.0, fill: true, scroll: true) do end end - stack(margin_left: 20, margin_right: 20, width: 0.5, height: 1.0) do + stack(margin_left: 20, margin_right: 20, fill: true, height: 1.0) do title "Rotation", width: 1.0, margin_bottom: 4, text_align: :center - @rotation_container = stack(width: 1.0, height: 0.835, scroll: true) do + @rotation_container = stack(width: 1.0, fill: true, scroll: true) do end end end @@ -92,11 +94,11 @@ module TAC def populate_roles @roles_container.clear do @roles.each_with_index do |name, i| - flow(width: 1.0, padding: 2) do + flow(width: 1.0, height: 32, padding: 2) do background i.even? ? 0xff_007000 : 0xff_006000 - tagline name, width: 0.9 - button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: 0.1, tip: "Remove role", **THEME_DANGER_BUTTON do + tagline name, fill: true + button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_height: 1.0, tip: "Remove role", **THEME_DANGER_BUTTON do @roles.delete(name) populate_roles end @@ -108,11 +110,11 @@ module TAC def populate_roster @roster_container.clear do @roster.each_with_index do |name, i| - flow(width: 1.0, padding: 2) do + flow(width: 1.0, height: 32, padding: 2) do background i.even? ? 0xff_007000 : 0xff_006000 - tagline name, width: 0.9 - button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: 0.1, tip: "Remove name", **THEME_DANGER_BUTTON do + tagline name, fill: true + button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_height: 1.0, tip: "Remove name", **THEME_DANGER_BUTTON do @roster.delete(name) populate_roster end @@ -125,13 +127,11 @@ module TAC @rotation = Generator.new(roster: @roster, team_size: @roles.count) @rotation_container.clear do - fraction = (1.0 / @rotation.team_size) - 0.02 - - flow(width: 1.0, padding: 2) do + flow(width: 1.0, height: 32, padding: 2) do background Gosu::Color::BLACK @roles.each do |role| - tagline "#{role}", width: fraction + tagline "#{role}", fill: true end end @@ -139,11 +139,11 @@ module TAC teams = @rotation.teams.shuffle if @shuffle_teams&.value teams.each_with_index do |team, i| - flow(width: 1.0, padding: 2) do + flow(width: 1.0, height: 32, padding: 2) do background i.even? ? 0xff_007000 : 0xff_006000 team.each do |player| - tagline player, width: fraction + tagline player, fill: true end end end diff --git a/media/screenshots/screenshot_editor.png b/media/screenshots/screenshot_editor.png new file mode 100644 index 0000000..bbbd449 Binary files /dev/null and b/media/screenshots/screenshot_editor.png differ