Menu Mayhem 3: Showing bitmaps

Hi again, RGSS3-savvy RPG making people!

So I am trying to create a custom menu layout. I currently am fighting with character portraits. I want the character status screen to be horizontal-based and be adjustable depending of how many characters are in the party (between 1 and 5). Since I didn't want the game to arbitrarily crop large portrait images for me, I created a collection of pre-seized portrait images. So far, everything I've talked about works: the status window's columns amount varies with item_max, each member's status scale according to item_max, the game finds the right pictures, etc. There's only one issue, I even after looking at a variety of menu script, I can't find what I did wrong: the game stacks the portrait images in the first column (see picture below):

Screen Shot 2015-07-07 at 12.09.58 PM.png

Although all rects seem fine and the characters names and stuff are drawn in the right columns! So why just the portraits? I've inserted a bunch of print calls and the output seems fine (see console output below):

Screen Shot 2015-07-07 at 12.10.06 PM.png

For the sake of completion, here's my menu window code:

Spoiler
class Window_FlibMenuStatus < Window_Selectable def initialize super(160,fitting_height(1), window_width, window_height) refresh deactivate end def window_width return Graphics.width - 160 end def window_height return Graphics.height - (fitting_height(1) * 2) end def col_max return $game_party.all_members_ids.size end def item_max return $game_party.all_members_ids.size end def item_rect(index) rect = Rect.new rect.width = contents.width / item_max rect.height = contents.height rect.x = index * rect.width rect.y = 0 return rect end def refresh make_item_list create_contents draw_all_items end def make_item_list @data = $game_party end def draw_item(index) char = $game_party.members.entries[index] rect = item_rect(index) print "Index = " + index.to_s + "\n" print "Item Rect(X, Y, width, height) = " print rect print "\n" if char.nil? return end draw_char_portrait(char, rect.x, rect.y) draw_actor_name(char, rect.x, rect.height - 96 , rect.width) draw_actor_class(char, rect.x, rect.height - 72 , rect.width) draw_actor_nickname(char, rect.x, rect.height - 48, rect.width) draw_actor_subclass(char, rect.x, rect.height - 24, rect.width) end def draw_char_portrait(actor, x, y, enabled = true) print "Name = " + actor.name + "\n" print "X = " + x.to_s + "\n" print "Y = " + y.to_s + "\n" print "Bitmap = " + actor.face_name + actor.face_index.to_s + "Menu" + item_max.to_s + "\n" bitmap = Cache.picture(actor.face_name + actor.face_index.to_s + "Menu" + item_max.to_s) print "Bitmap width = " + bitmap.width.to_s + "\n" print "Bitmap height = " + bitmap.height.to_s + "\n" rect = Rect.new(x, y, bitmap.width, bitmap.height) print "Rect (X, Y, width, height) = " print rect print "\n\n--------------------\n\n" contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha) bitmap.dispose end def draw_actor_name(actor, x, y, width = 112) change_color(hp_color(actor)) draw_text(x, y, width, line_height, actor.name, 1) end def draw_actor_class(actor, x, y, width = 112) change_color(normal_color) draw_text(x, y, width, line_height, actor.class.name, 1) end def draw_actor_nickname(actor, x, y, width = 180) change_color(normal_color) draw_text(x, y, width, line_height, actor.nickname, 1) end # Modification required def draw_actor_subclass(actor, x, y, width = 112) change_color(normal_color) draw_text(x, y, width, line_height, actor.class.name, 1) endend
So, anybody has any idea of what I might be missing? Thanks a lot!
Hello!

Try this:

# Remove this: #rect = Rect.new(x, y, bitmap.width, bitmap.height) print "Rect (X, Y, width, height) = " print rect print "\n\n--------------------\n\n" # Changed rect for bitmap.rect contents.blt(x, y, bitmap, bitmap.rect, enabled ? 255 : translucent_alpha)The third argument for blt represents the rect that you want from the bitmap, not the target rect. 🙂
Aaaah, I think I understand: if I wanted to crop a larger bitmap picture, that's how I'd select the part I want shown, right? My silly rect was way out of the bitmap's frame, hence nothing was shown! This is a great discovery that will likely allow me to optimize my menu code even more, thanks a lot! Also, everything works just fine now 😉
Yes, exactly! I'm glad it helped you :3

Original thread: https://forums.rpgmakerweb.com/threads/menu-mayhem-3-showing-bitmaps.42010/