Page 1 of 1

Gallery Hover Misplacement.

Posted: Fri Apr 10, 2015 11:03 pm
by KairuKyun
I have a CG gallery and for some reason the hover and idle borders are of place.
https://drive.google.com/open?id=0B7tyz ... authuser=0

Code: Select all

init python:
    
    #list of images
    gallery_cg_items = ["splash",
    "bridge_day",
    "bridge_night",
    "club_day",
    "club_night",
    "fronthouse_day",]

    # Page 2.

    
    #the rows and columns in the screen
    gal_rows = 3
    gal_cols = 2
    
    #thumbnail size in pixels
    thumbnail_x = 260
    thumbnail_y = 183   
    gal_cells = gal_rows * gal_cols    
    g_cg = Gallery()
    
    for gal_item in gallery_cg_items:
        
        g_cg.button(gal_item + " butt")
        g_cg.image(gal_item)
        g_cg.unlock(gal_item)
        g_cg.idle_border="assets/UI/gal_idle.png"
        g_cg. hover_border = "assets/UI/gal_hover.png"
    g_cg.transition = dissolve
    
    cg_page=0


init +1 python:
    #We made the lock buttons and such here
    for gal_item in gallery_cg_items:
        renpy.image(gal_item + " butt", im.Scale(ImageReference(gal_item), thumbnail_x, thumbnail_y))
        
screen cg_gallery:
    
    tag menu

    add "pref_bg"

    imagemap:
        
        auto "assets/UI/gallery_%s.png"

        hotspot (1103,15,148,121) action Return()
        
        hotspot (45,151,198,58) action [SetVariable('cg_page', 0), ShowMenu("cg_gallery")]
        #hotspot (45,218,198,58) action [SetVariable('cg_page', 1), ShowMenu("cg_gallery")]
        #hotspot (45,290,198,58) action [SetVariable('cg_page', 2), ShowMenu("cg_gallery")]
        #hotspot (45,355,198,58) action [SetVariable('cg_page', 3), ShowMenu("cg_gallery")]


    frame background None xpos 143:
        
        grid gal_rows gal_cols:
        
            ypos 168
            xpos 185
            
            $ i = 0
            $ next_cg_page = cg_page + 1 
            
            if next_cg_page > int(len(gallery_cg_items)/gal_cells):
            
                $ next_cg_page = 0
                
            for gal_item in gallery_cg_items:
            
                $ i += 1
                
                if i <= (cg_page+1)*gal_cells and i>cg_page*gal_cells:
                
                    add g_cg.make_button(gal_item + " butt", gal_item + " butt", im.Scale("assets/locked.png", thumbnail_x, thumbnail_y), xalign=0.5, yalign=0.5,  background=None, bottom_margin=24)
            
        for j in range(i, (cg_page+1)*gal_cells): #we need this to fully fill the grid
            null

Re: Gallery Hover Misplacement.

Posted: Sat Apr 11, 2015 1:13 pm
by KairuKyun
Anyone got an idea?

Re: Gallery Hover Misplacement.

Posted: Sat Apr 11, 2015 4:33 pm
by yuucie
I've had this problem when I change the images after implementation. Try these two things:

1) Rename all your GUI "assets/UI/gal_hover.png" to "assets/UI/gal_hover2.png", same with the idle image. Remember to rename them in the code too.
2) Clear the cache folder where your game is.

For some reason, even clearing the cache folder isn't enough; you'll have to rename your new assets too. Hopefully it'll fix itself.

Re: Gallery Hover Misplacement.

Posted: Sat Apr 11, 2015 4:56 pm
by KairuKyun
That didn't work.