Drawing 2d image in Window?
-
- Posts: 86
- Joined: Wed Aug 29, 2007 10:45 pm
Drawing 2d image in Window?
Hey there. I need to draw an 2d image (a texture) in a window, instead of the environment. I found that the element IGUIWindow doesn't have a method to do that. How, then, do I do it?
Thanks for the help.
Thanks for the help.
Proud member of the Online Campaign for Real English. If you believe in capital letters, correct spelling and good sentence structure then copy this into your signature.
Re: Drawing 2d image in Window?
IVideoDriver::draw2DImage() ?Magus_Stragus wrote:Hey there. I need to draw an 2d image (a texture) in a window, instead of the environment. I found that the element IGUIWindow doesn't have a method to do that. How, then, do I do it?
Thanks for the help.
Code: Select all
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
video::SColor* colors=0, bool useAlphaChannelOfTexture=false) = 0;
-
- Posts: 86
- Joined: Wed Aug 29, 2007 10:45 pm
Why not use IGUIImage?
Re: Drawing 2d image in Window?
What do you mean window? Like a HWND? Is that what you want to get a pointer to HWND?Magus_Stragus wrote:Hey there. I need to draw an 2d image (a texture) in a window, instead of the environment. I found that the element IGUIWindow doesn't have a method to do that. How, then, do I do it?
Thanks for the help.
I may look smart, but I'm actually stupid.
-
- Posts: 86
- Joined: Wed Aug 29, 2007 10:45 pm
Hmm... I could, but I need to use the draw2DImage function. (I'm using the Animated Sprite code found in the Code Snippets). Anyone?Ion Dune wrote:Why not use IGUIImage?
Proud member of the Online Campaign for Real English. If you believe in capital letters, correct spelling and good sentence structure then copy this into your signature.
It should draw regardless of 3D transformations if I get what you mean... But I guess I don't know.Magus_Stragus wrote:Hmm... I could, but I need to use the draw2DImage function. (I'm using the Animated Sprite code found in the Code Snippets). Anyone?Ion Dune wrote:Why not use IGUIImage?
It's probably not impossible to port your existing code to use IGUIImage, though, if there are no workarounds.
-
- Posts: 86
- Joined: Wed Aug 29, 2007 10:45 pm
I don't think I get what you meant, but I'll try.
What I want is simple: when you use draw2DImage(), it draws a 2d image to the environment (the Irrlicht main window.) Now, I wat to draw an image to a window I created, not the main one (let's say, like a window holding the status of a character in a game), how can I do that, is my question.
What I want is simple: when you use draw2DImage(), it draws a 2d image to the environment (the Irrlicht main window.) Now, I wat to draw an image to a window I created, not the main one (let's say, like a window holding the status of a character in a game), how can I do that, is my question.
Proud member of the Online Campaign for Real English. If you believe in capital letters, correct spelling and good sentence structure then copy this into your signature.
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=30199
could be helpful. If you need to move (x,y) fix it mathematically (delta_x, delta_y) to the left corner of the parent window. I do that with own context menus fixed to characters. It's easy. If you need images in the 3D-space, use billboards instead.
could be helpful. If you need to move (x,y) fix it mathematically (delta_x, delta_y) to the left corner of the parent window. I do that with own context menus fixed to characters. It's easy. If you need images in the 3D-space, use billboards instead.
-
- Posts: 86
- Joined: Wed Aug 29, 2007 10:45 pm
So, you're telling me that's impossible to use draw2DImage on a GUI element? What a bummer...
Well, then I shall use IGUIImage. Thanks for the help.
Well, then I shall use IGUIImage. Thanks for the help.
Proud member of the Online Campaign for Real English. If you believe in capital letters, correct spelling and good sentence structure then copy this into your signature.
What Travis means is that it's impossible to draw other GUI elements over the top of a draw2dImage call if you draw your GUI using gui->drawAll(), you need to insert your draw2dImage call into the GUI so it will draw in the correct order.
So you just have to make a custom IGUIElement and add it to the GUI environment in pretty much the same way that you would make a custom scene node (example 3). To see how to do it, just steal the code to any other GUI element (CGUISomething.cpp/h) from the source directory, make the changes you want, create it ( new CGUISomething(...) ) and of course remember to drop() it.
Once you've learned how to do that, you can add any new fancy widget you can imagine.
So you just have to make a custom IGUIElement and add it to the GUI environment in pretty much the same way that you would make a custom scene node (example 3). To see how to do it, just steal the code to any other GUI element (CGUISomething.cpp/h) from the source directory, make the changes you want, create it ( new CGUISomething(...) ) and of course remember to drop() it.
Once you've learned how to do that, you can add any new fancy widget you can imagine.