Textured GUI skin
@loonychewy
thanks i didn't know that i always thought irrlicht isn't capable of doing 2d streching...but than i remembered it was rotation which it can't do..lol..my fault.
oh and ITexture provides getOriginalSize () which is the dimension of the loaded image. I had trouble with this too because getSize gives some crazy dimension....
PS: thanks alot by the way
thanks i didn't know that i always thought irrlicht isn't capable of doing 2d streching...but than i remembered it was rotation which it can't do..lol..my fault.
oh and ITexture provides getOriginalSize () which is the dimension of the loaded image. I had trouble with this too because getSize gives some crazy dimension....
PS: thanks alot by the way
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
loonychewy wrote:BlindSide, as ITexture doesn't provide the texture dimension, the only way I'm aware of is to load the texture file as an IImage, and then use IImage::getDimension(). But I'm not so sure what's the ease of use you're trying to achieve. Would you mind elaborating?
Its ok you answered my question, I thought you can somehow get dimensions for "sourceRect" using ITexture but you cannot so its ok...
Woops, looks like it does provide the size
Code: Select all
//! Returns original size of the texture.
/** The texture is usually
scaled, if it was created with an unoptimal size. For example if the size
of the texture file it was loaded from was not a power of two. This returns
the size of the texture, it had before it was scaled. Can be useful
when drawing 2d images on the screen, which should have the exact size
of the original texture. Use ITexture::getSize() if you want to know
the real size it has now stored in the system.
\return Returns the original size of the texture. */
virtual const core::dimension2d<s32>& getOriginalSize() = 0;
//! Returns dimension (=size) of the texture.
/** \return Returns the size of the texture. */
virtual const core::dimension2d<s32>& getSize() = 0;
(Usage is ITexture blah; dimension2d<s32> blahsize = blah.getSize(); )
Oh snap Sudi bet me to it
I have to give credit to Emil Halim and his TAnimatedSpriteSceneNode. Implementing the IGUISkin interface is easy. Coming up with 2D stretched animation code was more difficult, so I borrowed his, with a few small tweaks. Since the rendering is done with scene nodes, you can do things like rotation which you cannot do with normal draw2DImage(). The biggest change I made to his original code was to reset the view matrix when drawing the scene node, which is actually a very bad/slow thing to do. The view matrix should be reset only once before the call to guienv->drawAll() instead of inside each scene node render(). doh Still, it works
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
-
- Posts: 81
- Joined: Sun Sep 09, 2007 7:01 pm
- Location: BW, Germany
-
- Posts: 22
- Joined: Fri Dec 30, 2005 2:00 am
- Location: Singapore
- Contact:
-
- Posts: 81
- Joined: Sun Sep 09, 2007 7:01 pm
- Location: BW, Germany
I meant you!
I've got a question: Did you already try CGUITexturedSkin with irrlicht 1.4?
My debugger says, 'irr::gui::CGUITexturedSkin' couldn't be created because of some abstract members. What I don't understand is that the debugger shows a link to IGUISkin.h but the problem seems to occure in IGUITextureSkin.h?
I don't know what to do
PS: I thought you spoke German because in the example application, there are some German words. But you took the code from the tutorials right?
I've got a question: Did you already try CGUITexturedSkin with irrlicht 1.4?
My debugger says, 'irr::gui::CGUITexturedSkin' couldn't be created because of some abstract members. What I don't understand is that the debugger shows a link to IGUISkin.h but the problem seems to occure in IGUITextureSkin.h?
I don't know what to do
PS: I thought you spoke German because in the example application, there are some German words. But you took the code from the tutorials right?
-
- Posts: 22
- Joined: Fri Dec 30, 2005 2:00 am
- Location: Singapore
- Contact:
Unfortunately, I've not been updating it with the Irrlicht 1.4 due to a lack of time ( pLoonyChewy->GenerateExcuses(100) ) There're some API changes to the GUI sub-system in 1.4. If you or anyone else is interested, I can do an update to it
You may already know, there're also a couple of equally good, if not better implementations of textured GUI such as http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=22449. Well done guys!
P.S. Ich bin Singapurer, aber ich lerne jetzt Deutsch
You may already know, there're also a couple of equally good, if not better implementations of textured GUI such as http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=22449. Well done guys!
P.S. Ich bin Singapurer, aber ich lerne jetzt Deutsch
-
- Posts: 914
- Joined: Fri Aug 03, 2007 12:43 pm
- Location: South Africa
- Contact:
-
- Posts: 81
- Joined: Sun Sep 09, 2007 7:01 pm
- Location: BW, Germany
I'm interested, too
I just made a skin for yours
Why did you make the checkbox-texture so huge? ^^
I tried the one from your link before and neither implementing it nor running the .exe worked correctly but yours did and I think your solution is better
Yours is done much cooler ^^
Maybe someone's interested in my skin: (Just rename it to "guiskin.png")
My Skin
I just made a skin for yours
Why did you make the checkbox-texture so huge? ^^
I tried the one from your link before and neither implementing it nor running the .exe worked correctly but yours did and I think your solution is better
Yours is done much cooler ^^
Maybe someone's interested in my skin: (Just rename it to "guiskin.png")
My Skin
-
- Posts: 22
- Joined: Fri Dec 30, 2005 2:00 am
- Location: Singapore
- Contact:
I've just updated it to alpha 0.3, to be compatible with Irrlicht 1.4. Get it from my link in the first post.
Namek Kural:
My checkbox is large cos there's a lot of empty space in the texture Anyway, you can feel free to alter the xml to match your own texture.
Your texture is nice! Can I suggest some gradient in the textbox region and a shadow at its edges will make it perfect! Or maybe make it icy-blue to differentiate it from the default irrlicht skin?
Namek Kural:
My checkbox is large cos there's a lot of empty space in the texture Anyway, you can feel free to alter the xml to match your own texture.
Your texture is nice! Can I suggest some gradient in the textbox region and a shadow at its edges will make it perfect! Or maybe make it icy-blue to differentiate it from the default irrlicht skin?
-
- Posts: 81
- Joined: Sun Sep 09, 2007 7:01 pm
- Location: BW, Germany
Thank you! I'll try it as soon as possible
EDIT: Thanks! Works just fine!!
This should become a part of the irrlicht sdk!
Just one question: The buttons areall textured now but the 3D effect of th original irrlicht gui is still there, what can I do?
One way would be to load a gui file which has no 3d effect but there must be another solution.
EDIT: Thanks! Works just fine!!
This should become a part of the irrlicht sdk!
Just one question: The buttons areall textured now but the 3D effect of th original irrlicht gui is still there, what can I do?
One way would be to load a gui file which has no 3d effect but there must be another solution.
-
- Posts: 22
- Joined: Fri Dec 30, 2005 2:00 am
- Location: Singapore
- Contact:
-
- Posts: 81
- Joined: Sun Sep 09, 2007 7:01 pm
- Location: BW, Germany
Hey!
I switched to a MacBook Pro a few days ago and started converting my "big" project to the Mac Platform.
Everything is fine now expect of one thing that unluckily happens to be your code:
void CGUITexturedSkin::setSpriteBank(IGUISpriteBank* bank)
The Error says:
Please, could anyone explain to me what duplicate symbol means?
I switched to a MacBook Pro a few days ago and started converting my "big" project to the Mac Platform.
Everything is fine now expect of one thing that unluckily happens to be your code:
void CGUITexturedSkin::setSpriteBank(IGUISpriteBank* bank)
The Error says:
Code: Select all
ld: duplicate symbol irr::gui::CGUITexturedSkin::setSpriteBank(irr::gui::IGUISpriteBank*) in /Users/jonathan/Development/Projects/Star Wars Galaxy 3D/build/Star Wars Galaxy 3D.build/Release/Star Wars Galaxy 3D.build/Objects-normal/i386/CGUITexturedSkin.o and /Users/jonathan/Development/Projects/Star Wars Galaxy 3D/build/Star Wars Galaxy 3D.build/Release/Star Wars Galaxy 3D.build/Objects-normal/i386/main.o
-
- Posts: 22
- Joined: Fri Dec 30, 2005 2:00 am
- Location: Singapore
- Contact:
I've recently made a minor modification to dynamically change the skin texture alpha accordingly when the skin colour changes.
Because the texture already have some transparent regions, and I only want to change the alpha of those non-transparent regions, I can only do it pixel by pixel, testing it for non-zero alpha on the original texture first, before modifying the corresponding pixel on the skin texture. This may not be the most ideal approach. Anyone have any good suggestions?
Also, only the skin's alpha itself is changed, but not those for button images and so on, because those textures are stored within the UIElements themselves. Is there a good way for me to update their alphas as well?
If anyone's interested, the updated source and .exe is in the original post.
Because the texture already have some transparent regions, and I only want to change the alpha of those non-transparent regions, I can only do it pixel by pixel, testing it for non-zero alpha on the original texture first, before modifying the corresponding pixel on the skin texture. This may not be the most ideal approach. Anyone have any good suggestions?
Also, only the skin's alpha itself is changed, but not those for button images and so on, because those textures are stored within the UIElements themselves. Is there a good way for me to update their alphas as well?
If anyone's interested, the updated source and .exe is in the original post.