note
	description: "[
		Shared widget constants for the VITP game.
		Values are in millimeters as measured on the actual game board.
		]"
	author: "Jimmy J. Johnson"

class
	FONT_AND_COLOR_CONSTANTS

feature -- Access

--	Default_line_width: INTEGER = 1
	Land_boundary_width: INTEGER = 1
	Port_boundary_width: INTEGER = 2
	Sea_boundary_width: INTEGER = 4

		-- Set this big for creation and then scale down
	unit_widget_size: INTEGER = 200
	air_unit_widget_size: INTEGER = 160

	unit_name_font_size: INTEGER = 40
	unit_speed_font_size: INTEGER = 60
	unit_air_font_size: INTEGER = 50
	air_unit_font_size: INTEGER = 50

feature -- fonts

	Big_test_font: EV_FONT
		once
			create Result
			Result.set_height (150)
		end

	Default_font: EV_FONT
		once
			create Result
			Result.set_height (12)
		end

	Port_font: EV_FONT
			-- The font to use for port names
		once
			create Result
			Result.set_height (4)
		end

	Major_port_font: EV_FONT
			-- The font to use for the name of major ports
		once
			create Result
			Result.set_height (6)
			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
		end

	Sea_area_font: EV_FONT
			-- The base font to use for text in sea areas
		once
			create Result
			Result.set_family ({EV_FONT_CONSTANTS}.family_sans)
			Result.set_height (7)
			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
			Result.set_shape ({EV_FONT_CONSTANTS}.Shape_italic)
		end

	Subtext_font: EV_FONT
			-- Text to use for line of text under the sea area names
		once
			create Result
			Result.set_height (3)
		end

	POC_font: EV_FONT
			-- Font for the POC numbers in the sea areas
		once
			create Result
			Result.set_height (3)
			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
		end

	unit_name_font: EV_FONT
			-- Font for the ship name that is on the tiles
		once
			create Result
			Result.set_height (unit_name_font_size)
		end

	unit_speed_font: EV_FONT
			-- Font for the ship's gunnery, armor, and speed factors
			-- when placed on a ship widget
		once
			create Result
			Result.set_height (unit_speed_font_size)
		end

	unit_air_font: EV_FONT
			-- Font for the ship's air attack factor
		once
			create Result
			Result.set_height (unit_air_font_size)
			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
		end

	air_unit_font: EV_FONT
			-- Font for the air unit's attack factors
		once
			create Result
			Result.set_height (air_unit_font_size)
--			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
		end

feature -- Colors

	lightened (a_color: EV_COLOR; a_value: REAL): EV_COLOR
			-- A new color produced by multiplying by `a_value', that "redestributes
			-- excess [rbg] values to keep the hue intact."
			-- See https://stackoverflow.com/questions/141855/programmatically-lighten-a-color	
		local
			r, g, b: REAL
			m: REAL
			thres: REAL
			tot, x, gray: REAL
		do
			create Result
			thres := 1.0
			r := a_color.red * a_value
			g := a_color.green * a_value
			b := a_color.blue * a_value
			m := r.max (g.max (b))
			if m <= thres then
				Result.set_rgb (r, g, b)
			else
				tot := r + g + b
				if tot >= 3 * thres then
					Result.set_rgb (thres, thres, thres)
				else
					x := (3 * thres - tot) / (3 * m - tot)
					gray := thres - x * m
					Result.set_rgb (gray + x * r, gray + x * g, gray + x * b)
				end
			end
		end

	White: EV_COLOR once create Result.make_with_rgb (1.0, 1.0, 1.0) end
	Black: EV_COLOR once create Result.make_with_rgb (0.0, 0.0, 0.0) end
	Dark_grey: EV_COLOR once create Result.make_with_rgb (0.3, 0.3, 0.3) end
	Medium_grey:  EV_COLOR once create Result.make_with_rgb (0.4, 0.4, 0.4) end
	Light_grey: EV_COLOR once create Result.make_with_rgb (0.95, 0.95, 0.95) end

	Silver: EV_COLOR once create Result.make_with_rgb (0.620 , 0.627 , 0.631) end
	Yellow: EV_COLOR once create Result.make_with_rgb (0.93 , 0.93, 0.0) end
	Steel: EV_COLOR once create Result.make_with_rgb (0.137 , 0.418 , 0.555) end
	Cyan: EV_COLOR once create Result.make_with_rgb (0.0 , 0.9 , 0.9) end
	Chrome: EV_COLOR once create Result.make_with_rgb (0.890, 0.871, 0.859) end
	Bronze: EV_COLOR once create Result.make_with_rgb (0.588, 0.455, 0.267) end

	Green: EV_COLOR once create Result.make_with_rgb (0.0, 1.0, 0.0) end
	Default_color: EV_COLOR once create Result.make_with_rgb (1.0, 1.0, 1.0) end
	Japanese_unit_boarder_color: EV_COLOR once create Result.make_with_rgb (1.0, 0.0, 0.0) end
	Japanese_unit_color: EV_COLOR once create Result.make_with_rgb (1.0, 0.3, 0.3) end
	Japanese_unit_color_dim: EV_COLOR once create Result.make_with_rgb (1.0, 0.8, 0.8) end
	Allied_unit_boarder_color: EV_COLOR once create Result.make_with_rgb (0.0, 0.0, 1.0) end

	US_unit_color: EV_COLOR once create Result.make_with_rgb (0.1, 0.4, 0.8) end

	US_unit_color_dim: EV_COLOR once create Result.make_with_rgb (0.8, 0.8, 1.0) end
	British_unit_color: EV_COLOR once create Result.make_with_rgb (0.4, 0.7, 0.8) end
	Dutch_unit_color: EV_COLOR once create Result.make_with_rgb (0.4, 0.9, 0.5) end
	Japanese_air_unit_color: EV_COLOR once create Result.make_with_rgb (1.0, 1.0, 0.0) end
	US_air_unit_color: EV_COLOR once create Result.make_with_rgb (0.5, 0.8, 0.8) end
	Japanese_submarine_color: EV_COLOR once create Result.make_with_rgb (0.95, 0.95, 0.95) end
	US_submarine_color: EV_COLOR once create Result.make_with_rgb (0.9, 0.9, 0.9) end
	Land_boundary_color: EV_COLOR once create Result.make_with_rgb (0.418, 0.258, 0.148) end
	Default_land_color: EV_COLOR once create Result.make_with_rgb (0.9, 0.7, 0.5) end

	Sea_area_color: EV_COLOR once create Result.make_with_rgb (0.0, 0.5, 0.7) end

	Red_port_color: EV_COLOR once create Result.make_with_rgb (1.0, 0.1, 0.35) end
	Green_port_color: EV_COLOR once create Result.make_with_rgb (0.6, 0.9, 0.2) end

	US_flag_red_color: EV_COLOR once create Result.make_with_rgb (1.0, 0.0, 0.0) end
	US_flag_white_color: EV_COLOR once create Result.make_with_rgb (1.0, 1.0, 1.0) end
	US_flag_blue_color: EV_COLOR once create Result.make_with_rgb (0.0, 0.0, 1.0) end

	arrow_color: EV_COLOR once create Result.make_with_rgb (0.4, 0.8, 0.3) end
	US_retical_color: EV_COLOR once create Result.make_with_rgb (0.0, 0.0, 0.7) end
	Japanese_retical_color: EV_COLOR once create Result.make_with_rgb (0.7, 0.2, 0.2) end

end
