request for fixed absolute X,Y

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
User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

request for fixed absolute X,Y

#1 Post by jack_norton »

Ok hope I won't be bashed to death for this request :lol:
My problem is quite simple. I started to learn a bit about the various UI functions, and is cool to be able to use the various hbox/vbox etc.
BUT - sometimes I just want to manually place each item in a specific XY place, and I don't want a displayable to "move" others. For example, I could want to position two frames at fixed width, overlapping one to the other by some pixels. I wasn't able to do this because the first frame "pushes" the other on the right, so I can't get that done.
There have been other cases in which I hoped I could use the various ui.button/ui.frame/ui.text and just use ANY fixed xpos/ypos, without having to worry if a displayable was pushing one or the other away.
Or I'm missing something and this is possible already?
About why I want to position everything manually, well, it's the way I use to build up the interfaces. Also since I make games at fixed-resolution, doesn't make sense for me to use relative values like 0.5 - 1.0 etc.
follow me on Image Image Image
computer games

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: request for fixed absolute X,Y

#2 Post by PyTom »

Use a ui.fixed. This places things wherever their xpos and ypos parameters specify.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: request for fixed absolute X,Y

#3 Post by jack_norton »

Yes I tried that but with frame doesn't work :oops:
Probably is my fault, but I was using ui.frame with a style background to create boxes, and then draw texts over it.

Code: Select all

label jobmenu:
    "This is jobmenu"
    python:
        ui.button("",style=style.trbutt,xpos=-10,ypos=-10,xminimum=1048,xmaximum=1024,yminimum=225)
        ui.text("{size=24}{color=#FF0}Basic Jobs{/color}{/size}",xpos=0.5,ypos=12,xalign=0.5)
        ui.text("{size=24}{color=#FF0}Advanced Jobs{/color}{/size}",xpos=0.5,ypos=88,xalign=0.5)
        showbar=0
        i=0;x=-128;y=42;w=128
        for name in jobT:
            #check if statistic
            if i>0:
                tt = ShowJob(i)
                layout.button("{size=18}"+name+"{/size}", clicked=ui.returns(True), hovered=tt.show, unhovered=tt.hide, ypos=y,xpos=x,xminimum=w,yminimum=40,yalign=0.0)
            i+=1
            if i<9:
                x+=128;
            elif i==9:
                x=0;y+=80;w=170
            elif i>9 and i<15:
                x+=171;
            elif i==15:
                x=0;y+=44
            elif i>15:
                x+=171;
        ui.fixed()
        ui.frame(style=style.trbutt,xpos=-10,ypos=600,xminimum=1044,yminimum=195)
        ui.frame(style=style.trbutt,xpos=10, ypos=620, xminimum=320,yminimum=145)
        ui.text("{size=24}{color=#FF0}Job Description{/color}{/size}",xpos=0.5,ypos=-20,xalign=0.5,style=style.trbutt)
        ui.frame(style=style.trbutt,xpos=340, ypos=620, xminimum=320,yminimum=145)
        ui.text("{size=24}{color=#FF0}Job Requirements{/color}{/size}",xpos=0.5,ypos=-20,xalign=0.5)
        layout.button(u"Cancel And Go Back", None, clicked=ui.jumps("status"),ypos=630,xpos=890,xalign=0.5)
        layout.button(u"Go To Work!", None, clicked=ui.jumps("gotowork"),ypos=690,xpos=890,xalign=0.5)
        ui.close()
        ui.interact()
and this is the result:
screenshot0001.jpg
only the 2nd "box" (frame) is visible :(
follow me on Image Image Image
computer games

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: request for fixed absolute X,Y

#4 Post by jack_norton »

Nevermind, got it to work! had put ui.fixed a line above the required one :oops:
follow me on Image Image Image
computer games

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], voluorem