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.

Tinting Windows

I saw a way to do this once on RMXP.net.

Someone posted a request asking how to make an RGB modifier for windows in-game. I remember someone posting a line where you can put a number between 0-255 and that'd tint the window somewhere on the colour wheel. Does anyone know what I mean? Thanks in advance.
 
@some_window.windowskin.hue_change(0-360) or self.windowskin.hue_change(0-360)

I believe it should be that. But I'm not 100% sure and I can't check cause I'm at school right now..
 
Try this

add this in the initiailize method of the window preferably after you call Window_Bases initialize method

Code:
 @windowskin_name = $game_system.windowskin_name
 self.windowskin = RPG::Cache.windowskin(@windowskin_name).dup

If the above doesn't work then use this
Code:
 @windowskin_name = $game_system.windowskin_name
file = "Graphics/Windowskins/#{@windowskin_name}"
 self.windowskin = Bitmap.new(file)


then do your hue change
 
Oh I get it, make a new copy of the windowskin and tint that right? A copy can be messed with as much as you like because the original isn't harmed? Correct??

Thanks!

Edit: Hang on, it doesn't seem to tint at all now!
 
Yeah Basically what happened is RPG::Cache returned another reference to the Bitmap object and if you edit the bitmap then every single object that uses this bitmap will be changed

so if you plan on editing your bitmap after you get it from RPG::Cache its best to duplicate it Oh and here is a fix to your problem So you can use RPG::Cache.windowskin(file, hue) the module will automatically return a new bitmap object when you specifiy the hue

Code:
module RPG
  module Cache
     def self.windowskin(filename, hue = 0)
      self.load_bitmap("Graphics/Windowskins/", filename, hue)
    end
  end
end
 

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