mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Use fonts everywhere, misc. tweaks
This commit is contained in:
@@ -11,7 +11,7 @@ class IMICFPS
|
||||
|
||||
@distance = 4
|
||||
@origin_distance = @distance
|
||||
@constant_pitch = 0
|
||||
@constant_pitch = 20.0
|
||||
|
||||
window.mouse_x, window.mouse_y = window.width / 2, window.height / 2
|
||||
|
||||
@@ -45,7 +45,7 @@ class IMICFPS
|
||||
x_offset = horizontal_distance_from_object * Math.sin(@entity.orientation.y.degrees_to_radians)
|
||||
z_offset = horizontal_distance_from_object * Math.cos(@entity.orientation.y.degrees_to_radians)
|
||||
|
||||
eye_height = @entity.bounding_box.max.y
|
||||
eye_height = @entity.normalize_bounding_box.max.y
|
||||
|
||||
@camera.position.x = @entity.position.x - x_offset
|
||||
@camera.position.y = @entity.position.y + eye_height
|
||||
|
||||
@@ -40,6 +40,7 @@ class IMICFPS
|
||||
|
||||
def backward
|
||||
@velocity.z -= Math.cos(relative_y_rotation * Math::PI / 180) * relative_speed
|
||||
@velocity.y += Math.sin(@orientation.x * Math::PI / 180) * relative_speed
|
||||
@velocity.x += Math.sin(relative_y_rotation * Math::PI / 180) * relative_speed
|
||||
end
|
||||
|
||||
@@ -62,12 +63,11 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def ascend
|
||||
@velocity.y += 1 * delta_time
|
||||
@velocity.y += relative_speed
|
||||
end
|
||||
alias :jump :ascend
|
||||
|
||||
def descend
|
||||
@velocity.y -= 1 * delta_time
|
||||
@velocity.y -= relative_speed
|
||||
end
|
||||
|
||||
def toggle_first_person_view
|
||||
|
||||
@@ -61,7 +61,8 @@ class IMICFPS
|
||||
data[:teams][1][:credits] = data[:players].select { |player| player[:team] == 1 }.map { |player| player[:credits] }.reduce(0, :+)
|
||||
data[:teams][1][:score] = data[:players].select { |player| player[:team] == 1 }.map { |player| player[:score] }.reduce(0, :+)
|
||||
|
||||
data[:players].sort! { |player| player[:score] }
|
||||
data[:teams] = data[:teams].sort_by { |team| team[:score] }.reverse
|
||||
data[:players] = data[:players].sort_by { |player| player[:score] }.reverse
|
||||
|
||||
return data
|
||||
end
|
||||
@@ -75,14 +76,16 @@ class IMICFPS
|
||||
text = ""
|
||||
text += "# Team Credits Score\n"
|
||||
data[:teams].each_with_index do |team, i|
|
||||
text += "<c=#{i.even? ? 'ffe66100' : 'ffa51d2d'}>#{i} #{team[:name]} #{i.even? ? team[:credits] : '-----'} #{team[:score]}</c>\n"
|
||||
i += 1
|
||||
text += "<c=#{team[:name] == "Compass" ? 'ffe66100' : 'ffa51d2d'}>#{i} #{team[:name]} #{i.even? ? team[:credits] : '-----'} #{team[:score]}</c>\n"
|
||||
end
|
||||
|
||||
text += "\n"
|
||||
|
||||
text += "# Name Credits Score\n"
|
||||
data[:players].each_with_index do |player, i|
|
||||
text += "<c=#{i.even? ? 'ffe66100' : 'ffa51d2d'}>#{i} #{player[:username]} #{i.even? ? player[:credits] : '-----'} #{player[:score]}</c>\n"
|
||||
i += 1
|
||||
text += "<c=#{player[:team].even? ? 'ffe66100' : 'ffa51d2d'}>#{i} #{player[:username]} #{player[:team].even? ? player[:credits] : '-----'} #{player[:score]}</c>\n"
|
||||
end
|
||||
|
||||
@text.text = text
|
||||
|
||||
@@ -3,9 +3,18 @@ class IMICFPS
|
||||
class SquadWidget < HUD::Widget
|
||||
def setup
|
||||
@size = 288 # RADAR size
|
||||
@color = Gosu::Color.new(0x8800aa00)
|
||||
@color = Gosu::Color.new(0xff00aa00)
|
||||
|
||||
@text = Text.new("MATE\nTinyTanker\nOther Player Dude\nHuman 0xdeadbeef", size: 18, mode: :add, font: MONOSPACE_FONT, color: @color)
|
||||
@text = Text.new(
|
||||
"MATE\nTinyTanker\nOther Player Dude\nHuman 0xdeadbeef",
|
||||
size: 18,
|
||||
mode: :add,
|
||||
font: SANS_SERIF_FONT,
|
||||
color: @color,
|
||||
shadow: true,
|
||||
shadow_color: 0x88000000,
|
||||
shadow_size: 0.75
|
||||
)
|
||||
end
|
||||
|
||||
def draw
|
||||
|
||||
@@ -58,12 +58,14 @@ eos
|
||||
InputMapper.keys.each do |key, pressed|
|
||||
next unless pressed
|
||||
|
||||
action = InputMapper.action(key)
|
||||
next unless action
|
||||
actions = InputMapper.action(key)
|
||||
next unless actions
|
||||
|
||||
actions.each do |action|
|
||||
@player.send(action) if @player.respond_to?(action)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def button_down(id)
|
||||
if id == Gosu::KB_ESCAPE
|
||||
|
||||
@@ -11,10 +11,10 @@ class IMICFPS
|
||||
end
|
||||
|
||||
title IMICFPS::NAME
|
||||
@subheading = Text.new("Loading Map: #{@map_parser.metadata.name}", y: 100, size: 50, alignment: :center)
|
||||
@description = Text.new("Map created by: #{@map_parser.metadata.authors.join(", ")}\n#{@map_parser.metadata.description}", y: 180, size: 24, alignment: :center)
|
||||
@state = Text.new("Preparing...", y: window.height/2-40, size: 40, alignment: :center)
|
||||
@percentage = Text.new("0%", y: window.height - 100 + 25, size: 50, alignment: :center)
|
||||
@subheading = Text.new("Loading Map: #{@map_parser.metadata.name}", y: 100, size: 50, alignment: :center, font: SANS_SERIF_FONT)
|
||||
@description = Text.new("Map created by: #{@map_parser.metadata.authors.join(", ")}\n#{@map_parser.metadata.description}", y: 180, size: 24, alignment: :center, font: SANS_SERIF_FONT)
|
||||
@state = Text.new("Preparing...", y: window.height/2-40, size: 40, alignment: :center, font: SANS_SERIF_FONT)
|
||||
@percentage = Text.new("0%", y: window.height - 100 + 25, size: 50, alignment: :center, font: MONOSPACE_FONT)
|
||||
|
||||
@dummy_entity = nil
|
||||
@assets = []
|
||||
|
||||
@@ -21,7 +21,7 @@ class IMICFPS
|
||||
@light = Light.new(type: Light::DIRECTIONAL, id: available_light, position: Vector.new, diffuse: Vector.new(1, 1, 1, 1))
|
||||
@lights << @light
|
||||
|
||||
@camera = Camera.new(position: Vector.new(0, 1.5, 5), orientation: Vector.forward)
|
||||
@camera = PerspectiveCamera.new(aspect_ratio: window.aspect_ratio, position: Vector.new(0, 1.5, 5), orientation: Vector.forward)
|
||||
|
||||
label @manifest.name, text_size: 50
|
||||
label @manifest.model
|
||||
@@ -56,7 +56,7 @@ class IMICFPS
|
||||
def update
|
||||
super
|
||||
|
||||
@camera.update
|
||||
# @camera.update
|
||||
@light.position = @camera.position.clone
|
||||
@light.position.y += 1.5
|
||||
@camera_position.value = "Camera Position: X #{@camera.position.x.round(2)}, Y #{@camera.position.y.round(2)}, Z #{@camera.position.z.round(2)}"
|
||||
|
||||
@@ -15,6 +15,7 @@ class IMICFPS
|
||||
@crosshair = Crosshair.new
|
||||
|
||||
@map.setup
|
||||
@map.add_entity(@editor)
|
||||
end
|
||||
|
||||
def draw
|
||||
@@ -45,7 +46,7 @@ class IMICFPS
|
||||
end
|
||||
end
|
||||
|
||||
@editor.update
|
||||
@editor.orientation.x = @camera.orientation.x
|
||||
end
|
||||
|
||||
def button_down(id)
|
||||
|
||||
@@ -10,10 +10,10 @@ class IMICFPS
|
||||
@width = window.width / 4 * 3
|
||||
@height = window.height / 4 * 3
|
||||
|
||||
@input = Text.new("", x: 4, y: @height - (PADDING * 2), z: Console::Z + 1)
|
||||
@input = Text.new("", x: 4, y: @height - (PADDING * 2), z: Console::Z + 1, font: MONOSPACE_FONT)
|
||||
@input.y -= @input.height
|
||||
|
||||
@history = Text.new("=== #{IMICFPS::NAME} v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME}) ===\n\n", x: 4, z: Console::Z + 1)
|
||||
@history = Text.new("=== #{IMICFPS::NAME} v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME}) ===\n\n", x: 4, z: Console::Z + 1, font: MONOSPACE_FONT)
|
||||
update_history_y
|
||||
|
||||
@command_history = []
|
||||
|
||||
@@ -20,24 +20,27 @@ class IMICFPS
|
||||
@accent_color = ACCENT_COLOR
|
||||
window.needs_cursor = true
|
||||
|
||||
@__version_text = CyberarmEngine::Text.new("<b>#{IMICFPS::NAME}</b> v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME})")
|
||||
@__version_text = CyberarmEngine::Text.new("<b>#{IMICFPS::NAME}</b> v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME})", font: MONOSPACE_FONT)
|
||||
@__version_text.x = window.width - (@__version_text.width + 10)
|
||||
@__version_text.y = window.height - (@__version_text.height + 10)
|
||||
|
||||
super(*args)
|
||||
|
||||
theme({ Label: { font: SANS_SERIF_FONT } })
|
||||
end
|
||||
|
||||
def title(text, color = Gosu::Color::BLACK)
|
||||
@elements << Text.new(text, color: color, size: 100, x: 0, y: 15)
|
||||
@elements << Text.new(text, color: color, size: 100, x: 0, y: 15, font: SANS_SERIF_FONT)
|
||||
@_title = @elements.last
|
||||
end
|
||||
|
||||
def subtitle(text, color = Gosu::Color::WHITE)
|
||||
@elements << Text.new(text, color: color, size: 50, x: 0, y: 100)
|
||||
@elements << Text.new(text, color: color, size: 50, x: 0, y: 100, font: SANS_SERIF_FONT)
|
||||
@_subtitle = @elements.last
|
||||
end
|
||||
|
||||
def link(text, color = Gosu::Color.rgb(0,127,127), &block)
|
||||
text = Text.new(text, color: color, size: 50, x: 0, y: 100 + (60 * @elements.count))
|
||||
text = Text.new(text, color: color, size: 50, x: 0, y: 100 + (60 * @elements.count), font: SANS_SERIF_FONT)
|
||||
@elements << Link.new(text, self, block)
|
||||
end
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"skydome":{
|
||||
"package":"base",
|
||||
"name":"skydome",
|
||||
"scale":0.08
|
||||
"scale":0.37
|
||||
},
|
||||
|
||||
"lights":[
|
||||
|
||||
Reference in New Issue
Block a user