best way to manage different GUI windows
Posted: 13 Apr 2012, 12:05
Hi,
i'm working with Nurbed on the noesis integration in Ogre3D. So far, we can render the first .xaml GUI and we successfully made the binding between a button and its delegate.
However now, we don't know how we should proceed to manage more different GUI (eg. main menu, option menu, etc.) - this is our GuiManager:
as you can see we have a mMainMenu instance which embeds the mainmenu.xaml resource
we were wondering if this is the best course of action (each class for each window, so we load and unload the root resource every time) or if we should have one class and manage a context switch.
Any performance issue, in any of these cases?
Is there any multi-window integration sample available?
thanks!
i'm working with Nurbed on the noesis integration in Ogre3D. So far, we can render the first .xaml GUI and we successfully made the binding between a button and its delegate.
However now, we don't know how we should proceed to manage more different GUI (eg. main menu, option menu, etc.) - this is our GuiManager:
Code: Select all
class Manager : public Ogre::RenderQueueListener
{
public:
Manager();
void Init(Ogre::RenderWindow* iRenderWindow);
void renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& skipThisInvocation);
private:
Noesis::Core::Ptr<Noesis::Gui::IRenderer> mUIRenderer;
Noesis::Core::Ptr<Noesis::Gui::UIElement> mUIRoot;
IDirect3DStateBlock9* mStateBlock;
IDirect3DDevice9* mDevice;
MainMenu mMainMenu;
// temp code
OIS::MouseState *prevMouseState;
};
Code: Select all
class MainMenu
{
public:
MainMenu() {}
Noesis::Core::Ptr<Noesis::Gui::FrameworkElement> Load()
{
// Load UI resource
Ptr<IUIResource> guiResource = NsGetSystem<Noesis::Resource::IResourceSystem>()->Load("Gui/BlindBob/MainMenu.xaml");
Ptr<FrameworkElement> fe = guiResource->GetRoot();
Ptr<Button> prevButton = fe->FindName("Prev");
prevButton->Click() += MakeDelegate(&OnPrevClicked);
Ptr<Button> nextButton = fe->FindName("Next");
nextButton->Click() += MakeDelegate(&OnNextClicked);
return fe;
}
static void OnPrevClicked(const Ptr<BaseComponent>& sender, const RoutedEventArgs& e)
{
}
static void OnNextClicked(const Ptr<BaseComponent>& sender, const RoutedEventArgs& e)
{
Button* button = NsStaticCast<Button*>(sender);
button->SetIsEnabled(false);
}
};
Any performance issue, in any of these cases?
Is there any multi-window integration sample available?
thanks!