Here’s few question for you, Panda pros!
1- Few years ago, I was programing with Delphi where there was a possibility to reparent a frame to one of four corner of the executable window. That was very handy as the rest of the window was then considered as an other object.
Obviously, the question is : Is there a way to do that with Panda?
The aim here is to render the 3d scene on a part of the window and to put some GUI elements on the frame.
2- How to get the size of the window ?
I guess it might something like : window.getWidth() and window.getHeight()
3- Is there a way to force the size (suppose that we’re not in full screen) of the Panda window ?
I mean : Not allow the user to resize the window using its corners.
4- More or less linked to (3). Is there a way to remove the header of the window ?
Header = the frame with the title and the three buttons (reduce,resize,close) on Win OS.
Thanks in advance.
Thanks for your answer David.
Still for the point - 1 -
There is no base.a2dBottom, you must choose betwwen left or right.
Isn’t there a way to split the screen in two distinguished parts ?
And for point - 2 -
base.win.getWidth() doesn’t exist but as you pointed me on the magic word base.win, i was able to find:
base.win.getXSize() and base.win.getYSize()
which was exactly what I needed
Are you looking for base.a2dBottomCenter, perhaps? I’m not sure what you mean by splitting the screen, though. If you wish to render one image on the left half of the screen and a different image on the right half, you might be looking for DisplayRegions.
Ah, my mistake, thanks for the correction.
Well, in almost all strategy games, the screen is being splited in two main parts. One part for the GUI and an other for the game.
I can use frames with render2d but Panda may render useless things under my frame.
So, I thought about spliting the main window into two parts. Then, rendering my scene in bigger window and keeping the GUI in the smaller window.
I might be completly wrong but that’s the idea I got for the moment…
You can change the size of the main DisplayRegion for rendering your game with something like this:
dr = base.cam.node().getDisplayRegion(0)
dr.setDimensions(0, 0.5, 0, 1)
The above example sets the 3-D view to just the left half of the window: everything horizontally from 0 to 0.5. Then you can put your GUI on the right half of the screen and not worry about it overlaying anything in your 3-D view.
The four parameters for dr.setDimensions() determines what region of the window is used for the view. The first two parameters are the left and right extents of the view, where 0 is the left edge of the window and 1 is the right edge of the window. The next two parameters are the bottom and top extents of the view, where 0 is the bottom edge of the window and 1 is the top edge of the window.
This is all documented more-or-less in the manual, in the chapter about DisplayRegions.
That was what I was looking for Thanks David.
Sometimes, I don’t know where/how to search in the manual as I don’t know what am I looking for!
Now, I’m going to test all this…