Here is the last release of both GUI Advanced Window & Window Manager classes.
Demonstration : http://youtu.be/cMvjv1v26Eg
New Features :
- Windows stick to viewport borders,
- Windows have got background picture (with alpha and color for each corner),
- Windows have got a dedicated skin (different from other Irrlicht GUI Elements).
- Minimized windows may be configured to stack on top, left, right or botton of the view port,
- Minimized windows may be configured to stack in every direction (from left to right, from right to left, from top to bottom or from bottom to top).
Code: Select all
CGUIWindowManager* wm = new CGUIWindowManager( env, env->getRootGUIElement(), device->getCursorControl() );
Code: Select all
video::ITexture* texture = Context.driver->getTexture("../../media/xyz.jpg");
CGUIAdvancedWindow* window = wm->addWindow(
rect<s32>(150,100,350,200),
L"New Small Advanced Window",
ButtonInfo,
irr::gui::EWC_HIDE,
texture );
Code: Select all
/// First, we create a list of buttons for the new window
core::array<CGUIAdvancedWindow::buttoninfo> ButtonInfo;
/// Configure the CLOSE button
CGUIAdvancedWindow::buttoninfo CloseButton;
CloseButton.Type = EWBT_CLOSE;
CloseButton.VisibleWhenNormal = true;
CloseButton.VisibleWhenBar = true;
CloseButton.VisibleWhenMinimized = false;
ButtonInfo.push_back(CloseButton);
/// Configure the MINIMIZE button
CGUIAdvancedWindow::buttoninfo MinimizeButton;
MinimizeButton.Type = EWBT_MINIMIZE;
ButtonInfo.push_back(MinimizeButton);
/// Configure the PIN button
CGUIAdvancedWindow::buttoninfo PinButton;
PinButton.Type = EWBT_PIN;
PinButton.VisibleWhenNormal = true;
PinButton.VisibleWhenBar = true;
PinButton.VisibleWhenMinimized = false;
ButtonInfo.push_back(PinButton);
/// Configure a Uuser-defined button
CGUIAdvancedWindow::buttoninfo MySpecialButton;
MySpecialButton.Type = EWBT_USER_DEFINED; //!< it's a user-defined button
IGUISpriteBank* bank = env->getSpriteBank("SpecialButton"); //!< here is its image
if(!bank)
{
bank = env->addEmptySpriteBank("SpecialButton");
bank->addTextureAsSprite(Context.driver->getTexture("../../media/reload16.png"));
driver->makeColorKeyTexture(Context.driver->getTexture("../../media/reload16.png"), position2di(0,0));
}
MySpecialButton.Sprite = bank;
MySpecialButton.SpriteIndex = 0;
MySpecialButton.VisibleWhenNormal = true;
MySpecialButton.VisibleWhenBar = false;
MySpecialButton.VisibleWhenMinimized = false;
MySpecialButton.Text = L"";
MySpecialButton.ToolTipText = L"My Special Button !";
MySpecialButton.UserEventId = GUI_ID_WINDOW_SPECIAL_BUTTON;
ButtonInfo.push_back(MySpecialButton);
2013-03-25 Fixed issues found by Chronologicaldot :
- Improving robustness of window manager impl.
Old Download : http://xterminhate.free.fr/files/13-03- ... anager.rar
2013-03-23 Fixed issues found by Chronologicaldot :
- Closing an Advanced Window managed by the Window Manager, and confgured to be removed when close button is pressed, works properly (window is detached and removed).
Old Download : http://xterminhate.free.fr/files/13-03- ... anager.rar
2013-03-17 Improvements based on Chronologicaldot suggestions and fix window background texture :
- Adding a simple WindowManager::AddWindow() with no user-defined buttons (close, minimize and pin buttons by defaut).
Old Download : http://xterminhate.free.fr/files/13-03- ... anager.rar
2013-03-15 Improvements based on Chronologicaldot suggestions :
- Adding (INCOMPLETE) serializeAttributes and deserializeAttributes.
- Better skin usage to set the size of tittle bar.
- Adding a simple constructor for advanced windows wihtout user-defined buttons (close, minimize and pin buttons by defaut).
Old Download : http://xterminhate.free.fr/files/13-03- ... anager.rar
--------------------------------------------------------- OLD POST ---------------------------------------------------------
Hello,
Here is the source code of my last custom GUI Element, based on the Irrlicht GUI Window, I'd like to share with you.
Demonstration : http://www.youtube.com/watch?v=F0Zl_clgFBQ
Source : http://snipplr.com/users/xterminhate/ta ... cedWindow/
The main.cpp is based on Irrlicht Example #5. YOu will need this picture () into your irrlicht/media directory.
Screenshot :
Features :
- Configurable close button behavior (nothing, remove, set visible false),
- Configurable system buttons,
- Working Minimize button,
- Double click on minimized window maximizes it,
- Restore button shows up when window is minimized,
- Pinned button, to prevent moving the window,
- Programmable user buttons, with attributes (show/hide for each window state) and user sprite bank, posting event catched by the user defined EventReceiver,
- Double click on window bar hides window client area,
- Window frame renderer using cursor coordinates as light source) and default/user skin.
- Configurable minimized window position,
- Flag preventing window minimizing,
- Notification system, making the tittle bar to blink.
Limitation : Breaking IGUIWindow interface.
Note : I am not really satisfied with my code in term of quality, but it could give someone ideas.
What's next ? Combining this advanced window with the magnet window manager (http://irrlicht.sourceforge.net/forum/v ... =9&t=48291).
Here is the result : Demonstration (HD) : http://www.youtube.com/watch?v=McE_EtnlZQM
Bye.