Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / SCROLLABLE Items list selection
- - By nifriz Date 2019-08-06 13:37
I'm trying to create a Ruby little RPG, and I'm managing the "Character Info".
In the Info page a body image is shown, you can select a body part (I override part with another image to give the feeling is really selected) and now I want to do the next step.
When the part is selected, I want to sho an image list of compatible items, where you can select one of it.

For example, if you select head, i will show you all the helmet in your items list.

Any idea how to create this scrolalble list (graphically) on the screen?

Somenthing like this but scrollable...
Parent - - By nifriz Date 2019-08-12 07:59
I Found this solution by myself:

PREPARE CACHE ITEMS (Show 4 items)

def cache_items
    @cached_items = Gosu.render(MAIN_X + MAIN_WIDTH, MAIN_Y+MAIN_HEIGHT) do
       count = 0
       @items_array[@first_item..@first_item+3].each do |elem|
        elem['img'].draw(MAIN_X + OFFSET_X,
                         MAIN_Y + OFFSET_Y + 100*count,
                         3)
       Gosu::Image.new(Gosu::Image.from_markup("<c=FF0000>#{elem['txt']}</c>", 25, bold: true))
                              .draw(MAIN_X + OFFSET_X + 100,
                              MAIN_Y + OFFSET_Y + 100*count + 25,
                              3)
        count+=1
       end
    end
end


When User click on up/down Arrow, @first_item will be decreased/increased and i re-cache the items.
Parent - - By kyonides Date 2019-08-15 21:45
How curious... You didn't pick clipping and updating y coordinate.
Parent - By nifriz Date 2019-08-19 06:42
What you mean?
Up Topic Gosu / Gosu Exchange / SCROLLABLE Items list selection

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill