We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi! I am currently working on simple 2D game. I am using PGraphics as some sort os side panel, and I am planning to place my game ui there. Therefore I'd like to draw a GButton from g4p on it. Is it even possible? Please help
Answers
Why not use a GWindow or GPanel gor the controls
Except for buttons, I would also like to draw some images on side panel, and animate, rotate and scale them. The functions that are pretty simple to do in PGraphics. It doesn't have to be g4p, any button will do.
Is it possible to do such thind or do I have to implement my own buttons? I would be really grateful if someone have replied. I really need to do this
It is not possible to draw G4P controls to a separate PGraphics object.
Why use a PGraphics object? Why not just say the left side will be for the game and the right side for the game UI?
It's a board game and i'd like to have a board in the centre and panels on the sides. And i'd like to scale and translate the board while leaving panels intact
This is not as difficult as it sounds because the G4P controls are drawn after the draw() method.
In pseudocode the draw method will look like this
where lpw and rpw are the control panel widths in pixels.
When you create the G4P controls make sure their positions are over the panel areas.
This has worked for me many times.
HTH
Thank you for help :)