Replaced the Nobile font with Cantarell, added a BOLD_SANS_FONT constant

This commit is contained in:
2020-12-02 17:25:48 -06:00
parent 9aa5dc7174
commit 791351f2f5
21 changed files with 179 additions and 132 deletions

View File

@@ -1,7 +1,8 @@
class IMICFPS
GAME_ROOT_PATH = File.expand_path("..", File.dirname(__FILE__))
SANS_SERIF_FONT = "#{GAME_ROOT_PATH}/static/fonts/Oxygen_Mono/OxygenMono-Regular.ttf"
SANS_FONT = "#{GAME_ROOT_PATH}/static/fonts/Cantarell/Cantarell-Regular.otf"
BOLD_SANS_FONT = "#{GAME_ROOT_PATH}/static/fonts/Cantarell/Cantarell-Bold.otf"
MONOSPACE_FONT = "#{GAME_ROOT_PATH}/static/fonts/Oxygen_Mono/OxygenMono-Regular.ttf"
# Objects exported from blender using the default or meter object scale will be close to 1 GL unit

View File

@@ -12,7 +12,7 @@ class IMICFPS
shadow_alpha: 0,
shadow_color: Gosu::Color::WHITE,
mode: :add,
font: SANS_SERIF_FONT
font: SANS_FONT
)
@last_message_time = 0

View File

@@ -13,7 +13,7 @@ class IMICFPS
"MATE\nTinyTanker\nOther Player Dude\nHuman 0xdeadbeef",
size: 18,
mode: :add,
font: SANS_SERIF_FONT,
font: SANS_FONT,
color: @color,
shadow: true,
shadow_color: 0x88000000,

View File

@@ -1,7 +1,7 @@
class IMICFPS
module EntityManager # Get included into GameState context
def add_entity(entity)
@collision_manager.add(entity) if @collision_manager && entity.manifest.collision# Add every entity to collision manager
@collision_manager.add(entity) if @collision_manager && entity.manifest.collision # Add every entity to collision manager
Publisher.instance.publish(:create, nil, entity)
@entities << entity
end

View File

@@ -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, 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)
@subheading = Text.new("Loading Map: #{@map_parser.metadata.name}", y: 100, size: 50, alignment: :center, font: SANS_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_FONT)
@state = Text.new("Preparing...", y: window.height/2-40, size: 40, alignment: :center, font: SANS_FONT)
@percentage = Text.new("0%", y: window.height - 100 + 25, size: 50, alignment: :center, font: SANS_FONT)
@dummy_entity = nil
@assets = []

View File

@@ -1,14 +1,14 @@
class IMICFPS
class MapEditorTool
class Editor < CyberarmEngine::GuiState
attr_reader :map
def setup
# TODO: Move everything required for a playable game map
# in to a Scene or Scene3D container object
# and refactor Game to use it.
Publisher.new
@map = Map.new( map_parser: @options[:map_parser] )
@map = Map.new(map_parser: @options[:map_parser])
@camera = PerspectiveCamera.new( position: Vector.new, aspect_ratio: window.aspect_ratio )
@editor = IMICFPS::Editor.new( manifest: Manifest.new(package: "base", name: "editor") )
@camera_controller = CameraController.new(camera: @camera, entity: @editor)

View File

@@ -20,27 +20,54 @@ 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})", font: MONOSPACE_FONT)
@__version_text = CyberarmEngine::Text.new("<b>#{IMICFPS::NAME}</b> v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME})", font: BOLD_SANS_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 } })
theme(
{
Label:
{
font: SANS_FONT
},
Button:
{
font: BOLD_SANS_FONT,
background: [0xff222222, 0xff3A3A3E],
border_color: [0xaa_111111, 0xaa_000000],
border_thickness: 2,
text_align: :center,
# color: 0xffff8800,
color: 0xffffffff,
hover: {
background: [0xff444444, 0xff5A5A5E],
color: 0xffeeeeee
},
active: {
color: Gosu::Color::WHITE,
background: [0xff222222, 0xff1A1A1E]
}
}
}
)
end
def title(text, color = Gosu::Color::BLACK)
@elements << Text.new(text, color: color, size: 100, x: 0, y: 15, font: SANS_SERIF_FONT)
@elements << Text.new(text, color: color, size: 100, x: 0, y: 15, font: BOLD_SANS_FONT)
@_title = @elements.last
end
def subtitle(text, color = Gosu::Color::WHITE)
@elements << Text.new(text, color: color, size: 50, x: 0, y: 100, font: SANS_SERIF_FONT)
@elements << Text.new(text, color: color, size: 50, x: 0, y: 100, font: SANS_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), font: SANS_SERIF_FONT)
text = Text.new(text, color: color, size: 50, x: 0, y: 100 + (60 * @elements.count), font: BOLD_SANS_FONT)
@elements << Link.new(text, self, block)
end