mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Fixed up text positioning and window sizes, fixed crash when choosing how many items to toss from the Bag
This commit is contained in:
@@ -61,16 +61,16 @@ class Window_UnformattedTextPokemon < SpriteWindow_Base
|
||||
self.text=text
|
||||
end
|
||||
|
||||
def resizeToFit(text,maxwidth=-1) # maxwidth is maximum acceptable window width
|
||||
dims=resizeToFitInternal(text,maxwidth)
|
||||
self.width=dims[0]+self.borderX+SpriteWindow_Base::TEXTPADDING
|
||||
self.height=dims[1]+self.borderY
|
||||
def resizeToFit(text, maxwidth = -1) # maxwidth is maximum acceptable window width
|
||||
dims = resizeToFitInternal(text,maxwidth)
|
||||
self.width = dims[0] + self.borderX + SpriteWindow_Base::TEXTPADDING
|
||||
self.height = dims[1] + self.borderY - 4
|
||||
refresh
|
||||
end
|
||||
|
||||
def resizeHeightToFit(text,width=-1) # width is current window width
|
||||
dims=resizeToFitInternal(text,width)
|
||||
self.width=width<0 ? Graphics.width : width
|
||||
def resizeHeightToFit(text, width = -1) # width is current window width
|
||||
dims = resizeToFitInternal(text,width)
|
||||
self.width = (width < 0) ? Graphics.width : width
|
||||
self.height = dims[1] + self.borderY - 4
|
||||
refresh
|
||||
end
|
||||
@@ -215,7 +215,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
oldstarting = @starting
|
||||
@starting = true
|
||||
self.width = dims[0]+self.borderX+SpriteWindow_Base::TEXTPADDING
|
||||
self.height = dims[1]+self.borderY
|
||||
self.height = dims[1]+self.borderY - 4
|
||||
@starting = oldstarting
|
||||
redrawText
|
||||
end
|
||||
@@ -225,7 +225,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
oldstarting = @starting
|
||||
@starting = true
|
||||
self.width = [dims[0]+self.borderX+SpriteWindow_Base::TEXTPADDING,maxwidth].min
|
||||
self.height = [dims[1]+self.borderY,maxheight].min
|
||||
self.height = [dims[1]+self.borderY - 4,maxheight].min
|
||||
@starting = oldstarting
|
||||
redrawText
|
||||
end
|
||||
@@ -246,8 +246,8 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
dims = resizeToFitInternal(text,width)
|
||||
oldstarting = @starting
|
||||
@starting = true
|
||||
self.width = (width<0) ? Graphics.width : width
|
||||
self.height = dims[1]+self.borderY
|
||||
self.width = (width < 0) ? Graphics.width : width
|
||||
self.height = dims[1] + self.borderY - 4
|
||||
@starting = oldstarting
|
||||
redrawText
|
||||
end
|
||||
@@ -317,6 +317,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
chy = ch[2]+ch[4]
|
||||
width = chx if width<chx
|
||||
height = chy if height<chy
|
||||
ch[2] += 4
|
||||
if !ch[5] && ch[0]=="\n"
|
||||
numlines += 1
|
||||
if numlines>=visiblelines
|
||||
@@ -344,6 +345,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
chy = ch[2]+ch[4]
|
||||
width = chx if width<chx
|
||||
height = chy if height<chy
|
||||
ch[2] += 4
|
||||
@textchars.push(ch[5] ? "" : ch[0])
|
||||
end
|
||||
end
|
||||
@@ -663,11 +665,11 @@ class Window_InputNumberPokemon < SpriteWindow_Base
|
||||
self.contents.clear
|
||||
s=sprintf("%0*d",@digits_max,@number.abs)
|
||||
if @sign
|
||||
textHelper(0,6,@negative ? "-" : "+",0)
|
||||
textHelper(0,0,@negative ? "-" : "+",0)
|
||||
end
|
||||
for i in 0...@digits_max
|
||||
index=i+(@sign ? 1 : 0)
|
||||
textHelper(index*24,6,s[i,1],index)
|
||||
textHelper(index*24,0,s[i,1],index)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -717,7 +719,7 @@ class Window_InputNumberPokemon < SpriteWindow_Base
|
||||
textwidth=self.contents.text_size(text).width
|
||||
pbDrawShadowText(self.contents, x+(12-textwidth/2), y, textwidth+4, 32, text, @baseColor, @shadowColor)
|
||||
if @index==i && @active && @frame/15==0
|
||||
self.contents.fill_rect(x+(12-textwidth/2), y+24, textwidth, 2, @baseColor)
|
||||
self.contents.fill_rect(x+(12-textwidth/2), y+30, textwidth, 2, @baseColor)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1223,7 +1225,7 @@ class Window_CommandPokemon < Window_DrawableCommand
|
||||
def drawItem(index,_count,rect)
|
||||
pbSetSystemFont(self.contents) if @starting
|
||||
rect=drawCursor(index,rect)
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,
|
||||
@commands[index],self.baseColor,self.shadowColor)
|
||||
end
|
||||
end
|
||||
@@ -1339,7 +1341,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
||||
rect=drawCursor(index,rect)
|
||||
if toUnformattedText(@commands[index]).gsub(/\n/,"")==@commands[index]
|
||||
# Use faster alternative for unformatted text without line breaks
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,
|
||||
@commands[index],self.baseColor,self.shadowColor)
|
||||
else
|
||||
chars=getFormattedText(
|
||||
|
||||
@@ -422,7 +422,6 @@ _drawFormattedChars_ function.
|
||||
def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
||||
newlineBreaks=true,explicitBreaksOnly=false,
|
||||
collapseAlignments=false)
|
||||
yDst += 4
|
||||
dummybitmap=nil
|
||||
if !bitmap || bitmap.disposed? # allows function to be called with nil bitmap
|
||||
dummybitmap=Bitmap.new(1,1)
|
||||
@@ -1090,7 +1089,7 @@ def pbDrawShadowText(bitmap,x,y,width,height,string,baseColor,shadowColor=nil,al
|
||||
return if !bitmap || !string
|
||||
width=(width<0) ? bitmap.text_size(string).width+1 : width
|
||||
height=(height<0) ? bitmap.text_size(string).height+1 : height
|
||||
y += -2
|
||||
y += 4
|
||||
if shadowColor && shadowColor.alpha>0
|
||||
bitmap.font.color=shadowColor
|
||||
bitmap.draw_text(x+2,y,width,height,string,align)
|
||||
|
||||
@@ -49,16 +49,16 @@ class Window_CharacterEntry < Window_DrawableCommand
|
||||
def drawItem(index,_count,rect)
|
||||
rect=drawCursor(index,rect)
|
||||
if index==@charset.length # -1
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,"[ ]",
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,"[ ]",
|
||||
self.baseColor,self.shadowColor)
|
||||
elsif index==@charset.length+1 # -2
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,@othercharset,
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,@othercharset,
|
||||
self.baseColor,self.shadowColor)
|
||||
elsif index==@charset.length+2 # -3
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,_INTL("OK"),
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,_INTL("OK"),
|
||||
self.baseColor,self.shadowColor)
|
||||
else
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,@charset[index],
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,@charset[index],
|
||||
self.baseColor,self.shadowColor)
|
||||
end
|
||||
end
|
||||
@@ -249,7 +249,7 @@ class Window_TextEntry < SpriteWindow_Base
|
||||
bitmap=self.contents
|
||||
bitmap.clear
|
||||
x=0
|
||||
y=6
|
||||
y=0
|
||||
if @heading
|
||||
textwidth=bitmap.text_size(@heading).width
|
||||
pbDrawShadowText(bitmap,x,y, textwidth+4, 32, @heading,@baseColor,@shadowColor)
|
||||
@@ -780,9 +780,9 @@ class PokemonEntryScene
|
||||
pbSetSystemFont(@sprites["gender"].bitmap)
|
||||
textpos=[]
|
||||
if pokemon.male?
|
||||
textpos.push([_INTL("♂"),0,0,false,Color.new(0,128,248),Color.new(168,184,184)])
|
||||
textpos.push([_INTL("♂"),0,-6,false,Color.new(0,128,248),Color.new(168,184,184)])
|
||||
elsif pokemon.female?
|
||||
textpos.push([_INTL("♀"),0,0,false,Color.new(248,24,24),Color.new(168,184,184)])
|
||||
textpos.push([_INTL("♀"),0,-6,false,Color.new(248,24,24),Color.new(168,184,184)])
|
||||
end
|
||||
pbDrawTextPositions(@sprites["gender"].bitmap,textpos)
|
||||
end
|
||||
@@ -1014,7 +1014,7 @@ class PokemonEntryScene2
|
||||
textPos=[]
|
||||
for y in 0...COLUMNS
|
||||
for x in 0...ROWS
|
||||
textPos.push([@@Characters[i][0][pos],44+x*32,18+y*38,2,
|
||||
textPos.push([@@Characters[i][0][pos],44+x*32,12+y*38,2,
|
||||
Color.new(16,24,32), Color.new(160,160,160)])
|
||||
pos+=1
|
||||
end
|
||||
@@ -1058,9 +1058,9 @@ class PokemonEntryScene2
|
||||
pbSetSystemFont(@sprites["gender"].bitmap)
|
||||
textpos=[]
|
||||
if pokemon.male?
|
||||
textpos.push([_INTL("♂"),0,0,false,Color.new(0,128,248),Color.new(168,184,184)])
|
||||
textpos.push([_INTL("♂"),0,-6,false,Color.new(0,128,248),Color.new(168,184,184)])
|
||||
elsif pokemon.female?
|
||||
textpos.push([_INTL("♀"),0,0,false,Color.new(248,24,24),Color.new(168,184,184)])
|
||||
textpos.push([_INTL("♀"),0,-6,false,Color.new(248,24,24),Color.new(168,184,184)])
|
||||
end
|
||||
pbDrawTextPositions(@sprites["gender"].bitmap,textpos)
|
||||
end
|
||||
@@ -1135,12 +1135,12 @@ class PokemonEntryScene2
|
||||
bgoverlay.clear
|
||||
pbSetSystemFont(bgoverlay)
|
||||
textPositions=[
|
||||
[@helptext,160,12,false,Color.new(16,24,32),Color.new(168,184,184)]
|
||||
[@helptext,160,6,false,Color.new(16,24,32),Color.new(168,184,184)]
|
||||
]
|
||||
chars=@helper.textChars
|
||||
x=166
|
||||
for ch in chars
|
||||
textPositions.push([ch,x,48,false,Color.new(16,24,32),Color.new(168,184,184)])
|
||||
textPositions.push([ch,x,42,false,Color.new(16,24,32),Color.new(168,184,184)])
|
||||
x+=24
|
||||
end
|
||||
pbDrawTextPositions(bgoverlay,textPositions)
|
||||
|
||||
Reference in New Issue
Block a user