I've been digging through the renpy code on github, and I understand some of it. But I'm hoping someone is willing to fill in some knowledge gaps that I have. Hopefully, this will help me accelerate on my project.
Questions
1. I'm partially assuming that renpy has a 'main game loop' like most engines, and that renpy iterates through all of its layers (master, transient, etc), and calls renpy.redraw() on each Displayable/Tranform in each layer on some interval. If I use renpy.show() (without screens, directly on displayables themselves), how should I go about programmatically positioning the displayables and have their position retained between renpy.redraw() calls?
To understand my confusion, see the following code I got working in script.rpy:
Code: Select all
label start:
python:
fixedBox = renpy.display.layout.MultiBox(layout="fixed")
fixedBoxBg = Window(child=fixedBox, xmaximum = 200, ymaximum = 200)
drag_fixedBox = Drag(d=fixedBoxBg,drag_name="my_inv",drag_handle=(0,0,20,20))
#add one item
t1 = Text("Item 1")
b1 = Button(child=t1)
drgItem1 = Drag(d=b1,drag_name="drag_test_item1",drag_handle=(0,0,10,10),id="test4")
fixedBox.add(drgItem1)
renpy.show("an_alias",what=drag_fixedBox)
pause
return
I then set the x and y attributes to some value and called renpy.redraw() and it worked; the displayable was repositioned!
However, if I call redraw() again, the position resets back to x=0 y=0. I want to see how ren'py positions things, so that I know how to write my event function logic for my UDD/CDD.
Lastly, I noticed that dragging the example displayable around did not change the positional values? What am I missing here?
2. Do displayables need to be added to Screens in order to retain position information? If so, for each screen I create... do I need one of each, all linked by a common screen name?
- Screen(...)
- ScreenDisplayable(...)
- ScreenCache(...)
- ScreenProfile(...)
Thanks for the help and clarifications! Ren'Py has been helpful for my project thus far