Skip to content

Commit

Permalink
Small label style manipulations
Browse files Browse the repository at this point in the history
Minor changes to the way labels look in different places to make them look better.
  • Loading branch information
logicalgroove authored Mar 24, 2023
2 parents 8b306c8 + 0a98030 commit b24ef39
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
22 changes: 22 additions & 0 deletions app/labels.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module Labels
class << self
def controls(args)
labels = []

labels << label(
:controls_title,
x: args.grid.right - 24, y: 112,
size: SIZE_SM, align: ALIGN_RIGHT)
labels << label(
args.inputs.controller_one.connected ? :controls_gamepad : :controls_keyboard,
x: args.grid.right - 24, y: 76,
size: SIZE_XS, align: ALIGN_RIGHT, a: 200)
labels << label(
args.inputs.controller_one.connected ? :controls2_gamepad : :controls2_keyboard,
x: args.grid.right - 24, y: 48,
size: SIZE_XS, align: ALIGN_RIGHT, a: 200)

labels
end
end
end
4 changes: 3 additions & 1 deletion app/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@
"HIRO-R-B",
"Vlevo",
"F-3r",
"Elwampa",
].shuffle

require "app/input.rb"
require "app/sprite.rb"

require "app/artifact.rb"
require "app/boss.rb"
require "app/camera.rb"
require "app/cards.rb"
require "app/collision.rb"
require "app/boss.rb"
require "app/constants.rb"
require "app/difficulty.rb"
require "app/enemy.rb"
require "app/familiar.rb"
require "app/fireworks.rb"
require "app/game_setting.rb"
require "app/hud.rb"
require "app/labels.rb"
require "app/legged_creature.rb"
require "app/level.rb"
require "app/level_generation/maze_generator.rb"
Expand Down
17 changes: 3 additions & 14 deletions app/scenes/main_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,10 @@ def tick_main_menu(args)
labels << CREDITS.map_with_index do |name, i|
label(
name,
x: args.grid.left + 48, y: args.grid.top - 50 - 25*i,
size: SIZE_SM, align: ALIGN_LEFT)
x: args.grid.left + 48, y: args.grid.top - 70 - 25*i,
size: SIZE_XS, align: ALIGN_LEFT, a: 200)
end
labels << label(
:controls_title,
x: args.grid.right - 24, y: 112,
size: SIZE_SM, align: ALIGN_RIGHT)
labels << label(
args.inputs.controller_one.connected ? :controls_gamepad : :controls_keyboard,
x: args.grid.right - 24, y: 76,
size: SIZE_XS, align: ALIGN_RIGHT)
labels << label(
args.inputs.controller_one.connected ? :controls2_gamepad : :controls2_keyboard,
x: args.grid.right - 24, y: 48,
size: SIZE_XS, align: ALIGN_RIGHT)
labels << Labels.controls(args)
end

def reset_main_menu(args)
Expand Down
1 change: 1 addition & 0 deletions app/scenes/paused.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def tick_paused(args)
Menu.tick(args, :paused, options)

args.outputs.labels << label(:paused, x: args.grid.w / 2, y: args.grid.top - 200, align: ALIGN_CENTER, size: SIZE_LG, font: FONT_BOLD)
args.outputs.labels << Labels.controls(args)
end

def reset_paused(args)
Expand Down
3 changes: 2 additions & 1 deletion app/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ def text(key)

# Friendly method with sensible defaults for creating DRGTK label data
# structures.
def label(value_or_key, x:, y:, align: ALIGN_LEFT, size: SIZE_MD, color: WHITE, font: FONT_REGULAR)
def label(value_or_key, x:, y:, align: ALIGN_LEFT, size: SIZE_MD, color: WHITE, font: FONT_REGULAR, a: 255)
{
text: value_or_key.is_a?(Symbol) ? text(value_or_key) : value_or_key,
x: x,
y: y,
alignment_enum: align,
size_enum: size,
font: font,
a: a
}.label!(color)
end

0 comments on commit b24ef39

Please sign in to comment.