Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Window error?

I have this script:

Code:
#-----------------
# Portrait Window
#-----------------
class Window_HudPortrait < Window_Base
  def initialize
    super(508, 10, 121, 112)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 255
    refresh
  end
  def refresh
    self.contents.clear
    @bitmap = RPG::Cache.picture("untitled.png")
    self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, 109, 98), 255)
  end
end

But when I do this, the image, which is 109 by 98, gets shrunk and a border added around it. I just want it to fill the window.

(What it should do) (What it does)

http://img.photobucket.com/albums/v108/ ... /error.png[/IMG]

What is causing this, and how can I solve this bug?
 
The window needs 16 pixels on each edge. When you create a bitmap for a window, you subtract 32 from both the width and the height, which leaves 16 pixels on each border. Why don't you just get that picture you showed us, and import it into Rmxp as an image? Then show it by replacing the line that creates that window with this:

Code:
@face_sprite = Sprite.new
@face_sprite.bitmap = RPG::Cache.picture("filename")
@face_sprite.x = 0 # Change the x value here
@face_sprite.y = 0 # Change the y value here
@face_sprite.z = 250 # Change the z value here
 
Daniel is right but that isn't exactly close to a solution ^_^

My suggestion would be to set the window to...
Code:
self.back_opacity = 0
...and see if it works. If you, display the bitmap seperately (inside a scene, not a window) and overlay it with a window setted up with the 0 back opacity flag.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top