Updated Field/Robot/Simulator to use parent container's z index to remove need for Gosu.flush and causing Field to be drawn on top of tooltip's and menus, Added Power Play field, replaced font, enabled static option for text to improve rendering appearance, misc. bug fixes and tweaks.

This commit is contained in:
2022-10-23 17:30:51 -05:00
parent 655b418d70
commit 66b0eb3d1e
24 changed files with 410 additions and 442 deletions

View File

@@ -5,51 +5,32 @@ module TAC
background Gosu::Color.new(0xaa_000000) background Gosu::Color.new(0xaa_000000)
@title = @options[:title] ? @options[:title] : "#{self.class}" @title = @options[:title] ? @options[:title] : "#{self.class}"
@window_width, @window_height = window.width, window.height
@previous_state = previous_state
@dialog_root = stack width: 0.25, border_thickness: 2, border_color: [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY] do @dialog_root = stack(width: 0.25, h_align: :center, v_align: :center, border_thickness: 2, border_color: [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY]) do
# Title bar # Title bar
@titlebar = flow width: 1.0 do @titlebar = flow(width: 1.0, height: 36) do
background [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY] background [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY]
# title label @title, text_size: THEME_SUBHEADING_TEXT_SIZE, font: TAC::THEME_BOLD_FONT, fill: true, text_align: :center, text_border: true, text_border_color: 0xaa_222222, text_border_size: 1
flow width: 0.9 do
label @title, text_size: THEME_SUBHEADING_TEXT_SIZE, width: 1.0, text_align: :center, text_border: true, text_border_color: 0xff_222222, text_border_size: 1
end
# Buttons button get_image("#{TAC::ROOT_PATH}/media/icons/cross.png"), image_height: 1.0, **THEME_DANGER_BUTTON do
flow width: 0.0999 do close
button get_image("#{TAC::ROOT_PATH}/media/icons/cross.png"), image_width: 1.0, **THEME_DANGER_BUTTON do
close
end
end end
end end
# Dialog body # Dialog body
@dialog_content = stack width: 1.0 do @dialog_content = stack(width: 1.0, scroll: true) do
end end
end end
@dialog_content.clear do @dialog_content.clear do
build build
end end
@root_container.recalculate
@root_container.recalculate
@root_container.recalculate
center_dialog
end end
def build def build
end end
def center_dialog
@dialog_root.style.x = window.width / 2 - @dialog_root.width / 2
@dialog_root.style.y = window.height / 2 - @dialog_root.height / 2
end
def name_filter(text) def name_filter(text)
text.match(/[A-Za-z0-9._\- ]/) ? text : "" text.match(/[A-Za-z0-9._\- ]/) ? text : ""
end end
@@ -90,24 +71,12 @@ module TAC
end end
def draw def draw
@previous_state.draw previous_state&.draw
Gosu.flush Gosu.flush
super super
end end
def update
super
if window.width != @window_width or window.height != @window_height
request_recalculate
@window_width, @window_height = window.width, window.height
end
center_dialog
end
def button_down(id) def button_down(id)
super super
@@ -122,7 +91,7 @@ module TAC
end end
def close def close
CyberarmEngine::Window.instance.pop_state pop_state
end end
end end
end end

View File

@@ -7,7 +7,7 @@ module TAC
label "Name", width: 1.0, text_align: :center label "Name", width: 1.0, text_align: :center
@name_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR @name_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error.hide @name_error.hide
@name = edit_line @options[:action] ? @options[:action].name : "", filter: method(:name_filter), width: 1.0, autofocus: true @name = edit_line @options[:action] ? @options[:action].name : "", filter: method(:name_filter), width: 1.0, autofocus: true, focus: true
@name.subscribe(:changed) do |sender, value| @name.subscribe(:changed) do |sender, value|
valid? valid?
end end

View File

@@ -22,17 +22,17 @@ module TAC
try_commit(true) try_commit(true)
end end
end end
end
def try_commit(force = false) def try_commit(force = false)
if !@dangerous if !@dangerous
close close
@options[:callback_method].call @options[:callback_method].call
elsif @dangerous && force elsif @dangerous && force
close close
@options[:callback_method].call @options[:callback_method].call
end
end end
end end
end end

View File

@@ -8,7 +8,7 @@ module TAC
label "Name", width: 1.0, text_align: :center label "Name", width: 1.0, text_align: :center
@name_error = label "", color: TAC::Palette::TACNET_CONNECTION_ERROR @name_error = label "", color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error.hide @name_error.hide
@name = edit_line @options[:renaming] ? @options[:renaming].name : "", filter: method(:name_filter), width: 1.0, autofocus: true @name = edit_line @options[:renaming] ? @options[:renaming].name : "", filter: method(:name_filter), width: 1.0, autofocus: true, focus: true
@name.subscribe(:changed) do |sender, value| @name.subscribe(:changed) do |sender, value|
valid? valid?

View File

@@ -9,7 +9,7 @@ module TAC
label "Name", width: 1.0, text_align: :center label "Name", width: 1.0, text_align: :center
@name_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR @name_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error.hide @name_error.hide
@name = edit_line @options[:variable] ? @options[:variable].name : "", filter: method(:name_filter), width: 1.0, autofocus: true @name = edit_line @options[:variable] ? @options[:variable].name : "", filter: method(:name_filter), width: 1.0, autofocus: true, focus: true
@name.subscribe(:changed) do |sender, value| @name.subscribe(:changed) do |sender, value|
valid? valid?
end end

View File

@@ -16,12 +16,14 @@ module TAC
end end
status_bar.clear do status_bar.clear do
label "Current Configuration: " flow(width: 1.0, max_width: 720, h_align: :center) do
@config_label = label window.backend.settings.config label "Current Configuration: "
@config_label = label window.backend.settings.config
end
end end
body.clear do body.clear do
@configs_list = stack width: 1.0, height: 1.0, scroll: true do @configs_list = stack width: 1.0, height: 1.0, margin_top: 36, max_width: 720, h_align: :center, scroll: true do
end end
end end
@@ -34,11 +36,12 @@ module TAC
@configs_list.clear do @configs_list.clear do
@config_files.each_with_index do |config_file, i| @config_files.each_with_index do |config_file, i|
flow width: 1.0, **THEME_ITEM_CONTAINER_PADDING do flow width: 1.0, height: 36, **THEME_ITEM_CONTAINER_PADDING do
background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
name = File.basename(config_file, ".json") name = File.basename(config_file, ".json")
background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR unless name == window.backend.settings.config
background THEME_HIGHLIGHTED_COLOR if name == window.backend.settings.config
button "#{name}", fill: true, text_size: THEME_ICON_SIZE - 3 do button "#{name}", fill: true, text_size: THEME_ICON_SIZE - 3 do
change_config(name) change_config(name)
@@ -92,6 +95,8 @@ module TAC
window.backend.load_config(name) window.backend.load_config(name)
@config_label.value = name.to_s @config_label.value = name.to_s
populate_configs
end end
end end
end end

View File

@@ -30,8 +30,8 @@ module TAC
body.clear do body.clear do
flow(width: 1.0, height: 1.0) do flow(width: 1.0, height: 1.0) do
stack width: 0.33333, height: 1.0, border_thickness_right: 1, border_color: [0, Gosu::Color::BLACK, 0, 0] do stack fill: true, height: 1.0, padding_left: 2, padding_right: 2, border_thickness_right: 1, border_color: Gosu::Color::BLACK do
@groups_menu = flow(width: 1.0) do @groups_menu = flow(width: 1.0, height: 36) do
label "Groups", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center label "Groups", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add group" do button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add group" do
@@ -84,12 +84,12 @@ module TAC
end end
end end
@groups_list = stack width: 1.0, scroll: true do @groups_list = stack width: 1.0, fill: true, scroll: true do
end end
end end
stack width: 0.33333, height: 1.0, border_thickness_right: 1, border_color: [0, Gosu::Color::BLACK, 0, 0] do stack fill: true, height: 1.0, padding_left: 2, padding_right: 2, border_thickness_right: 1, border_color: Gosu::Color::BLACK do
@actions_menu = flow(width: 1.0) do @actions_menu = flow(width: 1.0, height: 36) do
label "Actions", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center label "Actions", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add action" do button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add action" do
@@ -151,12 +151,12 @@ module TAC
end end
end end
@actions_list = stack width: 1.0, scroll: true do @actions_list = stack width: 1.0, fill: true, scroll: true do
end end
end end
stack width: 0.331, height: 1.0 do stack fill: true, height: 1.0, padding_left: 2, padding_right: 2 do
@variables_menu = flow(width: 1.0) do @variables_menu = flow(width: 1.0, height: 36) do
label "Variables", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center label "Variables", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add variable" do button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add variable" do
if @active_action if @active_action
@@ -167,7 +167,7 @@ module TAC
end end
end end
@variables_list = stack width: 1.0, scroll: true do @variables_list = stack width: 1.0, fill: true, scroll: true do
end end
end end
end end
@@ -210,16 +210,6 @@ module TAC
end end
end end
end end
body.root.subscribe(:window_size_changed) do
set_list_heights
end
end
def set_list_heights
@groups_list.style.height = body.height - @groups_menu.height
@actions_list.style.height = body.height - @actions_menu.height
@variables_list.style.height = body.height - @variables_menu.height
end end
def create_group(name) def create_group(name)
@@ -244,8 +234,10 @@ module TAC
window.backend.config_changed! window.backend.config_changed!
@active_group = nil @active_group = nil
@active_group_container = nil
@active_group_label.value = "" @active_group_label.value = ""
@active_action = nil @active_action = nil
@active_active_container = nil
@active_action_label.value = "" @active_action_label.value = ""
@actions_list.clear @actions_list.clear
@variables_list.clear @variables_list.clear
@@ -320,13 +312,20 @@ module TAC
@groups_list.clear do @groups_list.clear do
groups.each_with_index do |group, i| groups.each_with_index do |group, i|
flow width: 1.0, **THEME_ITEM_CONTAINER_PADDING do flow width: 1.0, height: 36, **THEME_ITEM_CONTAINER_PADDING do |container|
background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
button group.name, fill: true, text_size: THEME_ICON_SIZE - 3 do button group.name, fill: true, text_size: THEME_ICON_SIZE - 3 do
if (old_i = groups.index(@active_group))
@active_group_container.style.default[:background] = old_i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
end
@active_group = group @active_group = group
@active_group_container = container
@active_group_container.style.default[:background] = THEME_HIGHLIGHTED_COLOR
@active_group_label.value = group.name @active_group_label.value = group.name
@active_action = nil @active_action = nil
@active_action_container = nil
@active_action_label.value = "" @active_action_label.value = ""
populate_actions_list(group) populate_actions_list(group)
@@ -342,8 +341,6 @@ module TAC
end end
end end
end end
set_list_heights
end end
def populate_actions_list(group) def populate_actions_list(group)
@@ -353,12 +350,18 @@ module TAC
@actions_list.clear do @actions_list.clear do
actions.each_with_index do |action, i| actions.each_with_index do |action, i|
stack width: 1.0, **THEME_ITEM_CONTAINER_PADDING do stack width: 1.0, height: action.comment.empty? ? 36 : 72, **THEME_ITEM_CONTAINER_PADDING do |container|
background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
flow width: 1.0 do flow width: 1.0, height: 36 do
button action.name, fill: true, text_size: THEME_ICON_SIZE - 3 do button action.name, fill: true, text_size: THEME_ICON_SIZE - 3 do
if (old_i = actions.index(@active_action))
@active_action_container.style.default[:background] = old_i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
end
@active_action = action @active_action = action
@active_action_container = container
@active_action_container.style.default[:background] = THEME_HIGHLIGHTED_COLOR
@active_action_label.value = action.name @active_action_label.value = action.name
populate_variables_list(action) populate_variables_list(action)
@@ -379,12 +382,14 @@ module TAC
end end
end end
caption "#{action.comment}", width: 1.0, text_wrap: :word_wrap unless action.comment.empty? unless action.comment.empty?
stack(width: 1.0, fill: true, scroll: true) do
caption action.comment.to_s, width: 1.0, text_wrap: :word_wrap, text_border: true, text_border_size: 1, text_border_color: 0xaa_000000
end
end
end end
end end
end end
set_list_heights
end end
def populate_variables_list(action) def populate_variables_list(action)
@@ -394,10 +399,10 @@ module TAC
@variables_list.clear do @variables_list.clear do
variables.each_with_index do |variable, i| variables.each_with_index do |variable, i|
stack width: 1.0, **THEME_ITEM_CONTAINER_PADDING do stack width: 1.0, height: 96, **THEME_ITEM_CONTAINER_PADDING do
background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
flow(width: 1.0) do flow(width: 1.0, fill: true) do
button "#{variable.name}", fill: true, text_size: THEME_ICON_SIZE - 3, tip: "Edit variable" do button "#{variable.name}", fill: true, text_size: THEME_ICON_SIZE - 3, tip: "Edit variable" do
push_state(Dialog::VariableDialog, title: "Edit Variable", variable: variable, callback_method: method(:update_variable)) push_state(Dialog::VariableDialog, title: "Edit Variable", variable: variable, callback_method: method(:update_variable))
end end
@@ -412,8 +417,6 @@ module TAC
end end
end end
end end
set_list_heights
end end
end end
end end

View File

@@ -35,6 +35,11 @@ module TAC
@nodes.clear @nodes.clear
refresh_panel refresh_panel
end end
list_box items: ["Power Play", "Freight Frenzy", "Ultimate Goal", "Skystone"], width: 200, height: 1.0 do |item|
season = item.downcase.gsub(" ", "_").to_sym
@field = TAC::Simulator::Field.new(container: @field_container, season: season, simulation: nil)
end
end end
end end
@@ -61,7 +66,7 @@ module TAC
end end
end end
@field = TAC::Simulator::Field.new(container: @field_container, season: :freight_frenzy, simulation: nil) @field = TAC::Simulator::Field.new(container: @field_container, season: :power_play, simulation: nil)
@nodes ||= [] @nodes ||= []
@unit = :inches @unit = :inches
@total_distance = 0 @total_distance = 0
@@ -77,16 +82,12 @@ module TAC
end end
def draw def draw
super
@field.draw @field.draw
display_path display_path
end end
def update def update
super
@field.update @field.update
measure_path measure_path
@@ -133,7 +134,7 @@ module TAC
Gosu.draw_circle( Gosu.draw_circle(
current_node.x * @field.scale + @field_container.x, current_node.x * @field.scale + @field_container.x,
current_node.y * @field.scale + @field_container.y, current_node.y * @field.scale + @field_container.y,
@node_radius, 7, mouse_near ? @node_hover_color : @node_color, 10 @node_radius, 7, mouse_near ? @node_hover_color : @node_color, @field_container.z + 1
) )
next if i.zero? next if i.zero?
@@ -153,7 +154,8 @@ module TAC
(@field_container.y + last_node.y * @field.scale) - distance, (@field_container.y + last_node.y * @field.scale) - distance,
@segment_thickness, @segment_thickness,
distance, distance,
@segment_color @segment_color,
@field_container.z + 1
) )
end end

View File

@@ -11,10 +11,10 @@ module TAC
body.clear do body.clear do
flow(width: 1.0, height: 1.0) do flow(width: 1.0, height: 1.0) do
@group_presets = stack(width: 0.49995, height: 1.0, scroll: true, border_thickness_right: 1, border_color: [0, Gosu::Color::BLACK, 0, 0]) do @group_presets = stack(fill: true, height: 1.0, scroll: true, padding_left: 2, padding_top: 2, padding_right: 2, border_thickness_right: 1, border_color: Gosu::Color::BLACK) do
end end
@action_presets = stack(width: 0.49995, height: 1.0, scroll: true) do @action_presets = stack(fill: true, height: 1.0, scroll: true, padding_left: 2, padding_top: 2, padding_right: 2) do
end end
end end
end end
@@ -26,11 +26,11 @@ module TAC
def populate_group_presets def populate_group_presets
@group_presets.clear do @group_presets.clear do
window.backend.config.presets.groups.each_with_index do |group, i| window.backend.config.presets.groups.each_with_index do |group, i|
flow(width: 1.0, **THEME_ITEM_CONTAINER_PADDING) do flow(width: 1.0, height: 36, **THEME_ITEM_CONTAINER_PADDING) do
background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
button group.name, width: 0.895 do button group.name, fill: true, text_size: THEME_ICON_SIZE - 3 do
page(TAC::Pages::Editor,{ group: group, group_is_preset: true }) page(TAC::Pages::Editor, { group: group, group_is_preset: true })
end end
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit group preset" do button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit group preset" do
@@ -59,11 +59,11 @@ module TAC
def populate_action_presets def populate_action_presets
@action_presets.clear do @action_presets.clear do
window.backend.config.presets.actions.each_with_index do |action, i| window.backend.config.presets.actions.each_with_index do |action, i|
flow(width: 1.0, **THEME_ITEM_CONTAINER_PADDING) do flow(width: 1.0, height: 36, **THEME_ITEM_CONTAINER_PADDING) do
background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
button action.name, width: 0.895 do button action.name, fill: true, text_size: THEME_ICON_SIZE - 3 do
page(TAC::Pages::Editor,{ action: action, action_is_preset: true }) page(TAC::Pages::Editor, { action: action, action_is_preset: true })
end end
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit action preset" do button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit action preset" do

View File

@@ -8,7 +8,7 @@ module TAC
search = edit_line "", fill: true, height: 1.0 search = edit_line "", fill: true, height: 1.0
button get_image("#{TAC::ROOT_PATH}/media/icons/zoom.png"), image_height: 1.0 do button get_image("#{TAC::ROOT_PATH}/media/icons/zoom.png"), image_height: 1.0 do
unless search.value.strip.empty? unless search.value.strip.empty?
search_results = search_config(search.value.downcase.strip) search_results = search_config(search.value.strip)
status_bar.clear do status_bar.clear do
if search_results.results.size.zero? if search_results.results.size.zero?
@@ -89,7 +89,6 @@ module TAC
end end
end end
if search_results.action_presets.size.positive? if search_results.action_presets.size.positive?
title "Action Presets" title "Action Presets"
@@ -152,7 +151,7 @@ module TAC
def search_groups(query, search_results) def search_groups(query, search_results)
window.backend.config.groups.each do |group| window.backend.config.groups.each do |group|
if group.name.downcase.include?(query) if group.name.downcase.include?(query.downcase)
result = SearchResult.new(group: group, query: query, is_group: true, is_from_name: true) result = SearchResult.new(group: group, query: query, is_group: true, is_from_name: true)
search_results.results << result search_results.results << result
end end
@@ -162,12 +161,12 @@ module TAC
def search_actions(query, search_results) def search_actions(query, search_results)
window.backend.config.groups.each do |group| window.backend.config.groups.each do |group|
group.actions.each do |action| group.actions.each do |action|
if action.name.downcase.include?(query) if action.name.downcase.include?(query.downcase)
result = SearchResult.new(group: group, action: action, query: query, is_action: true, is_from_name: true) result = SearchResult.new(group: group, action: action, query: query, is_action: true, is_from_name: true)
search_results.results << result search_results.results << result
end end
if action.comment.downcase.include?(query) if action.comment.downcase.include?(query.downcase)
result = SearchResult.new(group: group, action: action, query: query, is_action: true, is_from_comment: true) result = SearchResult.new(group: group, action: action, query: query, is_action: true, is_from_comment: true)
search_results.results << result search_results.results << result
end end
@@ -179,12 +178,12 @@ module TAC
window.backend.config.groups.each do |group| window.backend.config.groups.each do |group|
group.actions.each do |action| group.actions.each do |action|
action.variables.each do |variable| action.variables.each do |variable|
if variable.name.downcase.include?(query) if variable.name.downcase.include?(query.downcase)
result = SearchResult.new(group: group, action: action, variable: variable, is_variable: true, query: query, is_from_name: true) result = SearchResult.new(group: group, action: action, variable: variable, is_variable: true, query: query, is_from_name: true)
search_results.results << result search_results.results << result
end end
if variable.value.downcase.include?(query) if variable.value.downcase.include?(query.downcase)
result = SearchResult.new(group: group, action: action, variable: variable, is_variable: true, query: query, is_from_value: true) result = SearchResult.new(group: group, action: action, variable: variable, is_variable: true, query: query, is_from_value: true)
search_results.results << result search_results.results << result
end end
@@ -195,29 +194,29 @@ module TAC
def search_presets(query, search_results) def search_presets(query, search_results)
window.backend.config.presets.groups.each do |group| window.backend.config.presets.groups.each do |group|
if group.name.downcase.include?(query) if group.name.downcase.include?(query.downcase)
result = SearchResult.new(group: group, query: query, is_group: true, is_from_name: true, is_preset: true) result = SearchResult.new(group: group, query: query, is_group: true, is_from_name: true, is_preset: true)
search_results.results << result search_results.results << result
end end
group.actions.each do |action| group.actions.each do |action|
if action.name.downcase.include?(query) if action.name.downcase.include?(query.downcase)
result = SearchResult.new(group: group, action: action, query: query, is_action: true, is_from_name: true, is_preset: true) result = SearchResult.new(group: group, action: action, query: query, is_action: true, is_from_name: true, is_preset: true)
search_results.results << result search_results.results << result
end end
if action.comment.downcase.include?(query) if action.comment.downcase.include?(query.downcase)
result = SearchResult.new(group: group, action: action, query: query, is_action: true, is_from_comment: true, is_preset: true) result = SearchResult.new(group: group, action: action, query: query, is_action: true, is_from_comment: true, is_preset: true)
search_results.results << result search_results.results << result
end end
action.variables.each do |variable| action.variables.each do |variable|
if variable.name.downcase.include?(query) if variable.name.downcase.include?(query.downcase)
result = SearchResult.new(group: group, action: action, variable: variable, is_variable: true, query: query, is_from_name: true, is_preset: true) result = SearchResult.new(group: group, action: action, variable: variable, is_variable: true, query: query, is_from_name: true, is_preset: true)
search_results.results << result search_results.results << result
end end
if variable.value.downcase.include?(query) if variable.value.downcase.include?(query.downcase)
result = SearchResult.new(group: group, action: action, variable: variable, is_variable: true, query: query, is_from_value: true, is_preset: true) result = SearchResult.new(group: group, action: action, variable: variable, is_variable: true, query: query, is_from_value: true, is_preset: true)
search_results.results << result search_results.results << result
end end
@@ -226,27 +225,27 @@ module TAC
end end
window.backend.config.presets.actions.each do |action| window.backend.config.presets.actions.each do |action|
if action.name.downcase.include?(query) if action.name.downcase.include?(query.downcase)
result = SearchResult.new(group: nil, action: action, query: query, is_action: true, is_from_name: true, is_preset: true) result = SearchResult.new(group: nil, action: action, query: query, is_action: true, is_from_name: true, is_preset: true)
search_results.results << result
end
if action.comment.downcase.include?(query.downcase)
result = SearchResult.new(group: nil, action: action, query: query, is_action: true, is_from_comment: true, is_preset: true)
search_results.results << result
end
action.variables.each do |variable|
if variable.name.downcase.include?(query.downcase)
result = SearchResult.new(group: nil, action: action, variable: variable, is_variable: true, query: query, is_from_name: true, is_preset: true)
search_results.results << result search_results.results << result
end end
if action.comment.downcase.include?(query) if variable.value.downcase.include?(query.downcase)
result = SearchResult.new(group: nil, action: action, query: query, is_action: true, is_from_comment: true, is_preset: true) result = SearchResult.new(group: nil, action: action, variable: variable, is_variable: true, query: query, is_from_value: true, is_preset: true)
search_results.results << result search_results.results << result
end end
end
action.variables.each do |variable|
if variable.name.downcase.include?(query)
result = SearchResult.new(group: nil, action: action, variable: variable, is_variable: true, query: query, is_from_name: true, is_preset: true)
search_results.results << result
end
if variable.value.downcase.include?(query)
result = SearchResult.new(group: nil, action: action, variable: variable, is_variable: true, query: query, is_from_value: true, is_preset: true)
search_results.results << result
end
end
end end
end end
@@ -332,7 +331,8 @@ module TAC
end end
def highlight(string) def highlight(string)
string.gsub(/#{@query}/i, "<b><c=ff00ff>#{@query}</c></b>") match = string.match(/#{@query}/i)
string.gsub(/#{@query}/i, "<b><c=ff00ff>#{match}</c></b>")
end end
end end
end end

View File

@@ -12,7 +12,7 @@ module TAC
begin begin
@simulation = TAC::Simulator::Simulation.new(source_code: @source_code.value, field_container: @field_container) @simulation = TAC::Simulator::Simulation.new(source_code: @source_code.value, field_container: @field_container)
@simulation.start @simulation.start
rescue SyntaxError, NameError, NoMethodError, TypeError, ArgumentError => e rescue SyntaxError, NameError, NoMethodError, TypeError, ArgumentError, StandardError => e
puts e.backtrace.reverse.join("\n") puts e.backtrace.reverse.join("\n")
puts e puts e
push_state(Dialog::AlertDialog, title: "#{e.class}", message: e) push_state(Dialog::AlertDialog, title: "#{e.class}", message: e)

View File

@@ -12,14 +12,14 @@ module TAC
@scale = 1 @scale = 1
@size = 0 @size = 0
@field_size = 144 # inches [1 pixel = 1 inch] @field_size = 144 # inches [1 pixel = 1 inch]
@z = @container.z + 1
@blue = Gosu::Color.new(0xff_004080) @blue = Gosu::Color.new(0xff_004080)
@red = Gosu::Color.new(0xff_800000) @red = Gosu::Color.new(0xff_800000)
@soft_orange = Gosu::Color.rgb(255, 175, 0)
end end
def draw def draw
Gosu.flush
Gosu.clip_to(@position.x, @position.y, @size, @size) do Gosu.clip_to(@position.x, @position.y, @size, @size) do
Gosu.translate(@position.x, @position.y) do Gosu.translate(@position.x, @position.y) do
draw_field draw_field
@@ -34,88 +34,90 @@ module TAC
end end
def draw_field def draw_field
Gosu.draw_rect(0, 0, @field_size * @scale, @field_size * @scale, Gosu::Color::GRAY) Gosu.draw_rect(0, 0, @field_size * @scale, @field_size * @scale, Gosu::Color::GRAY, @z)
6.times do |i| # Tile lines across 6.times do |i| # Tile lines across
next if i == 0 next if i == 0
Gosu.draw_rect((@field_size * @scale) / 6 * i, 0, 1, @field_size * @scale, Gosu::Color::BLACK) Gosu.draw_rect((@field_size * @scale) / 6 * i, 0, 1, @field_size * @scale, Gosu::Color::BLACK, @z)
end end
6.times do |i| # Tile lines down 6.times do |i| # Tile lines down
next if i == 0 next if i == 0
Gosu.draw_rect(0, (@field_size * @scale) / 6 * i, @field_size * @scale, 1, Gosu::Color::BLACK) Gosu.draw_rect(0, (@field_size * @scale) / 6 * i, @field_size * @scale, 1, Gosu::Color::BLACK, @z)
end end
end end
def draw_field_skystone def draw_field_skystone
# blue bridge # blue bridge
Gosu.draw_rect(0, @field_size / 2 - 2, 48, 1, @blue) Gosu.draw_rect(0, @field_size / 2 - 2, 48, 1, @blue, @z)
Gosu.draw_rect(0, @field_size / 2 + 1, 48, 1, @blue) Gosu.draw_rect(0, @field_size / 2 + 1, 48, 1, @blue, @z)
# mid bridge # mid bridge
Gosu.draw_rect(@field_size / 2 - 24, @field_size / 2 - 9.25, 48, 18.5, Gosu::Color.new(0xff_222222)) Gosu.draw_rect(@field_size / 2 - 24, @field_size / 2 - 9.25, 48, 18.5, Gosu::Color.new(0xff_222222), @z)
Gosu.draw_rect(@field_size / 2 - 24, @field_size / 2 - 2, 48, 1, Gosu::Color::YELLOW) Gosu.draw_rect(@field_size / 2 - 24, @field_size / 2 - 2, 48, 1, @soft_orange, @z)
Gosu.draw_rect(@field_size / 2 - 24, @field_size / 2 + 1, 48, 1, Gosu::Color::YELLOW) Gosu.draw_rect(@field_size / 2 - 24, @field_size / 2 + 1, 48, 1, @soft_orange, @z)
# blue bridge # blue bridge
Gosu.draw_rect(@field_size - 48, @field_size / 2 - 2, 48, 1, @red) Gosu.draw_rect(@field_size - 48, @field_size / 2 - 2, 48, 1, @red, @z)
Gosu.draw_rect(@field_size - 48, @field_size / 2 + 1, 48, 1, @red) Gosu.draw_rect(@field_size - 48, @field_size / 2 + 1, 48, 1, @red, @z)
# blue build site # blue build site
Gosu.draw_quad( Gosu.draw_quad(
24 - 2, 0, @blue, 24 - 2, 0, @blue,
24, 0, @blue, 24, 0, @blue,
0, 24 - 2, @blue, 0, 24 - 2, @blue,
0, 24, @blue 0, 24, @blue,
) @z
)
# red build site # red build site
Gosu.draw_quad( Gosu.draw_quad(
@field_size - (24 - 2), 0, @red, @field_size - (24 - 2), 0, @red,
@field_size - (24 - 0), 0, @red, @field_size - (24 - 0), 0, @red,
@field_size, 24 - 2, @red, @field_size, 24 - 2, @red,
@field_size, 24, @red @field_size, 24, @red,
) @z
)
# blue depot # blue depot
Gosu.draw_rect(@field_size - 24, @field_size - 24, 24, 2, @blue) Gosu.draw_rect(@field_size - 24, @field_size - 24, 24, 2, @blue, @z)
Gosu.draw_rect(@field_size - 24, @field_size - 24, 2, 24, @blue) Gosu.draw_rect(@field_size - 24, @field_size - 24, 2, 24, @blue, @z)
# red depot # red depot
Gosu.draw_rect(-1, @field_size - 24, 24, 2, @red) Gosu.draw_rect(-1, @field_size - 24, 24, 2, @red, @z)
Gosu.draw_rect(22, @field_size - 24, 2, 24, @red) Gosu.draw_rect(22, @field_size - 24, 2, 24, @red, @z)
# blue foundation # blue foundation
Gosu.draw_rect(48, 4, 18.5, 34.5, @blue) Gosu.draw_rect(48, 4, 18.5, 34.5, @blue, @z)
# red foundation # red foundation
Gosu.draw_rect(@field_size - (48 + 18.5), 4, 18.5, 34.5, @red) Gosu.draw_rect(@field_size - (48 + 18.5), 4, 18.5, 34.5, @red, @z)
# stones # stones
6.times do |i| 6.times do |i|
Gosu.draw_rect(48, @field_size - 8 * i - 8, 4, 8, Gosu::Color::YELLOW) Gosu.draw_rect(48, @field_size - 8 * i - 8, 4, 8, @soft_orange, @z)
end end
6.times do |i| 6.times do |i|
Gosu.draw_rect(@field_size - (48 + 4), @field_size - 8 * i - 8, 4, 8, Gosu::Color::YELLOW) Gosu.draw_rect(@field_size - (48 + 4), @field_size - 8 * i - 8, 4, 8, @soft_orange, @z)
end end
end end
def draw_field_ultimate_goal def draw_field_ultimate_goal
# middle line # middle line
Gosu.draw_rect(0, @field_size / 2 - 13, @field_size, 2, Gosu::Color::WHITE) Gosu.draw_rect(0, @field_size / 2 - 13, @field_size, 2, Gosu::Color::WHITE, @z)
# phantom center line to indict half field for remote season field # phantom center line to indict half field for remote season field
Gosu.draw_rect(@field_size / 2 - (0.5 + 24), 0, 1, @field_size, 0x88_448844) Gosu.draw_rect(@field_size / 2 - (0.5 + 24), 0, 1, @field_size, 0x88_448844, @z)
# blue starting lines # blue starting lines
Gosu.draw_rect(24 - 1, @field_size - 24, 2, 24, @blue) Gosu.draw_rect(24 - 1, @field_size - 24, 2, 24, @blue, @z)
Gosu.draw_rect(48 - 1, @field_size - 24, 2, 24, @blue) Gosu.draw_rect(48 - 1, @field_size - 24, 2, 24, @blue, @z)
# blue wobbly wobs # blue wobbly wobs
Gosu.draw_circle(24, @field_size - 24, 4, 32, @blue) Gosu.draw_circle(24, @field_size - 24, 4, 32, @blue, @z)
Gosu.draw_circle(48, @field_size - 24, 4, 32, @blue) Gosu.draw_circle(48, @field_size - 24, 4, 32, @blue, @z)
# blue starter stack # blue starter stack
Gosu.draw_rect(36 - 1, @field_size - 50, 2, 2, @blue) Gosu.draw_rect(36 - 1, @field_size - 50, 2, 2, @blue, @z)
# blue target zones # blue target zones
# A # A
@@ -132,15 +134,15 @@ module TAC
end end
# red starting lines # red starting lines
Gosu.draw_rect(@field_size - 24 - 1, @field_size - 24, 2, 24, @red) Gosu.draw_rect(@field_size - 24 - 1, @field_size - 24, 2, 24, @red, @z)
Gosu.draw_rect(@field_size - 48 - 1, @field_size - 24, 2, 24, @red) Gosu.draw_rect(@field_size - 48 - 1, @field_size - 24, 2, 24, @red, @z)
# red wobbly wobs # red wobbly wobs
Gosu.draw_circle(@field_size - 24, @field_size - 24, 4, 32, @red) Gosu.draw_circle(@field_size - 24, @field_size - 24, 4, 32, @red, @z)
Gosu.draw_circle(@field_size - 48, @field_size - 24, 4, 32, @red) Gosu.draw_circle(@field_size - 48, @field_size - 24, 4, 32, @red, @z)
# red starter stack # red starter stack
Gosu.draw_rect(@field_size - 37, @field_size - 50, 2, 2, @red) Gosu.draw_rect(@field_size - 37, @field_size - 50, 2, 2, @red, @z)
# red target zones # red target zones
# A # A
@@ -161,91 +163,88 @@ module TAC
def draw_field_freight_frenzy def draw_field_freight_frenzy
# blue ZONE # blue ZONE
Gosu.draw_rect(24, @field_size - 24, 2, 24, @blue) Gosu.draw_rect(24, @field_size - 24, 2, 24, @blue, @z)
Gosu.draw_rect(24, @field_size - 24, 24, 2, @blue) Gosu.draw_rect(24, @field_size - 24, 24, 2, @blue, @z)
Gosu.draw_rect(48 - 2, @field_size - 24, 2, 24, @blue) Gosu.draw_rect(48 - 2, @field_size - 24, 2, 24, @blue, @z)
# blue barcode 1 # blue barcode 1
Gosu.draw_rect(36 - 1, @field_size - 24 - 4, 2, 2, @blue) Gosu.draw_rect(36 - 1, @field_size - 24 - 4, 2, 2, @blue, @z)
Gosu.draw_rect(36 - 1, @field_size - 36 - 1, 2, 2, @blue) Gosu.draw_rect(36 - 1, @field_size - 36 - 1, 2, 2, @blue, @z)
Gosu.draw_rect(36 - 1, @field_size - 48 + 2, 2, 2, @blue) Gosu.draw_rect(36 - 1, @field_size - 48 + 2, 2, 2, @blue, @z)
# blue barcode 2 # blue barcode 2
Gosu.draw_rect(36 - 1, 48 + 2, 2, 2, @blue) Gosu.draw_rect(36 - 1, 48 + 2, 2, 2, @blue, @z)
Gosu.draw_rect(36 - 1, 60 - 1, 2, 2, @blue) Gosu.draw_rect(36 - 1, 60 - 1, 2, 2, @blue, @z)
Gosu.draw_rect(36 - 1, 72 - 4, 2, 2, @blue) Gosu.draw_rect(36 - 1, 72 - 4, 2, 2, @blue, @z)
# blue wobble goal # blue wobble goal
Gosu.draw_circle(48, 84, 9, 32, @blue) Gosu.draw_circle(48, 84, 9, 32, @blue, @z)
# blue shared wobble goal # blue shared wobble goal
Gosu.draw_circle(@field_size / 2, 24, 9, 32, @blue) Gosu.draw_circle(@field_size / 2, 24, 9, 32, @blue, @z)
# red ZONE # red ZONE
Gosu.draw_rect(@field_size - 24 - 2, @field_size - 24, 2, 24, @red) Gosu.draw_rect(@field_size - 24 - 2, @field_size - 24, 2, 24, @red, @z)
Gosu.draw_rect(@field_size - 48, @field_size - 24, 24, 2, @red) Gosu.draw_rect(@field_size - 48, @field_size - 24, 24, 2, @red, @z)
Gosu.draw_rect(@field_size - 48, @field_size - 24, 2, 24, @red) Gosu.draw_rect(@field_size - 48, @field_size - 24, 2, 24, @red, @z)
# red barcode 1 # red barcode 1
Gosu.draw_rect(@field_size - 36 - 1, @field_size - 24 - 4, 2, 2, @red) Gosu.draw_rect(@field_size - 36 - 1, @field_size - 24 - 4, 2, 2, @red, @z)
Gosu.draw_rect(@field_size - 36 - 1, @field_size - 36 - 1, 2, 2, @red) Gosu.draw_rect(@field_size - 36 - 1, @field_size - 36 - 1, 2, 2, @red, @z)
Gosu.draw_rect(@field_size - 36 - 1, @field_size - 48 + 2, 2, 2, @red) Gosu.draw_rect(@field_size - 36 - 1, @field_size - 48 + 2, 2, 2, @red, @z)
# red barcode 2 # red barcode 2
Gosu.draw_rect(@field_size - 36 - 1, 48 + 2, 2, 2, @red) Gosu.draw_rect(@field_size - 36 - 1, 48 + 2, 2, 2, @red, @z)
Gosu.draw_rect(@field_size - 36 - 1, 60 - 1, 2, 2, @red) Gosu.draw_rect(@field_size - 36 - 1, 60 - 1, 2, 2, @red, @z)
Gosu.draw_rect(@field_size - 36 - 1, 72 - 4, 2, 2, @red) Gosu.draw_rect(@field_size - 36 - 1, 72 - 4, 2, 2, @red, @z)
# red wobble goal # red wobble goal
Gosu.draw_circle(@field_size - 48, 84, 9, 32, @red) Gosu.draw_circle(@field_size - 48, 84, 9, 32, @red, @z)
# red shared wobble goal # red shared wobble goal
Gosu.clip_to(@field_size / 2, 0, 10, 48) do # Gosu.clip_to(@field_size / 2, 0, 10, 48) do
Gosu.draw_circle(@field_size / 2, 24, 9, 32, @red) Gosu.draw_circle(@field_size / 2, 24, 9, 32, @red, @z)
end # end
# white corner left # white corner left
faint_white = Gosu::Color.rgb(240, 240, 240) faint_white = Gosu::Color.rgb(240, 240, 240)
Gosu.draw_rect(0, 46 - 2, 46, 2, faint_white) Gosu.draw_rect(0, 46 - 2, 46, 2, faint_white, @z)
Gosu.draw_rect(46 - 2, 0, 2, 46, faint_white) Gosu.draw_rect(46 - 2, 0, 2, 46, faint_white, @z)
# white corner right # white corner right
Gosu.draw_rect(@field_size - 46, 46 - 2, 46, 2, faint_white) Gosu.draw_rect(@field_size - 46, 46 - 2, 46, 2, faint_white, @z)
Gosu.draw_rect(@field_size - 46, 0, 2, 46, faint_white) Gosu.draw_rect(@field_size - 46, 0, 2, 46, faint_white, @z)
# cross bars # cross bars
bar_gray = Gosu::Color.rgb(50, 50, 50) bar_gray = Gosu::Color.rgb(50, 50, 50)
# MAIN # MAIN
Gosu.draw_rect(13.75, 48 - 2, @field_size - 13.75 * 2, 1, bar_gray) Gosu.draw_rect(13.75, 48 - 2, @field_size - 13.75 * 2, 1, bar_gray, @z)
Gosu.draw_rect(13.75, 48 + 1, @field_size - 13.75 * 2, 1, bar_gray) Gosu.draw_rect(13.75, 48 + 1, @field_size - 13.75 * 2, 1, bar_gray, @z)
Gosu.draw_rect(13.75, 48 - 2, 1, 4, Gosu::Color::BLACK) Gosu.draw_rect(13.75, 48 - 2, 1, 4, Gosu::Color::BLACK, @z)
Gosu.draw_rect(@field_size - 13.75 - 1, 48 - 2, 1, 4, Gosu::Color::BLACK) Gosu.draw_rect(@field_size - 13.75 - 1, 48 - 2, 1, 4, Gosu::Color::BLACK, @z)
# BLUE # BLUE
Gosu.draw_rect(48 - 2, 13.75, 1, 48 - 13.75 - 2, bar_gray) Gosu.draw_rect(48 - 2, 13.75, 1, 48 - 13.75 - 2, bar_gray, @z)
Gosu.draw_rect(48 + 1, 13.75, 1, 48 - 13.75 - 2, bar_gray) Gosu.draw_rect(48 + 1, 13.75, 1, 48 - 13.75 - 2, bar_gray, @z)
Gosu.draw_rect(48 - 2, 13.75, 4, 1, Gosu::Color::BLACK) Gosu.draw_rect(48 - 2, 13.75, 4, 1, Gosu::Color::BLACK, @z)
Gosu.draw_rect(48 - 2, 48 - 3, 4, 1, Gosu::Color::BLACK) Gosu.draw_rect(48 - 2, 48 - 3, 4, 1, Gosu::Color::BLACK, @z)
# RED # RED
Gosu.draw_rect(@field_size - 48 - 2, 13.75, 1, 48 - 13.75 - 2, bar_gray) Gosu.draw_rect(@field_size - 48 - 2, 13.75, 1, 48 - 13.75 - 2, bar_gray, @z)
Gosu.draw_rect(@field_size - 48 + 1, 13.75, 1, 48 - 13.75 - 2, bar_gray) Gosu.draw_rect(@field_size - 48 + 1, 13.75, 1, 48 - 13.75 - 2, bar_gray, @z)
Gosu.draw_rect(@field_size - 48 - 2, 13.75, 4, 1, Gosu::Color::BLACK) Gosu.draw_rect(@field_size - 48 - 2, 13.75, 4, 1, Gosu::Color::BLACK, @z)
Gosu.draw_rect(@field_size - 48 - 2, 48 - 3, 4, 1, Gosu::Color::BLACK) Gosu.draw_rect(@field_size - 48 - 2, 48 - 3, 4, 1, Gosu::Color::BLACK, @z)
# Duck Delivery # Duck Delivery
Gosu.draw_circle(2, @field_size - 2, 9, 16, Gosu::Color.rgb(75, 75, 75)) Gosu.draw_circle(2, @field_size - 2, 9, 16, Gosu::Color.rgb(75, 75, 75))
Gosu.draw_circle(@field_size - 2, @field_size - 2, 9, 16, Gosu::Color.rgb(75, 75, 75)) Gosu.draw_circle(@field_size - 2, @field_size - 2, 9, 16, Gosu::Color.rgb(75, 75, 75))
# packages
soft_orange = Gosu::Color.rgb(255, 175, 0)
7.times do |y| 7.times do |y|
7.times do |x| 7.times do |x|
if x.even? if x.even?
Gosu.draw_rect(x * 3 + 1, y * 3 + 1, 2, 2, soft_orange) Gosu.draw_rect(x * 3 + 1, y * 3 + 1, 2, 2, @soft_orange, @z)
else else
Gosu.draw_circle(x * 3 + 2, y * 3 + 2, 1, 16, faint_white) Gosu.draw_circle(x * 3 + 2, y * 3 + 2, 1, 16, faint_white, @z)
end end
end end
end end
@@ -253,24 +252,95 @@ module TAC
7.times do |y| 7.times do |y|
7.times do |x| 7.times do |x|
if x.even? if x.even?
Gosu.draw_rect((@field_size - 4) - x * 3 + 1, y * 3 + 1, 2, 2, soft_orange) Gosu.draw_rect((@field_size - 4) - x * 3 + 1, y * 3 + 1, 2, 2, @soft_orange, @z)
else else
Gosu.draw_circle((@field_size - 4) - x * 3 + 2, y * 3 + 2, 1, 16, faint_white) Gosu.draw_circle((@field_size - 4) - x * 3 + 2, y * 3 + 2, 1, 16, faint_white, @z)
end end
end end
end end
Gosu.draw_rect(0, 60 - 1, 2, 2, soft_orange) Gosu.draw_rect(0, 60 - 1, 2, 2, @soft_orange, @z)
Gosu.draw_rect(0, 108 - 1, 2, 2, soft_orange) Gosu.draw_rect(0, 108 - 1, 2, 2, @soft_orange, @z)
Gosu.draw_rect(@field_size - 2, 60 - 1, 2, 2, soft_orange) Gosu.draw_rect(@field_size - 2, 60 - 1, 2, 2, @soft_orange, @z)
Gosu.draw_rect(@field_size - 2, 108 - 1, 2, 2, soft_orange) Gosu.draw_rect(@field_size - 2, 108 - 1, 2, 2, @soft_orange, @z)
end
def draw_field_power_play
# pole junctions (Drawn before ground junctions to be lazy- ground junctions will cover non-existant poles)
5.times do |y|
5.times do |x|
Gosu.draw_circle(24 + (x * 24), 24 + (y * 24), 0.5, 16, @soft_orange, @z)
end
end
# ground junction
3.times do |y|
3.times do |x|
Gosu.draw_circle(24 + (x * 48), 24 + (y * 48), 3, 16, Gosu::Color::BLACK, @z)
end
end
# Field cones
2.times do |y|
2.times do |x|
Gosu.draw_circle(36 + (x * 72), 36 + (y * 72), 2, 16, x.zero? ? @blue : @red, @z)
end
end
# alliance LINEs
2.times do |y|
2.times do |x|
Gosu.draw_rect(59 + (x * 24), y * (144 - 23.5), 2, 23.5, x.zero? ? @blue : @red, @z)
end
end
# alliance LINE cones
2.times do |y|
2.times do |x|
Gosu.draw_circle(60 + (x * 24), y * (144 - 4) + 2, 2, 16, x.zero? ? @blue : @red, @z)
end
end
# Corner TAPE
4.times do |i|
Gosu.rotate(i * 90.0, 72, 72) do
Gosu.draw_quad(
24 - 2, 0, i.even? ? @red : @blue,
24, 0, i.even? ? @red : @blue,
0, 24 - 2, i.even? ? @red : @blue,
0, 24, i.even? ? @red : @blue,
@z
)
end
end
# Triangle TAPE
2.times do |i|
Gosu.rotate(i * 180.0, 72, 72) do
Gosu.draw_quad(
0, 72 - 10.5, i.odd? ? @red : @blue,
10.5, 72, i.odd? ? @red : @blue,
8.5, 72, i.odd? ? @red : @blue,
0, 72 - 8.5, i.odd? ? @red : @blue,
@z
)
Gosu.draw_quad(
0, 72 + 10.5, i.odd? ? @red : @blue,
10.5, 72, i.odd? ? @red : @blue,
8.5, 72, i.odd? ? @red : @blue,
0, 72 + 8.5, i.odd? ? @red : @blue,
@z
)
end
end
end end
def draw_tile_box(color) def draw_tile_box(color)
Gosu.draw_rect(0, 0, 24, 2, color) Gosu.draw_rect(0, 0, 24, 2, color, @z)
Gosu.draw_rect(22, 2, 2, 22, color) Gosu.draw_rect(22, 2, 2, 22, color, @z)
Gosu.draw_rect(0, 22, 22, 2, color) Gosu.draw_rect(0, 22, 22, 2, color, @z)
Gosu.draw_rect(0, 2, 2, 22, color) Gosu.draw_rect(0, 2, 2, 22, color, @z)
end end
def update def update

View File

@@ -4,13 +4,16 @@ module TAC
FONT = Gosu::Font.new(11) FONT = Gosu::Font.new(11)
attr_accessor :position, :angle, :comment attr_accessor :position, :angle, :comment
attr_reader :alliance, :width, :depth attr_reader :alliance, :width, :depth, :z
def initialize(alliance:, width:, depth:) def initialize(alliance:, width:, depth:, container:)
@alliance = alliance @alliance = alliance
@width, @depth = width, depth @width = width
@depth = depth
@container = container
@position = CyberarmEngine::Vector.new @position = CyberarmEngine::Vector.new
@angle = 0 @angle = 0
@z = @container.z + 1
@queue = [] @queue = []
@@ -24,28 +27,28 @@ module TAC
def draw def draw
Gosu.translate(@width / 2, @depth / 2) do Gosu.translate(@width / 2, @depth / 2) do
Gosu.rotate(@angle, @position.x, @position.y) do Gosu.rotate(@angle, @position.x, @position.y) do
Gosu.draw_rect(@position.x - @width / 2, @position.y - @depth / 2, @width, @depth, Gosu::Color::BLACK) Gosu.draw_rect(@position.x - @width / 2, @position.y - @depth / 2, @width, @depth, Gosu::Color::BLACK, @z)
Gosu.draw_rect(@position.x - @width / 2 + 1, @position.y - @depth / 2 + 1, @width - 2, @depth - 2, Gosu::Color.new(0xff_808022)) Gosu.draw_rect(@position.x - @width / 2 + 1, @position.y - @depth / 2 + 1, @width - 2, @depth - 2, Gosu::Color.new(0xff_808022), @z)
if @alliance == :blue if @alliance == :blue
Gosu.draw_arc(@position.x, @position.y, 6, 1.0, 32, 2, TAC::Palette::BLUE_ALLIANCE) Gosu.draw_arc(@position.x, @position.y, 6, 1.0, 32, 2, TAC::Palette::BLUE_ALLIANCE, @z)
elsif @alliance == :red elsif @alliance == :red
Gosu.draw_arc(@position.x, @position.y, 6, 1.0, 32, 2, TAC::Palette::RED_ALLIANCE) Gosu.draw_arc(@position.x, @position.y, 6, 1.0, 32, 2, TAC::Palette::RED_ALLIANCE, @z)
else else
Gosu.draw_arc(@position.x, @position.y, 6, 1.0, 32, 2, @alliance) Gosu.draw_arc(@position.x, @position.y, 6, 1.0, 32, 2, @alliance, @z)
end end
Gosu.draw_circle(@position.x, @position.y - @depth * 0.25, 2, 3, TAC::Palette::TIMECRAFTERS_TERTIARY) Gosu.draw_circle(@position.x, @position.y - @depth * 0.25, 2, 3, TAC::Palette::TIMECRAFTERS_TERTIARY, @z)
end end
FONT.draw_text(@comment, 2.2, 2.2, 0, 1, 1, Gosu::Color::BLACK) FONT.draw_text(@comment, 2.2, 2.2, @z, 1, 1, Gosu::Color::BLACK)
FONT.draw_text(@comment, 2, 2, 0) FONT.draw_text(@comment, 2, 2, @z)
end end
end end
def update(dt) def update(dt)
@angle %= 360.0 @angle %= 360.0
if state = @queue.first if (state = @queue.first)
state.update(dt) state.update(dt)
if state.complete? if state.complete?
@@ -145,9 +148,10 @@ module TAC
def draw def draw
Gosu.draw_line( Gosu.draw_line(
@robot.position.x + @robot.width / 2, @robot.position.y + @robot.depth / 2, TAC::Palette::TIMECRAFTERS_TERTIARY, @robot.position.x + @robot.width / 2, @robot.position.y + @robot.depth / 2, TAC::Palette::TIMECRAFTERS_TERTIARY,
@goal.x + @robot.width / 2, @goal.y + @robot.depth / 2, TAC::Palette::TIMECRAFTERS_TERTIARY @goal.x + @robot.width / 2, @goal.y + @robot.depth / 2, TAC::Palette::TIMECRAFTERS_TERTIARY,
@robot.z
) )
Gosu.draw_rect(@goal.x + (@robot.width / 2 - 1), @goal.y + (@robot.depth / 2 - 1), 2, 2, Gosu::Color::RED) Gosu.draw_rect(@goal.x + (@robot.width / 2 - 1), @goal.y + (@robot.depth / 2 - 1), 2, 2, Gosu::Color::RED, @robot.z)
end end
def update(dt) def update(dt)
@@ -191,9 +195,10 @@ module TAC
def draw def draw
Gosu.draw_line( Gosu.draw_line(
@robot.position.x + @robot.width / 2, @robot.position.y + @robot.depth / 2, TAC::Palette::TIMECRAFTERS_TERTIARY, @robot.position.x + @robot.width / 2, @robot.position.y + @robot.depth / 2, TAC::Palette::TIMECRAFTERS_TERTIARY,
@goal.x + @robot.width / 2, @goal.y + @robot.depth / 2, TAC::Palette::TIMECRAFTERS_TERTIARY @goal.x + @robot.width / 2, @goal.y + @robot.depth / 2, TAC::Palette::TIMECRAFTERS_TERTIARY,
@robot.z
) )
Gosu.draw_rect(@goal.x + (@robot.width / 2 - 1), @goal.y + (@robot.depth / 2 - 1), 2, 2, Gosu::Color::RED) Gosu.draw_rect(@goal.x + (@robot.width / 2 - 1), @goal.y + (@robot.depth / 2 - 1), 2, 2, Gosu::Color::RED, @robot.z)
end end
def update(dt) def update(dt)
@@ -245,7 +250,8 @@ module TAC
fraction, fraction,
360, 360,
1, 1,
TAC::Palette::TIMECRAFTERS_TERTIARY TAC::Palette::TIMECRAFTERS_TERTIARY,
@robot.z
) )
end end
@@ -254,7 +260,8 @@ module TAC
@robot.position.y + @robot.depth / 2 + Gosu.offset_y(@target_angle, @robot.width > @robot.depth ? @robot.width : @robot.depth), @robot.position.y + @robot.depth / 2 + Gosu.offset_y(@target_angle, @robot.width > @robot.depth ? @robot.width : @robot.depth),
1, 1,
9, 9,
Gosu::Color::RED Gosu::Color::RED,
@robot.z
) )
# Gosu.draw_arc(@position.x, @position.y, 6, 1.0, 32, 2, @alliance) # Gosu.draw_arc(@position.x, @position.y, 6, 1.0, 32, 2, @alliance)
end end
@@ -297,7 +304,8 @@ module TAC
1 - fraction, 1 - fraction,
360, 360,
1, 1,
TAC::Palette::TIMECRAFTERS_TERTIARY TAC::Palette::TIMECRAFTERS_TERTIARY,
@robot.z
) )
@complete = fraction >= 1 @complete = fraction >= 1

View File

@@ -8,7 +8,7 @@ module TAC
@field_container = field_container @field_container = field_container
@robots = [] @robots = []
@field = Field.new(simulation: self, season: :freight_frenzy, container: @field_container) @field = Field.new(simulation: self, season: :power_play, container: @field_container)
@show_paths = false @show_paths = false
@last_milliseconds = Gosu.milliseconds @last_milliseconds = Gosu.milliseconds
@@ -29,7 +29,7 @@ module TAC
def update def update
@accumulator += (Gosu.milliseconds - @last_milliseconds) / 1000.0 @accumulator += (Gosu.milliseconds - @last_milliseconds) / 1000.0
while(@accumulator > @simulation_step) while @accumulator > @simulation_step
@field.update @field.update
@robots.each { |robot| robot.update(@simulation_step) } @robots.each { |robot| robot.update(@simulation_step) }
@@ -41,7 +41,7 @@ module TAC
end end
def create_robot(alliance:, width:, depth:) def create_robot(alliance:, width:, depth:)
robot = Simulator::Robot.new(alliance: alliance, width: width, depth: depth) robot = Simulator::Robot.new(alliance: alliance, width: width, depth: depth, container: @field_container)
@robots << robot @robots << robot
return robot return robot

View File

@@ -8,7 +8,7 @@ module TAC
background [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY, TAC::Palette::TIMECRAFTERS_TERTIARY, TAC::Palette::TIMECRAFTERS_PRIMARY] background [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY, TAC::Palette::TIMECRAFTERS_TERTIARY, TAC::Palette::TIMECRAFTERS_PRIMARY]
end end
@title_font = CyberarmEngine::Text.new(TAC::NAME, z: 100, size: 72, border: true, border_size: 3, font: THEME[:Label][:font]) @title_font = CyberarmEngine::Text.new(TAC::NAME, z: 100, size: 72, border: true, border_size: 2, border_color: 0xff_000000, font: THEME[:TextBlock][:font], static: true)
@logo = Gosu::Image.new("#{TAC::ROOT_PATH}/media/logo.png") @logo = Gosu::Image.new("#{TAC::ROOT_PATH}/media/logo.png")
@title_animator = CyberarmEngine::Animator.new(start_time: 0, duration: 750, from: 0.0, to: 1.0, tween: :swing_from_to) @title_animator = CyberarmEngine::Animator.new(start_time: 0, duration: 750, from: 0.0, to: 1.0, tween: :swing_from_to)

View File

@@ -34,7 +34,7 @@ class Editor < CyberarmEngine::GuiState
@header_bar = flow(width: 1.0, height: 36) do @header_bar = flow(width: 1.0, height: 36) do
background 0xff_006000 background 0xff_006000
@header_bar_label = label TAC::NAME, width: 1.0, text_align: :center, text_size: 32 @header_bar_label = label TAC::NAME, width: 1.0, text_align: :center, text_size: 32, font: TAC::THEME_BOLD_FONT
@window_controls = flow(x: window.width - 36 * 2, y: 0, height: 1.0) do @window_controls = flow(x: window.width - 36 * 2, y: 0, height: 1.0) do
button get_image("#{TAC::ROOT_PATH}/media/icons/minus.png"), tip: "Minimize", image_height: 1.0 do button get_image("#{TAC::ROOT_PATH}/media/icons/minus.png"), tip: "Minimize", image_height: 1.0 do
@@ -128,9 +128,9 @@ class Editor < CyberarmEngine::GuiState
end end
def draw def draw
super @page&.draw
@page.draw if @page super
end end
def update def update

View File

@@ -1,12 +1,15 @@
module TAC module TAC
THEME_FONT = "#{TAC::ROOT_PATH}/media/fonts/DejaVuSansCondensed.ttf" THEME_FONT = "#{TAC::ROOT_PATH}/media/fonts/NotoSans-Bold.ttf"
THEME_BOLD_FONT = "#{TAC::ROOT_PATH}/media/fonts/NotoSans-Black.ttf"
THEME = { THEME = {
Label: { TextBlock: {
text_static: true,
font: THEME_FONT, font: THEME_FONT,
text_size: 22, text_size: 22,
color: Gosu::Color.new(0xee_ffffff), color: Gosu::Color.new(0xee_ffffff),
}, },
Button: { Button: {
font: THEME_BOLD_FONT,
text_size: 22, text_size: 22,
background: TAC::Palette::TIMECRAFTERS_PRIMARY, background: TAC::Palette::TIMECRAFTERS_PRIMARY,
border_thickness: 1, border_thickness: 1,
@@ -20,6 +23,7 @@ module TAC
}, },
EditLine: { EditLine: {
caret_color: Gosu::Color.new(0xff_88ef90), caret_color: Gosu::Color.new(0xff_88ef90),
font: THEME_FONT
}, },
ToggleButton: { ToggleButton: {
width: 18, width: 18,
@@ -31,10 +35,10 @@ module TAC
color: Gosu::Color.new(0xff_ffffff), color: Gosu::Color.new(0xff_ffffff),
background: Gosu::Color.new(0xff_800000), background: Gosu::Color.new(0xff_800000),
hover: { hover: {
background: Gosu::Color.new(0xff_600000), background: Gosu::Color.new(0xff_c00000),
}, },
active: { active: {
background: Gosu::Color.new(0xff_c00000), background: Gosu::Color.new(0xff_600000),
} }
} }
@@ -49,6 +53,7 @@ module TAC
padding_top: THEME_ITEM_PADDING, padding_top: THEME_ITEM_PADDING,
padding_bottom: THEME_ITEM_PADDING padding_bottom: THEME_ITEM_PADDING
} }
THEME_HIGHLIGHTED_COLOR = Gosu::Color.rgb(255, 175, 0) # Gosu::Color.new(0xff_f080f0)
THEME_EVEN_COLOR = Gosu::Color.new(0xff_202020) THEME_EVEN_COLOR = Gosu::Color.new(0xff_202020)
THEME_ODD_COLOR = Gosu::Color.new(0xff_606060) THEME_ODD_COLOR = Gosu::Color.new(0xff_606060)
THEME_CONTENT_BACKGROUND = Gosu::Color.new(0x88_007f3f) THEME_CONTENT_BACKGROUND = Gosu::Color.new(0x88_007f3f)

View File

@@ -1,187 +0,0 @@
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
Bitstream Vera Fonts Copyright
------------------------------
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
a trademark of Bitstream, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute the
Font Software, including without limitation the rights to use, copy, merge,
publish, distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to the
following conditions:
The above copyright and trademark notices and this permission notice shall
be included in all copies of one or more of the Font Software typefaces.
The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional glyphs or characters may be added to the Fonts, only if the fonts
are renamed to names not containing either the words "Bitstream" or the word
"Vera".
This License becomes null and void to the extent applicable to Fonts or Font
Software that has been modified and is distributed under the "Bitstream
Vera" names.
The Font Software may be sold as part of a larger software package but no
copy of one or more of the Font Software typefaces may be sold by itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
FONT SOFTWARE.
Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font Software
without prior written authorization from the Gnome Foundation or Bitstream
Inc., respectively. For further information, contact: fonts at gnome dot
org.
Arev Fonts Copyright
------------------------------
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and
associated documentation files (the "Font Software"), to reproduce
and distribute the modifications to the Bitstream Vera Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to
the following conditions:
The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.
The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Tavmjong Bah" or the word "Arev".
This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the
"Tavmjong Bah Arev" names.
The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Except as contained in this notice, the name of Tavmjong Bah shall not
be used in advertising or otherwise to promote the sale, use or other
dealings in this Font Software without prior written authorization
from Tavmjong Bah. For further information, contact: tavmjong @ free
. fr.
TeX Gyre DJV Math
-----------------
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Math extensions done by B. Jackowski, P. Strzelczyk and P. Pianowski
(on behalf of TeX users groups) are in public domain.
Letters imported from Euler Fraktur from AMSfonts are (c) American
Mathematical Society (see below).
Bitstream Vera Fonts Copyright
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera
is a trademark of Bitstream, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license (“Fonts”) and associated
documentation
files (the “Font Software”), to reproduce and distribute the Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute,
and/or sell copies of the Font Software, and to permit persons to whom
the Font Software is furnished to do so, subject to the following
conditions:
The above copyright and trademark notices and this permission notice
shall be
included in all copies of one or more of the Font Software typefaces.
The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional
glyphs or characters may be added to the Fonts, only if the fonts are
renamed
to names not containing either the words “Bitstream” or the word “Vera”.
This License becomes null and void to the extent applicable to Fonts or
Font Software
that has been modified and is distributed under the “Bitstream Vera”
names.
The Font Software may be sold as part of a larger software package but
no copy
of one or more of the Font Software typefaces may be sold by itself.
THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN
ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
INABILITY TO USE
THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
Except as contained in this notice, the names of GNOME, the GNOME
Foundation,
and Bitstream Inc., shall not be used in advertising or otherwise to promote
the sale, use or other dealings in this Font Software without prior written
authorization from the GNOME Foundation or Bitstream Inc., respectively.
For further information, contact: fonts at gnome dot org.
AMSFonts (v. 2.2) copyright
The PostScript Type 1 implementation of the AMSFonts produced by and
previously distributed by Blue Sky Research and Y&Y, Inc. are now freely
available for general use. This has been accomplished through the
cooperation
of a consortium of scientific publishers with Blue Sky Research and Y&Y.
Members of this consortium include:
Elsevier Science IBM Corporation Society for Industrial and Applied
Mathematics (SIAM) Springer-Verlag American Mathematical Society (AMS)
In order to assure the authenticity of these fonts, copyright will be
held by
the American Mathematical Society. This is not meant to restrict in any way
the legitimate use of the fonts, such as (but not limited to) electronic
distribution of documents containing these fonts, inclusion of these fonts
into other public domain or commercial font collections or computer
applications, use of the outline data to create derivative fonts and/or
faces, etc. However, the AMS does require that the AMS copyright notice be
removed from any derivative versions of the fonts which have been altered in
any way. In addition, to ensure the fidelity of TeX documents using Computer
Modern fonts, Professor Donald Knuth, creator of the Computer Modern faces,
has requested that any alterations which yield different font metrics be
given a different name.
$Id$

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

93
media/fonts/OFL.txt Normal file
View File

@@ -0,0 +1,93 @@
Copyright 2015-2021 Google LLC. All Rights Reserved.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.