Alright I am working on a custom graphical command window, I am new to RGSS so I was hoping people could check the syntax for me to see that everything is correct. I will update the code as I go.
It is missing quite a bit but it is a WIP. I really need help with blitting bitmaps, it may just be lack of sleep but atm I am drawing a total blank. I am gonna head to sleep and pick this up tomorrow night.
Code:
class Window_Graphical < Window_Selectable
def initialize(width, commands, bmpheight, bmpwidth, hspacing, vspacing)
#If vertical spacing is not provided, derive from horizontal spacing
if vspacing == nil
vspacing = hspacing
end
#Calculate total commands width.
@commands_width = (commands.size * (bmpwidth + hspacing))
# Check that the bitmaps provided are not wider than the window width
if @commands_width + 32 > width #If bitmaps are wider
@lines = @commands_width / width #create lines
@commands_height = (commands.size / @lines) * (bmpheight + vspacing) # Find window height
super(0, 0, @commands_width / @lines, @commands_height)
else
super(0, 0, @commands_width, @commands_height)
end
@item_max = commands.size
@commands = commands
end
...
def draw_item(index)
rect = Rect.new( @commands_width / @lines , @commands_height * @lines, bmpwidth, bmpheight)
bitmap = RPG::Cache.picture(commands[index])
self.contents.blt(index * @commands_width , index * @commands_height, bitmap, rect)
end
end
It is missing quite a bit but it is a WIP. I really need help with blitting bitmaps, it may just be lack of sleep but atm I am drawing a total blank. I am gonna head to sleep and pick this up tomorrow night.