I'm using Python-Ogre as a 3d graphics rendering system. As far as PyCEGUI looks, I should be able to create a simple "plus" shaped looking static image in the very center of the rendered display window. Does anyone know if this is possible?
+
Looking something similar to this, but a little bigger.
Crosshairs with PyCEGUI
Moderators: CEGUI MVP, CEGUI Team
Crosshairs with PyCEGUI
Last edited by r0ot_ on Mon Nov 28, 2011 00:24, edited 1 time in total.
Re: Crosshairs with PyCEGUI
Yeah, this definitely is possible by just adding the widget, centring it and setting the image accordingly.
Re: Crosshairs with PyCEGUI
Could you help me out with a bit of a code example maybe?
I don't know much about PyCEGUI, I'm sure in some time I'll get around to learning a lot more about it, but because what I'm trying to do here with the crosshairs is relatively simple, a simple code example would be much appreciated.
I don't know much about PyCEGUI, I'm sure in some time I'll get around to learning a lot more about it, but because what I'm trying to do here with the crosshairs is relatively simple, a simple code example would be much appreciated.
Re: Crosshairs with PyCEGUI
I definitely won't write the code out for you, that would create a precedence and everyone would start storming here demanding code from me.
Just read the documentation and crawl your way through the code, it's not hard. The CEGUI in practice tutorials contain C++ and python code, start with that.
Just read the documentation and crawl your way through the code, it's not hard. The CEGUI in practice tutorials contain C++ and python code, start with that.
Re: Crosshairs with PyCEGUI
Kulik wrote:I definitely won't write the code out for you, that would create a precedence and everyone would start storming here demanding code from me.
Just read the documentation and crawl your way through the code, it's not hard. The CEGUI in practice tutorials contain C++ and python code, start with that.
You're right, you definitely shouldn't create such a precedence. However, looking through the tutorials, I'm not sure which one will give me the desired result. I see a lot about buttons and windows, but I don't want any of that, I'm looking for an image.
Would the tutorial on creating widgets be the best course of action in your experience for getting my desired result?
Re: Crosshairs with PyCEGUI
Yes
To me you seem afraid of investing time and effort You are trying to achieve something super simple, learning basics of CEGUI will enable you to see the way to do it immediately.
Sometimes going through a series of tutorials takes less time than posting questions on a forum.
To me you seem afraid of investing time and effort You are trying to achieve something super simple, learning basics of CEGUI will enable you to see the way to do it immediately.
Sometimes going through a series of tutorials takes less time than posting questions on a forum.
Re: Crosshairs with PyCEGUI
I've made stunning progress
Here's the code I've added so far (simply following the tutorial lesson):
This obviously doesn't give me the image I want, but that's just something I can change, I think.
So, the image that is displayed above is "full_image", which for an image file, doesn't have an extension like .png, .jpg, .gif, etc. I also can't find the image file "full_image" anywhere in the filesystem for cegui or ogre. My Question: how can I go about changing the image I have to an image of my own creation? (i.e. crosshairs.png)
Also, I don't mean to get ahead of myself, but will transparency in an image file show up as being transparent in my rendered window as well?
Here's the code I've added so far (simply following the tutorial lesson):
Code: Select all
CEGUI.SchemeManager.getSingleton().create("TaharezLook.scheme")
myImageWindow = CEGUI.WindowManager.getSingleton().createWindow("TaharezLook/StaticImage","PrettyWindow")
myImageWindow.setPosition(CEGUI.UVector2(CEGUI.UDim(0.5,0), CEGUI.UDim(0.5,0)))
myImageWindow.setSize(CEGUI.UVector2(CEGUI.UDim(0,150),CEGUI.UDim(0,100)))
myImageWindow.setProperty("Image","set:TaharezLook image:full_image")
CEGUI.System.getSingleton().setGUISheet(myImageWindow)
This obviously doesn't give me the image I want, but that's just something I can change, I think.
So, the image that is displayed above is "full_image", which for an image file, doesn't have an extension like .png, .jpg, .gif, etc. I also can't find the image file "full_image" anywhere in the filesystem for cegui or ogre. My Question: how can I go about changing the image I have to an image of my own creation? (i.e. crosshairs.png)
Also, I don't mean to get ahead of myself, but will transparency in an image file show up as being transparent in my rendered window as well?
Re: Crosshairs with PyCEGUI
r0ot_ wrote:So, the image that is displayed above is "full_image", which for an image file, doesn't have an extension like .png, .jpg, .gif, etc. I also can't find the image file "full_image" anywhere in the filesystem for cegui or ogre. My Question: how can I go about changing the image I have to an image of my own creation? (i.e. crosshairs.png)
I believe that in 0.7x you are still require to use Imagesets to use textures. An imageset is an xml file that references a texture (bmp, png, etc.) and defines sub-images to be referenced in the looknfeel/layout/properties of windows. Typically people create a sub-image entry in the imageset called "full_image" which defines the area for the entire texture. Take a look at this FAQ entry on the wiki. If you want to set a windows image property, it would look something like this: window->setProperty("Image", "set:<imagesetName> image:<subImageName>").
Also, I don't mean to get ahead of myself, but will transparency in an image file show up as being transparent in my rendered window as well?
CEGUI does support transparent imagery.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!
Who is online
Users browsing this forum: No registered users and 25 guests