Menu Mayhem 3: Showing bitmaps

LaFlibuste

Veteran
Veteran
Joined
Jun 28, 2015
Messages
382
Reaction score
315
First Language
French
Primarily Uses
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:

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!
 
Last edited by a moderator:

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
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. :)
 

LaFlibuste

Veteran
Veteran
Joined
Jun 28, 2015
Messages
382
Reaction score
315
First Language
French
Primarily Uses
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 ;)
 

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
Yes, exactly! I'm glad it helped you :3
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top