Viewport with multiple ui-childobjects

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
reaktor
Regular
Posts: 27
Joined: Wed Jun 04, 2008 7:25 am
Contact:

Viewport with multiple ui-childobjects

#1 Post by reaktor »

I'm trying to make viewport have multiple interacting button objects, and with draggable background (as in ingame map). Is this supported? I discovered that viewport is single-widget type, and tried containing everything inside vbox(), but this made buttons to follow after the image. Then I changed vbox to fixed, which positioned buttons correctly, but this broke background draggability.

Code: Select all

   python hide:

        ui.side(('c', 'b', 'r'), xpos=100, ypos=50, spacing=5)
        
        vp = ui.viewport(draggable=True, mousewheel=True, xmaximum=400, ymaximum=400)

        ui.fixed()
        ui.image("map.jpg")
        ui.textbutton("test1", xpos=100, ypos=50)
        ui.textbutton("test2", xpos=100, ypos=450)
        ui.close()
        
        ui.bar(adjustment=vp.xadjustment, style='scrollbar')
        ui.bar(adjustment=vp.yadjustment, style='vscrollbar')

        ui.close()
        
        ui.textbutton("Dismiss", xpos=300, xanchor=0.5, ypos=550, yanchor=0.5, clicked=ui.returns(True))
        ui.interact()

Asha
Newbie
Posts: 18
Joined: Sun Dec 20, 2009 8:20 pm

Re: Viewport with multiple ui-childobjects

#2 Post by Asha »

It will be supported soon, just wait for the Cookbook Recipe.

JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: Viewport with multiple ui-childobjects

#3 Post by JinzouTamashii »

We'll get to work on it some time around Valentine's, IMHO.
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

Watercolorheart
Eileen-Class Veteran
Posts: 1314
Joined: Mon Sep 19, 2005 2:15 am
Completed: Controlled Chaos / Sum of the Parts / "that" Midna game with ZONEsama
Projects: Sparse Series/Oddments Shop original cartoon in Pevrea; Cybernetic Duels (fighting game); Good Vibin'
Organization: Watercolorheart Studios
IRC Nick: BCS
Tumblr: adminwatercolor
Deviantart: itsmywatercolorheart
Github: Watercolordevdev
Skype: heartnotes
Soundcloud: Watercollider
itch: watercolorheart
Location: Florida
Contact:

Re: Viewport with multiple ui-childobjects

#4 Post by Watercolorheart »

January 15th.
I'm not even the same person anymore

reaktor
Regular
Posts: 27
Joined: Wed Jun 04, 2008 7:25 am
Contact:

Re: Viewport with multiple ui-childobjects

#5 Post by reaktor »

Huh? Sorry, I think I have missed some specific post? Could you address correct topic?

Anyways, sounds good if someone is already working with same problem. Still, could anyone point directions to how to place images without losing background drag? That would be great start so I could experiment by my own.

JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: Viewport with multiple ui-childobjects

#6 Post by JQuartz »

reaktor wrote:Still, could anyone point directions to how to place images without losing background drag?
Well, you can try the inefficient way of setting the value of ypos to negative when using vbox like so:

Code: Select all

python hide:

        ui.side(('c', 'b', 'r'), xpos=100, ypos=50, spacing=5)
       
        vp = ui.viewport(draggable=True, mousewheel=True, xmaximum=400, ymaximum=400)

        ui.vbox()
        ui.image("main_menu3.jpg")
        ui.textbutton("test1", ui.returns(True),xpos=100, ypos=-500)
        ui.textbutton("test2",ui.returns(True), xpos=100, ypos=-600)
        ui.close()
       
        ui.bar(adjustment=vp.xadjustment, style='scrollbar')
        ui.bar(adjustment=vp.yadjustment, style='vscrollbar')

        ui.close()
       
        ui.textbutton("Dismiss", xpos=300, xanchor=0.5, ypos=550, yanchor=0.5, clicked=ui.returns(True))
        ui.interact()
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

Post Reply

Who is online

Users browsing this forum: Google [Bot]