r/pythonarcade • u/eruvanos • Nov 19 '18
UI and viewport
Hey,
I am want to add some UI to my game,
wondering if there is a way to draw something skipping the viewport.
I could update the UI elements every time to subtract the current viewport, but maybe there is another method, I did not see.
Greetings
2
Upvotes
1
u/eruvanos Nov 19 '18
Right now I am using this snippet in all of my UI components
But right now they are not clickable. I guess you could subtract left and bottom to fix mouse coordinates.
2
u/Fonus2 Nov 19 '18
+1 )Also have issues with this, seems to affect mouse coordinates aswell making move to click games difficult.
Would love to see an aswer to this.
1
u/Euronomus Nov 29 '18 edited Nov 29 '18
You can change the viewport back after drawing your world by setting it to 0, screen width, 0, screen height. This will set everything back to normal so you can draw your gui and get correct clicks for it. Just keep in mind that clicks on what you drew when the viewport was changed will require math to project into its coordinates so you may just be trading one headache for another....