I have a few questions to ask.
First, is there any GUI library that I can use alongside Panda3D instead of the PGItems ?
Second, if not, I will need to know a few things about those PGItems and how they work.
I’ve been playing with those things for a while but I still don’t know how the position and size system works. I do things at random, hoping my widget will end up more or less where I want him to be.
I have to ask : is there a way to handle those widgets size and position using pixels as a unit ?
That would save me a huge amount of work. Maybe there are formulas that can help in this task, but probably won’t be able to figure them out ,
I’d also like to know a few things…
When you set a position, it is supposed to be set from the center of the object (and not from the top-left corner), right ?
And the coordinates (0,0) are the center of the screen ?
We support libRocket as alternative GUI engine since 1.8.0.
You can parent your GUI items to pixel2d for a pixel scale instead of screen units.
This is awesome ! Absolutely awesome !
However I didn’t find the interface to parent the GUI items to use with pixel2d.
I have a running RocketContext with a loaded document, but I just don’t know how to display it with Panda.
Also, I investigated pixel2d but it seems I didn’t get it right, here is my code :
Texture* texture = TexturePool::load_texture("textures/ingame-ui/main-bar.png");
PT(PGVirtualFrame) _mainBar = new PGVirtualFrame("GameUi MainBar");
style = _mainBar->get_frame_style(0);
//NodePath defButNp = window->get_aspect_2d().attach_new_node(_mainBar);
I tried all the commented approach and more : if I only use aspect_2d, the Frame is displayed at the coord 0,0,0, but in normal coordinates.
When I parent it to the pixel_2d node, it doesn’t get displayed at all, even if I try to reparent the pixel_2d node to render_2d or aspect2d.
I also try to setup the Frame size like with aspect_2d, or using pixel size. But I can’t get it to be displayed (or maybe it’s out of the screen).
If you reparent to pixel_2d, the Z coordinate must be negative. The frame size will be in pixels, and the position must be LPoint3(x, 0, -y).