Window Object Replacement

1684315041219.png


Window Object Replacement 1.0​

An attempt at rebuilding the embedded object Window so that it would be available for direct modification.
This can help artists create new window skins without having to stick to the resource standards.

Screenshots
Spoiler
skin texture (included)
1684315112488.png


1684315139653.png


1684315173904.png


1684315215361.png
License:
Free. VXAce only.
Contact me regarding it's use, leave a message on this thread, or PM me.

Credit:
script and replacement texture by me.
original code by Kadokawa.

Download
Link to Mediafire
1.2Mb​
includes WOR 1.0 and Window_Base plugin, for custom gauges.
We should do more like theses ^^ I am always kinda sad that we cannot work that much motives on the sides even if we flourishes the corners :3
I've set it to be almost 100% customizable.
you can make patterned borders, or textured backgrounds, or make each palette color a tile-able texture.
the only limitation is the background/border/foreground/cursor structure which I can't modify without screwing up every other window plugin by other programmers.
everything else, is game.
Ooooooh~! At first I thought you just sent the art. Awww Thank-you thank-you thank-you thank-you! ^^

BTW the art is really looking great. It might be what made me miss the link XD
it would probably help if I enlarge the actual link 😀
I LOVE YOU
Hey! I was wondering if there is no problem with me using this, giving you the credit in my game of course.
it's there to be used.
do post back an example of what you come up with, for future reference.
Hello, it's a very nice script you have here to recreate the Window class.
I have some issues with it and I don't understand why they are happening.

I wanted to use your script as a basis to change the behavior of the cursor, so I was aiming to use the default windowskin structure, for the sake of testing, I changed the windowskin to have a more obvious background:
1768647369868.png

(Here is my modified version, I just put an ugly red potatoe in the cursor)

Then I changed the settings of the script to follow the default windowskin:
Ruby:
module Wnd
  # Skin file.
  # name of the custom skin, in the Graphics/System folder.
  # windowskin default is nil
  Wnd_File = nil#"skin2"
 
  # Background rectangle.
  # Position and size of the background texture on the custom skin.
  # windowskin default is nil
  # Back_Rect = Rect.new(X,Y,Width,Height)
  Back_Rect = nil#Rect.new(64,100,36,32)
 
  # Tile the background texture.
  # True to tile the texture, False to stretch the texture.
  # windowskin default is false.
  Back_Tile_Rect = false#!true
 
  # Draw texture overlay.
  # True to draw grill overlay on top of background.
  # windowskin default is true.
  Back_Draw_Overlay = true#!true
 
  # Background overlay rectangle
  # Position and size of the overlay texture on the custom skin.
  # default is nil
  # Back_Overlay_Rect = Rect.new(X,Y,Width,Height)
  Back_Overlay_Rect = nil#Rect.new(100,100,32,32)
 
  # Tile the overlay texture
  # True to tile, False to stretch.
  # windowskin default is true.
  Back_Tile_Overlay = true#false
 
  # Window border default rectangle.
  # Square used when the windowskin border maintains the default square structure.
  # windowskin default is nil.
  # set to Rect.new(X,Y,Width,Height) when using a custom square
  Frame_Rect = nil#Rect.new(64,64,64,64)
 
  # Hash containing the border rectangles when the border uses a custom structure.
  # Overrides Frame_Rect if set.
  # default is nil
  Frame_Rect_Hash = {}
  #Frame_Rect_Hash[:tpl] = Rect.new(0,0,48,48)   #top left
  #Frame_Rect_Hash[:tpm] = Rect.new(48,0,4,48)   #top mid
  #Frame_Rect_Hash[:tpr] = Rect.new(52,0,48,48)  #top right
  #Frame_Rect_Hash[:mdl] = Rect.new(0,48,48,4)   #mid left
  #Frame_Rect_Hash[:mdr] = Rect.new(52,48,48,4)  #mid right
  #Frame_Rect_Hash[:btl] = Rect.new(0,52,48,48)  #bottom left
  #Frame_Rect_Hash[:btm] = Rect.new(48,52,4,48)  #bottom mid
  #Frame_Rect_Hash[:btr] = Rect.new(52,52,48,48) #bottom right
 
  # Size of the border in pixels
  # default is 16
  Frame_Size = 16#48
 
  # Tile the frame border.
  # True to tile the border texture, False to stretch it.
  # For custom skins with solid/pattern borders. Doesn't affect corners.
  # default is false
  Frame_Tile_Border = false#!true
 
  # Margin size
  # Controls the indentation between the background and the frame.
  # Only relevant if using transparent or tiled irregular frames.
  # window default is 4
  Margin_Size = 4#9
 
  # Cursor border rectangle on the window skin
  # Minimum size of each side is 4 + 4 + 4 (corner + middle + corner)
  # windowskin default is nil
  # default is square
  Cursor_Rect = nil#Rect.new(110,9,12,12)
 
  # Draw cursor background texture
  # windowskin default is false (uniform, transparent)
  Cursor_Draw_Back = false#!true
 
  # Cursor background texture position and size
  # windowskin default is nil
  # Cursor_Back_Rect = Rect.new(X,Y,Width,Height)
  Cursor_Back_Rect = nil#Rect.new(64,100,36,32)
 
  # Tile the cursor background texture
  # True to tile, False to stretch
  # default is false
  Cursor_Tile_Back = false
 
  # Override default opacity
  # window default is nil
  Opacity = nil
 
  # Override background opacity
  # window default is nil
  Back_Opacity = nil
 
  # Override contents opacity
  # window default is nil
  Contents_Opacity = nil
 
  # Override border opacity
  # window default is nil
  Frame_Opacity = nil
 
  # Pause arrow animation
  # Position and size of the rectangle containing the pause animation
  # windowskin default is nil
  # default arrangement is square
  # default frame size is 16x16
  Pause_Sprite_Rect = nil#Rect.new(100,57,32,16)
 
  # Pause sprite layout
  # Size of the sprite internal grid
  # windowskin default is 2x2
  Pause_Sprite_W = 2
  Pause_Sprite_H = 2
 
  # Direction arrows
  # Position and size of the rectangle containing the arrows.
  # windowskin default is nil
  # default arrangement is square
  # default sizes are 8x16 and 16x8
  Arrow_Sprite_Rect = nil#Rect.new(100,0,32,32)
 
  # Color palette
  # Position and size of the color palette
  # windowskin default is nil
  # Palette_Rect = Rect.new(X,Y,Width,Height)
  Palette_Rect = nil#Rect.new(0,100,64,32)
 
  # Color palette layout
  # Size of the palette grid
  # windowskin default is 8 wide by 4 high
  Palette_W = 8
  Palette_H = 4
 
  # Skinned health bars enable
  # True to use skinned health bars
  # Ace default is false
  Health_Bar_Skin = false#true
 
  # Health bars rectangle
  # Position and size of the health bars skin, when using custom bars.
  # default layout is top = border/background, bottom = fill color.
  # default arrangement is (1+width+1)x(1+height+1+height+1)
  # default structure of each block is [4 + 22 + 4] width, stretch height.
  Health_Bar_Rect = Rect.new(100,32,32,25)
 
 
  # Override Window_Base's palette
  # set to true if you want to change the system colors while
  # using custom palettes or custom health bars.
  # windowskin default is false
  Custom_Palette = false#true
 
  # Custom color override
  # Set each color index on the custom palette when enabled
  # Not used unless enabled by Custom_Palette
  # values = 0 to [(palette width x palette height) - 1]
  TextColor = 0   #normal color
  SysColor  = 3   #labels color
  CrtColor  = 14  #HP critical color
  KOColor   = 15  #Actor down color
  HPColor   = 31  #HP bar fill color
  MPColor   = 26  #MP bar fill color
  TPColor   = 29  #TP bar fill color
  MpCost    = 18  #MP cost label color
  TpCost    = 21  #TP cost label color
  UpColor   = 21  #Stat up color
  DnColor   = 23  #Stat down color
end

And from what I observed (from an empty project outside of your script):
-the cursor is drawn above the contents of the window (unlike the rgss version of Window): but the sprite is supposedly instantiated before the contents so it should be drawn below, right?
1768647779681.png

With your script

1768647829593.png

Without it (RGSSx Window)

-the gold window in the menu and the messages are not colored but the gold window from the shop menu is colored properly.
1768647907819.png

Menu gold

1768647935718.png

Message gold

1768647961718.png

Shop gold

I was wondering if you've experienced similar things, maybe I did something wrong in my setup.

EDIT:
Okay so the issue with the cursor was because of line 801 of the script (at the end of method updateCursor):
Ruby:
crs.move(cnt.x + @padding + x, cnt.y + @padding + y, cnt.z + 4)
Replacing the +4 with a +2 will put the cursor below the contents.

EDIT2:
Okay so the gold windows are not colored because they don't get their viewport set to the scene's viewport, so the refresh of the windowskin tone probably happens only when the viewport is set.

EDIT3:
Alright, here is a bugfix to put below this script for anyone using this script until it's updated 🙂
Ruby:
class Window
  #fix for cursor: it was displayed above contents unlike RGSS Window
  alias tim_fix_updateCursor updateCursor
  def updateCursor
    tim_fix_updateCursor
    cnt = @windowSpriteContainer
    crs = @windowCursorSprite
    x = cursor_rect.x - self.ox
    y = cursor_rect.y - self.oy
    crs.move(cnt.x + @padding + x, cnt.y + @padding + y, cnt.z + 2)
  end
 
  #fix for gold window tone in Scene_Menu and Window_Message
  alias tim_fix_updateTransform updateTransform
  def updateTransform
    @windowBackSprite.tone = self.tone
    tim_fix_updateTransform
  end
end #Window
-the cursor is drawn above the contents
yes.
there was an error with that routine, so I had to force it to redraw twice, IIRC.
drawing it above solved the problem..... I can't remember what the problem actually was, but it was conflicting with other scripts I had, so I left it at that.

I may have been the RGD engine conflicting with it, IDK.

still... the whole point of this, is that you won't use the default skin.

if you mean to change the *behavior* of the cursor, you gonna have to redesign the structure of the individual windows and how the cursor jumps between them.
this is meant to work with whatever you throw at it, already modified.... not modify this to suit your interface.
you tell this "jump to window X's slot Y.", not "jump to absolute position XY"
still... the whole point of this, is that you won't use the default skin.

if you mean to change the *behavior* of the cursor, you gonna have to redesign the structure of the individual windows and how the cursor jumps between them.
Well, by changing the behavior, I was reffering to the graphical behavior of the cursor:
-the fact that it changes opacity when the window is active
-the fact that the opacity is reduced when the window is inactive
While the active/inactive state of the window is handled by the scripts in the project, the rules on the opacity (how fast it changes, what is the inactive opacity) are controlled by the Window class that you've kindly rewrote.

If I were to use the RGSS Window and draw a custom cursor instead of modifying the current one, then it would be drawn above the text or below the window (there is also the possibility to draw it as a background of the contents, but it would require always refreshing it and I'm unsure about the performances in such case). Hence why I was looking for a script like yours to have a "public" access to how the Window class is drawn.
above the text or below the window
mine was drawing below the window initially, yes

all of this was lifted pretty much 1-1 from MV's code, except where the addchild() methods didn't apply.
I had to hotwire it.
and, eyeball the rest.

Original thread: https://forums.rpgmakerweb.com/threads/window-object-replacement.99447/