def pbDrawTextPositions now uses symbols for text alignment and outline, and added a quicker way to draw text with no shadow/outline

This commit is contained in:
Maruno17
2023-04-04 21:16:09 +01:00
parent e7847fba9a
commit cb4a1fd8af
27 changed files with 295 additions and 279 deletions

View File

@@ -430,17 +430,17 @@ class PokemonPokedex_Scene
end
end
textpos = [
[dexname, Graphics.width / 2, 10, 2, Color.new(248, 248, 248), Color.black]
[dexname, Graphics.width / 2, 10, :center, Color.new(248, 248, 248), Color.black]
]
textpos.push([GameData::Species.get(iconspecies).name, 112, 58, 2, base, shadow]) if iconspecies
textpos.push([GameData::Species.get(iconspecies).name, 112, 58, :center, base, shadow]) if iconspecies
if @searchResults
textpos.push([_INTL("Search results"), 112, 314, 2, base, shadow])
textpos.push([@dexlist.length.to_s, 112, 346, 2, base, shadow])
textpos.push([_INTL("Search results"), 112, 314, :center, base, shadow])
textpos.push([@dexlist.length.to_s, 112, 346, :center, base, shadow])
else
textpos.push([_INTL("Seen:"), 42, 314, 0, base, shadow])
textpos.push([$player.pokedex.seen_count(pbGetPokedexRegion).to_s, 182, 314, 1, base, shadow])
textpos.push([_INTL("Owned:"), 42, 346, 0, base, shadow])
textpos.push([$player.pokedex.owned_count(pbGetPokedexRegion).to_s, 182, 346, 1, base, shadow])
textpos.push([_INTL("Seen:"), 42, 314, :left, base, shadow])
textpos.push([$player.pokedex.seen_count(pbGetPokedexRegion).to_s, 182, 314, :right, base, shadow])
textpos.push([_INTL("Owned:"), 42, 346, :left, base, shadow])
textpos.push([$player.pokedex.owned_count(pbGetPokedexRegion).to_s, 182, 346, :right, base, shadow])
end
# Draw all text
pbDrawTextPositions(overlay, textpos)
@@ -483,36 +483,36 @@ class PokemonPokedex_Scene
shadow = Color.new(72, 72, 72)
# Write various bits of text
textpos = [
[_INTL("Search Mode"), Graphics.width / 2, 10, 2, base, shadow],
[_INTL("Order"), 136, 64, 2, base, shadow],
[_INTL("Name"), 58, 122, 2, base, shadow],
[_INTL("Type"), 58, 174, 2, base, shadow],
[_INTL("Height"), 58, 226, 2, base, shadow],
[_INTL("Weight"), 58, 278, 2, base, shadow],
[_INTL("Color"), 326, 122, 2, base, shadow],
[_INTL("Shape"), 454, 174, 2, base, shadow],
[_INTL("Reset"), 80, 346, 2, base, shadow, 1],
[_INTL("Start"), Graphics.width / 2, 346, 2, base, shadow, 1],
[_INTL("Cancel"), Graphics.width - 80, 346, 2, base, shadow, 1]
[_INTL("Search Mode"), Graphics.width / 2, 10, :center, base, shadow],
[_INTL("Order"), 136, 64, :center, base, shadow],
[_INTL("Name"), 58, 122, :center, base, shadow],
[_INTL("Type"), 58, 174, :center, base, shadow],
[_INTL("Height"), 58, 226, :center, base, shadow],
[_INTL("Weight"), 58, 278, :center, base, shadow],
[_INTL("Color"), 326, 122, :center, base, shadow],
[_INTL("Shape"), 454, 174, :center, base, shadow],
[_INTL("Reset"), 80, 346, :center, base, shadow, 1],
[_INTL("Start"), Graphics.width / 2, 346, :center, base, shadow, :outline],
[_INTL("Cancel"), Graphics.width - 80, 346, :center, base, shadow, :outline]
]
# Write order, name and color parameters
textpos.push([@orderCommands[params[0]], 344, 66, 2, base, shadow, 1])
textpos.push([(params[1] < 0) ? "----" : @nameCommands[params[1]], 176, 124, 2, base, shadow, 1])
textpos.push([(params[8] < 0) ? "----" : @colorCommands[params[8]].name, 444, 124, 2, base, shadow, 1])
textpos.push([@orderCommands[params[0]], 344, 66, :center, base, shadow, :outline])
textpos.push([(params[1] < 0) ? "----" : @nameCommands[params[1]], 176, 124, :center, base, shadow, :outline])
textpos.push([(params[8] < 0) ? "----" : @colorCommands[params[8]].name, 444, 124, :center, base, shadow, :outline])
# Draw type icons
if params[2] >= 0
type_number = @typeCommands[params[2]].icon_position
typerect = Rect.new(0, type_number * 32, 96, 32)
overlay.blt(128, 168, @typebitmap.bitmap, typerect)
else
textpos.push(["----", 176, 176, 2, base, shadow, 1])
textpos.push(["----", 176, 176, :center, base, shadow, :outline])
end
if params[3] >= 0
type_number = @typeCommands[params[3]].icon_position
typerect = Rect.new(0, type_number * 32, 96, 32)
overlay.blt(256, 168, @typebitmap.bitmap, typerect)
else
textpos.push(["----", 304, 176, 2, base, shadow, 1])
textpos.push(["----", 304, 176, :center, base, shadow, :outline])
end
# Write height and weight limits
ht1 = (params[4] < 0) ? 0 : (params[4] >= @heightCommands.length) ? 999 : @heightCommands[params[4]]
@@ -525,16 +525,16 @@ class PokemonPokedex_Scene
ht2 = (params[5] < 0) ? 99 * 12 : (ht2 / 0.254).round
wt1 = (params[6] >= @weightCommands.length) ? 99_990 : (wt1 / 0.254).round
wt2 = (params[7] < 0) ? 99_990 : (wt2 / 0.254).round
textpos.push([sprintf("%d'%02d''", ht1 / 12, ht1 % 12), 166, 228, 2, base, shadow, 1])
textpos.push([sprintf("%d'%02d''", ht2 / 12, ht2 % 12), 294, 228, 2, base, shadow, 1])
textpos.push([sprintf("%.1f", wt1 / 10.0), 166, 280, 2, base, shadow, 1])
textpos.push([sprintf("%.1f", wt2 / 10.0), 294, 280, 2, base, shadow, 1])
textpos.push([sprintf("%d'%02d''", ht1 / 12, ht1 % 12), 166, 228, :center, base, shadow, :outline])
textpos.push([sprintf("%d'%02d''", ht2 / 12, ht2 % 12), 294, 228, :center, base, shadow, :outline])
textpos.push([sprintf("%.1f", wt1 / 10.0), 166, 280, :center, base, shadow, :outline])
textpos.push([sprintf("%.1f", wt2 / 10.0), 294, 280, :center, base, shadow, :outline])
hwoffset = true
else
textpos.push([sprintf("%.1f", ht1 / 10.0), 166, 228, 2, base, shadow, 1])
textpos.push([sprintf("%.1f", ht2 / 10.0), 294, 228, 2, base, shadow, 1])
textpos.push([sprintf("%.1f", wt1 / 10.0), 166, 280, 2, base, shadow, 1])
textpos.push([sprintf("%.1f", wt2 / 10.0), 294, 280, 2, base, shadow, 1])
textpos.push([sprintf("%.1f", ht1 / 10.0), 166, 228, :center, base, shadow, :outline])
textpos.push([sprintf("%.1f", ht2 / 10.0), 294, 228, :center, base, shadow, :outline])
textpos.push([sprintf("%.1f", wt1 / 10.0), 166, 280, :center, base, shadow, :outline])
textpos.push([sprintf("%.1f", wt2 / 10.0), 294, 280, :center, base, shadow, :outline])
end
overlay.blt(344, 214, @hwbitmap.bitmap, Rect.new(0, (hwoffset) ? 44 : 0, 32, 44))
overlay.blt(344, 266, @hwbitmap.bitmap, Rect.new(32, (hwoffset) ? 44 : 0, 32, 44))
@@ -555,13 +555,13 @@ class PokemonPokedex_Scene
shadow = Color.new(72, 72, 72)
# Write various bits of text
textpos = [
[_INTL("Search Mode"), Graphics.width / 2, 10, 2, base, shadow],
[_INTL("OK"), 80, 346, 2, base, shadow, 1],
[_INTL("Cancel"), Graphics.width - 80, 346, 2, base, shadow, 1]
[_INTL("Search Mode"), Graphics.width / 2, 10, :center, base, shadow],
[_INTL("OK"), 80, 346, :center, base, shadow, :outline],
[_INTL("Cancel"), Graphics.width - 80, 346, :center, base, shadow, :outline]
]
title = [_INTL("Order"), _INTL("Name"), _INTL("Type"), _INTL("Height"),
_INTL("Weight"), _INTL("Color"), _INTL("Shape")][mode]
textpos.push([title, 102, (mode == 6) ? 70 : 64, 0, base, shadow])
textpos.push([title, 102, (mode == 6) ? 70 : 64, :left, base, shadow])
case mode
when 0 # Order
xstart = 46
@@ -621,7 +621,7 @@ class PokemonPokedex_Scene
when 2 # Type icons
2.times do |i|
if !sel[i] || sel[i] < 0
textpos.push(["----", 298 + (128 * i), 66, 2, base, shadow, 1])
textpos.push(["----", 298 + (128 * i), 66, :center, base, shadow, :outline])
else
type_number = @typeCommands[sel[i]].icon_position
typerect = Rect.new(0, type_number * 32, 96, 32)
@@ -642,8 +642,8 @@ class PokemonPokedex_Scene
txt1 = sprintf("%.1f", ht1 / 10.0)
txt2 = sprintf("%.1f", ht2 / 10.0)
end
textpos.push([txt1, 286, 66, 2, base, shadow, 1])
textpos.push([txt2, 414, 66, 2, base, shadow, 1])
textpos.push([txt1, 286, 66, :center, base, shadow, :outline])
textpos.push([txt2, 414, 66, :center, base, shadow, :outline])
overlay.blt(462, 52, @hwbitmap.bitmap, Rect.new(0, (hwoffset) ? 44 : 0, 32, 44))
when 4 # Weight range
wt1 = (sel[0] < 0) ? 0 : (sel[0] >= @weightCommands.length) ? 9999 : @weightCommands[sel[0]]
@@ -659,14 +659,14 @@ class PokemonPokedex_Scene
txt1 = sprintf("%.1f", wt1 / 10.0)
txt2 = sprintf("%.1f", wt2 / 10.0)
end
textpos.push([txt1, 286, 66, 2, base, shadow, 1])
textpos.push([txt2, 414, 66, 2, base, shadow, 1])
textpos.push([txt1, 286, 66, :center, base, shadow, :outline])
textpos.push([txt2, 414, 66, :center, base, shadow, :outline])
overlay.blt(462, 52, @hwbitmap.bitmap, Rect.new(32, (hwoffset) ? 44 : 0, 32, 44))
when 5 # Color
if sel[0] < 0
textpos.push(["----", 362, 66, 2, base, shadow, 1])
textpos.push(["----", 362, 66, :center, base, shadow, :outline])
else
textpos.push([cmds[sel[0]].name, 362, 66, 2, base, shadow, 1])
textpos.push([cmds[sel[0]].name, 362, 66, :center, base, shadow, :outline])
end
when 6 # Shape icon
if sel[0] >= 0
@@ -676,9 +676,9 @@ class PokemonPokedex_Scene
else
if sel[0] < 0
text = ["----", "-", "----", "", "", "----", ""][mode]
textpos.push([text, 362, 66, 2, base, shadow, 1])
textpos.push([text, 362, 66, :center, base, shadow, :outline])
else
textpos.push([cmds[sel[0]], 362, 66, 2, base, shadow, 1])
textpos.push([cmds[sel[0]], 362, 66, :center, base, shadow, :outline])
end
end
# Draw selected option(s) button graphic
@@ -698,8 +698,8 @@ class PokemonPokedex_Scene
overlay.blt(xpos2, ystart, @searchsliderbitmap.bitmap, hwrect)
hwrect.y = 96
overlay.blt(xpos1, ystart + ygap, @searchsliderbitmap.bitmap, hwrect)
textpos.push([txt1, xpos1 + halfwidth, ypos1, 2, base, nil, 1])
textpos.push([txt2, xpos2 + halfwidth, ypos2, 2, base, nil, 1])
textpos.push([txt1, xpos1 + halfwidth, ypos1, :center, base])
textpos.push([txt2, xpos2 + halfwidth, ypos2, :center, base])
else
sel.length.times do |i|
selrect = Rect.new(0, selbuttony, @selbitmap.bitmap.width, selbuttonheight)
@@ -720,13 +720,13 @@ class PokemonPokedex_Scene
cmds.length.times do |i|
x = xstart + halfwidth + ((i % cols) * xgap)
y = ystart + 14 + ((i / cols).floor * ygap)
textpos.push([cmds[i], x, y, 2, base, shadow, 1])
textpos.push([cmds[i], x, y, :center, base, shadow, :outline])
end
if mode != 0
textpos.push([(mode == 1) ? "-" : "----",
xstart + halfwidth + ((cols - 1) * xgap),
ystart + 14 + ((cmds.length / cols).floor * ygap),
2, base, shadow, 1])
:center, base, shadow, :outline])
end
when 2 # Type
typerect = Rect.new(0, 0, 96, 32)
@@ -739,17 +739,17 @@ class PokemonPokedex_Scene
textpos.push(["----",
xstart + halfwidth + ((cols - 1) * xgap),
ystart + 14 + ((cmds.length / cols).floor * ygap),
2, base, shadow, 1])
:center, base, shadow, :outline])
when 5 # Color
cmds.length.times do |i|
x = xstart + halfwidth + ((i % cols) * xgap)
y = ystart + 14 + ((i / cols).floor * ygap)
textpos.push([cmds[i].name, x, y, 2, base, shadow, 1])
textpos.push([cmds[i].name, x, y, :center, base, shadow, :outline])
end
textpos.push(["----",
xstart + halfwidth + ((cols - 1) * xgap),
ystart + 14 + ((cmds.length / cols).floor * ygap),
2, base, shadow, 1])
:center, base, shadow, :outline])
when 6 # Shape
shaperect = Rect.new(0, 0, 60, 60)
cmds.length.times do |i|