Kingdom Ablaze
Sponsor
so im having issues with the math being too complex in this loop of mine..well the loop is pretty simple, but checking for the x and y coords of each icon is. so here is the loop im using:
[rgss]for i in @index...@files.size
#stops drawing icon once they reach edge of window
if (@total_length+RPG::Cache.icon("Towns/"+@files).width) > 465
next #stops the drawing of icons
else
bitmap = RPG::Cache.icon("Towns/"+@files)
self.contents.blt(@total_length+10,14,bitmap,Rect.new(0,0,bitmap.width,bitmap.height))
@total_length += (bitmap.width+10)
end
end
[/rgss]
@index is which index to start at to cycle through all the options
so my problem is i can easily get the x and y coords from where i clicked, but because not all icons are the same size and such as you can see if i simply run loops to check all the x and y coord of icons/buttons id quickly freeze up the system, was hoping some one had a better idea on how to check where i clicked
[rgss]for i in @index...@files.size
#stops drawing icon once they reach edge of window
if (@total_length+RPG::Cache.icon("Towns/"+@files).width) > 465
next #stops the drawing of icons
else
bitmap = RPG::Cache.icon("Towns/"+@files)
self.contents.blt(@total_length+10,14,bitmap,Rect.new(0,0,bitmap.width,bitmap.height))
@total_length += (bitmap.width+10)
end
end
[/rgss]
@index is which index to start at to cycle through all the options
so my problem is i can easily get the x and y coords from where i clicked, but because not all icons are the same size and such as you can see if i simply run loops to check all the x and y coord of icons/buttons id quickly freeze up the system, was hoping some one had a better idea on how to check where i clicked