I’m trying to do a rts-style minimap and in the process I stumbled over one issue I couldn’t solve:
I have some problems with the placing of the OnscreenImages. I guess the pos you specify for the OnscreenImage is given in aspect2d coordinates, right?
Now if I try to place an Image in the lower left corner by using the following coordinates, I still can’t see the whole image(only slightly displaced in both directions):
How can I fix that?
- I don’t know what commands you are using to create your OnscreenImage, but if you are loading an image using the low-level PNMImage library, it is up to you to enable transparency on the resulting OnscreenImage object. You can do this with:
- An easier way to locate an object in the lower-left corner is to parent it to base.a2dBottomLeft instead of the default, aspect2d. You can do this with:
or specify parent = base.a2dBottomLeft in the OnscreenImage constructor.
I solved number 1 already.
On number 2:
I’m trying to place the image in such a way that it’s lower left corner is in the lower left corner of the screen. By reparenting to the lower left corner I would still have to do calculations similar to my first post.
But those don’t seem to be right.
No you don’t have to.
[DirectGUI or nodepath alignment)
Thanks, ynjh_jo. Your code solved it.