Dont know what to do to get a gui working

murtek

05-10-2010 10:10:07

hi, i have a small mogre project witch displays ours house on a street.
i want to add a gui so i started looking at "miyagi" and the code i use in the creakteScene looks like:
GuiManager.Singleton.Initialize(false);
Gui gui = GuiManager.Singleton.CreateGui("Gui1");
GuiManager.Singleton.CreateCursor("CursorMaterial", new Size(16, 16), new Position(0, 0));

GuiManager.Singleton.DefaultTextScheme = GuiManager.Singleton.CreateTextScheme("MyTextScheme", "bluehigh.ttf", 16, 72, ColourValue.Black);

new Miyagi.Controls.Button("MyFirstButton", "Button", new Size(128, 32), new Position(70, 0)) {
Text =
{
Value = "Save",
Alignment = TextAlignment.Center
}
};
new Miyagi.Controls.Button("MySecondButton", "Button", new Size(128, 32), new Position(70, 50)) {
Text =
{
Value = "Bitte",
Alignment = TextAlignment.Center
}
};
new Miyagi.Controls.Button("MyThirdButton", "Button", new Size(128, 32), new Position(70, 100));
new Miyagi.Controls.Button("MyFourthButton", "Button", new Size(128, 32), new Position(70, 150));
GuiManager.Singleton.AddOrphanControls(gui.Controls);

GuiManager.Singleton.Update(true);


But i dont see anythink on the screen, and i dont get any error, what can i do?
is there perhaps a GOOD and EASY tutorial how to use any GUI for mogre?
i'm not a professional coder and dont understand mutch thinks.

Help me

smiley80

06-10-2010 10:07:16

You have to create the MaterialScheme before you create the buttons. The easiest way is to create it automatically:
GuiManager.Singleton.CreateMaterialScheme("Button", typeof(Button), "Button", true);
This creates a MaterialScheme called 'Button' for Buttons.
It searches in the default resource group for files starting with 'Button.' and assigns them to the corresponding materials.
For this to work the filenames of the textures have to follow the naming conventions of materials (see: 'Material names' in Miyagi.chm).