# Miyagi 1.0 beta 4c - GUI

smiley80

15-01-2009 16:42:24

viewtopic.php?f=8&t=13997

Beauty

16-01-2009 02:20:32

Nice

I created a wiki page and filled in your information:
http://www.ogre3d.org/wiki/index.php/Miyagi

For MOgre yet another Graphical user Interface
Because it's only for Mogre (as I suppose)
Just as an idea ...

For buttonGUI are nice screenshots. Is it also possible to use such a nice lock?

smiley80

16-01-2009 09:23:07

Nice

I created a wiki page and filled in your information:
http://www.ogre3d.org/wiki/index.php/Miyagi

Thank you, I try to remember to update this on a regular basis.

Because it's only for Mogre (as I suppose)

Well, a backport to Ogre is at least in the realm of possibility.

For buttonGUI are nice screenshots. Is it also possible to use such a nice lock?
I try to beef up the graphics and make some additional screenshots in the next days.

smiley80

24-02-2009 18:13:41

Beta 2 is up.

Two new controls: ComboBox and Panel.

The Panel can be resized by the cursor and docks magnetically on other panels.

Furthermore, the guis are now resolution-agnostic. If you pass a float between 0 and 1 in the position and size constructor, it is interpretated as a percentage of the screen resolution. The only thing to adjust manually is the font size.

Next up in Beta 3:
Gui Editor
Python and/or Lua integration

raygeee

24-02-2009 18:51:59

nice work

Miyagi seems to be evolving to a GUI system... which isn't really bad after all For most Mogre beginners MogreButtonGUI will still be valuable. But for the advanced it's always good to have a GUI system with more functionalities.

alaredo

06-04-2009 06:23:59

hello smiley80,

I'm testing Miyagi and can't move mouse cursor.
I read your sample but I can't understand how implement mouse move.
You can help me?

thx

smiley80

06-04-2009 11:34:11

Miyagi currently relies on Mois for mouse and keyboard input.

You have to create a Mois.Mouse and Mois.Keyboard (that's done by the 'CreateInput' method in the sample).
And then either supply them as a parameter in 'GuiManager.Singleton.Initialize'
e.g.:
GuiManager.Singleton.Initialize(1024, 768, MySceneManager, MyCamera, MyMouse, MyKeyboard, true);
or set GuiManager.Singleton.Mouse / GuiManager.Singleton.Keyboard directly.

And you have to capture the devices in your program's main loop (for instance in the 'FrameStarted' event handler).
MyKeyboard.Capture(); MyMouse.Capture(); 

alaredo

07-04-2009 06:06:00

Sorry for my newbie question but my mouse cursor is fixed at up/left corner. I don't need update your position at frame listener?

At end my Create Scene I call InitGui at this time mouse input is on

private void initGui() { GuiManager.Singleton.Initialize((int)this.window.Width, (int)this.window.Height, this.sceneMgr, this.camera, this.inputMouse, this.inputKeyboard, false); //create text schema GuiManager.Singleton.CreateTextScheme("BlueHighway", "BlueHighway", 20, 0, 0, 0, 1); GuiManager.Singleton.DefaultTextScheme = "BlueHighway"; //create cursor GuiManager.Singleton.CreateCursor("Cursor", new Size(16, 16), new Position(0, 0)); GuiManager.Singleton.Cursor.Hotspots.Add("ResizeLeft", new Position(8, 8)); GuiManager.Singleton.Cursor.Hotspots.Add("ResizeTop", new Position(8, 8)); GuiManager.Singleton.Cursor.Hotspots.Add("ResizeTopLeft", new Position(8, 8)); GuiManager.Singleton.Cursor.Hotspots.Add("ResizeTopRight", new Position(8, 8)); //create Panel float px = (float) ((this.window.Width - 250 ) / 2); float py = (float) ((this.window.Height - 210) / 2); Panel panel1 = new Panel("Panel1", "Panel", new Size(250, 210), new Position(px, py)) { Movable = true, MinSize = new Size(150, 90), MagneticDockSize = new Size(20, 20) }; panel1.SetBorderSize(8, 8, 16, 8); panel1.Opacity = 0.5f; TextBox txtServer = new TextBox("txtServer", "Textbox", new Size(128, 32), new Position(61, 20)) { Text = "Servidor...", TextOffset = new Position(18, 8), TextSchemeName = "BlueHighway", Opacity = 0.8f }; TextBox txtPort = new TextBox("txtPort", "Textbox", new Size(128, 32), new Position(61, 60)) { Text = "Porta...", TextOffset = new Position(18, 8), TextSchemeName = "BlueHighway", Opacity = 0.8f }; TextBox txtNick = new TextBox("txtNick", "Textbox", new Size(128, 32), new Position(61, 100)) { Text = "Apelido...", TextOffset = new Position(18, 8), TextSchemeName = "BlueHighway", Opacity = 0.8f }; Button btnOk = new Button("Ok", "Button", new Size(64, 32), new Position(93, 160)) { Text = "Ok", TextAlignment = Alignments.Center, TextOffset = new Position(0, 8) }; btnOk.MouseClick += new EventHandler<ControlMouseEventArgs>(btnOk_MouseClick); panel1.Controls.Add(txtServer); panel1.Controls.Add(txtPort); panel1.Controls.Add(txtNick); panel1.Controls.Add(btnOk); guiServer = GuiManager.Singleton.CreateGui("guiServer"); guiServer.Controls.Add(panel1); GuiManager.Singleton.Mouse = inputMouse; GuiManager.Singleton.Keyboard = inputKeyboard; } and it is my frame listener bool Skeletal_FrameStarted(FrameEvent evt) { if (ctlNet) { setNetwork(); ctlNet = false; } foreach (Personagem personagem in htPlayers.Values) { personagem.mAnimationState.AddTime(evt.timeSinceLastFrame * 1f); } base.HandleInput(evt); // Rotaciona Robo yawRobot(evt); // Movimenta Robo moveRobot(evt); GuiManager.Singleton.Update(); inputKeyboard.Capture(); inputMouse.Capture(); //GuiManager.Singleton.Update(); return true; }

thanx

satik

07-04-2009 09:42:26

Hi all, how can I load my own font (from *.ttf for example)? I couldnt find any info about it and all my tries failed

smiley80

07-04-2009 10:53:03

Sorry for my newbie question but my mouse cursor is fixed at up/left corner. I don't need update your position at frame listener?

It subscribes to the events of the devices when you set them.

Please check if inputMouse isn't null when calling 'GuiManager.Singleton.Initialize' and make sure that 'inputMouse.Capture()' is really called.

Hi all, how can I load my own font (from *.ttf for example)? I couldnt find any info about it and all my tries failed
You have to define the font in a .fontdef file, thats a standard Ogre script file.
See here or the .fontdef files in the sample.

satik

07-04-2009 14:29:40

Thx, now it works

Another problem:
I am trying to writeout text "Aa " using fonts from images, but I get nothing (just when I used BMP format, I got white rectangles on text position).

This is my fontdef:

ImageFont { type image source font.bmp glyph A 0 0 63 63 }

I use Images with hlaf black, half white and some areas empty (used aplha), generated in gimp, I tried all usual picture formats (BMP, PNG, JPG, TGA)
Images are sized 64x64px

this is how I load it:
GuiManager.Singleton.CreateTextScheme("SomeFont", "ImagFont", 16, 1, 1, 1, 1);

- with font from *.ttf it worked fine, but now it doesnt

Any ideas, whats wrong?

smiley80

07-04-2009 15:24:13

glyph A 0 0 63 63

Those are UV-coordinates, which means they have to be >= 0 and <= 1. So you have to divide the values by the texture width or height.

Beauty

08-04-2009 09:56:56

@satik:
Please use the Code button for code.
So the code is like this line

By the way - in the wiki are useful information.
e.g. for MOIS: www.ogre3d.org/wiki/index.php/MOIS

galaktor

30-07-2009 18:13:02

Where can I find any documentation of Miyagi?

I am having the same problem: the mouse is restricted to a small square area at the top left of my screen. Since I don't have any docs I just took the example alaredo posted, just to have somewhere to start. The cursor obviously reacts to mouse movement, but only in a restricted little area.

I guess this would be way easier if I had some documentation

smiley80

30-07-2009 18:45:35

The documentation is in the 'Help' folder.
Plus there is a sample with source code.

Granted, it's pretty crappy, that's mainly because the API isn't fix at the moment.

The cursor obviously reacts to mouse movement, but only in a restricted little area.
I can't reproduce this.
My guess is that MOIS isn't initialized properly and thinks the window is smaller than it really is.
It would be nice if you could upload something that demonstates this behaviour and pm me the link.

galaktor

30-07-2009 19:08:13

The documentation is in the 'Help' folder.
Plus there is a sample with source code. Granted, it's pretty crappy, that's mainly because the API isn't fix at the moment.

Yeah, I just noticed that like 5 minutes ago...I usually expect license stuff in the readme, that was the last place I would have expected a tutorial But it got me going for a start.

The mouse thingy is quite annoying. I'll send you a link in a pm in like 5 minutes, alright?

smiley80

30-07-2009 19:45:49

Okay thanks, I think I've found the error and I've guessed right.
You're missing:
 MOIS.MouseState_NativePtr state = mouse.MouseState; state.width = (int)renderWindow.Width; state.height = (int)renderWindow.Height; 

after creating the MOIS.Mouse.

galaktor

30-07-2009 19:51:56

Okay thanks, I think I've found the error and I've guessed right.
You're missing:
 MOIS.MouseState_NativePtr state = mouse.MouseState; state.width = (int)renderWindow.Width; state.height = (int)renderWindow.Height; 

Awesome, thanks. That's what I get from not knowing MOIS that well I thought MOIS would get the width/height automatically since MOIS knows the window handle. Whatever, thanks a lot.

I'll give the demo source code a few shots. By the way, how can I adjust mouse speed?

smiley80

30-07-2009 20:44:40

By the way, how can I adjust mouse speed?
Not possible in MOIS afaik.
I could add a mouse speed multiplicator. The only problem I see atm is that it would screw up the absolute position stored in MouseState of Mois.Mouse.

In any case, in the next version you can insert the mouse coordinates directly, which could be used to realize something like that.

galaktor

31-07-2009 00:09:34

By the way, how can I adjust mouse speed?
Not possible in MOIS afaik.
I could add a mouse speed multiplicator. The only problem I see atm is that it would screw up the absolute position stored in MouseState of Mois.Mouse.

In any case, in the next version you can insert the mouse coordinates directly, which could be used to realize something like that.

Hm, maybe that will do the trick, we'll see.

I noticed that the "opacity" value set within an xml does not have any effect when the control is set to "active". When active is false, then opacity works. But if active is true, opacity of 0 will still make the control show. Also, visible does not seem to have an effect...am I misunderstanding something here?

smiley80

31-07-2009 01:41:57

There a couple of opacity issues in the current beta.
To fix this one insert in Button.OnMaterialEvent
SetMaterialOpacity(this.BorderPanel.MaterialName, this.Opacity);
and change BaseMaterialControl.SetMaterialOpacity from private to protected.

They are all fixed in SVN and will be in the next beta.

galaktor

31-07-2009 11:38:03

I have a question concerning the ability to define events inside the xml. Is there anyway to deactivate the import of those events? The thing is, I think it is a security problem when allowing the user to inject c# code directly into my program. I would rather define the event code within my assembly but still load the gui from an xml. Is that possible?

galaktor

31-07-2009 11:44:00

I also think I just found a bug. If a listbox is longer than the panel containing it, the list keeps on going outside of the control. Maybe you already know about it, but it would be cool if that could be fixed at some point. Either just cut off the rest (not so cool), or allow a panel to be scrollable as soon as there are larger controls within it (way cooler).

smiley80

31-07-2009 12:29:53

I have a question concerning the ability to define events inside the xml. Is there anyway to deactivate the import of those events? The thing is, I think it is a security problem when allowing the user to inject c# code directly into my program.
I will drop the current method in the next release. It will be replaced (probably after beta3) with a plugin based system. Those plugins have to be loaded explicitly.
This still raises some security concerns, e.g. if you allow UGC, which have to be sorted out.

I would rather define the event code within my assembly but still load the gui from an xml. Is that possible?

You can always do something like this:
GuiManager.Singleton.GetControl("MyButton").MouseClick += ...

I also think I just found a bug. If a listbox is longer than the panel containing it, the list keeps on going outside of the control. Maybe you already know about it, but it would be cool if that could be fixed at some point.
That's 'by design' in beta2 and one of the main reasons I switched from Ogre overlays and panels to sprites.

Either just cut off the rest (not so cool), or allow a panel to be scrollable as soon as there are larger controls within it (way cooler).

This is on my todo list.

galaktor

31-07-2009 12:45:12

I would rather define the event code within my assembly but still load the gui from an xml. Is that possible?

You can always do something like this:
GuiManager.Singleton.GetControl("MyButton").MouseClick += ...

I know that, but does this prevent Miyagi from loading code within <Events> in the loaded xml?

smiley80

31-07-2009 13:00:52

No, you have to remove the relevant parts in GuiSerializer.ImportControl.

From line 285:
// Import Events
to the closing bracket in line 335.

Or just comment out:
ei.AddEventHandler(c, Delegate.CreateDelegate(ei.EventHandlerType, mi));

galaktor

31-07-2009 13:56:00

No, you have to remove the relevant parts in GuiSerializer.ImportControl.

From line 285:
// Import Events
to the closing bracket in line 335.

Or just comment out:
ei.AddEventHandler(c, Delegate.CreateDelegate(ei.EventHandlerType, mi));

Did that, thanks. For some reason I did not think of just modifying the source code

galaktor

31-07-2009 14:20:49

Is there any way to configure a textfield so that it is read-only, meaning that it cannot be used for input, only output?

smiley80

31-07-2009 14:32:55

Set either Enabled or Active to false.
Or use a button.

galaktor

31-07-2009 15:53:29

Me again I've got a suggestions for upcoming versions. I would appreciate it if the 'Initialize' method would have more overloads. Particularly if I do not explicitly pass in scene manager and camera, I still would like to be able to set 'suppress gui load'.

galaktor

31-07-2009 16:25:45

Will Miyagi support rendering the GUI to more than one camera? Like when I am using several viewports, each with an own camera, and I would want the same gui on all of them.

smiley80

31-07-2009 18:09:42

I would appreciate it if the 'Initialize' method would have more overloads.
The next version will have two overloads:
Initialize(bool suppressGuiLoad)
and
Initialize(MOIS.Mouse mouse, MOIS.Keyboard keyboard, bool suppressGuiLoad)
It gets the former parameters (SceneManager, Camera and resolution) automatically now. But those can also be changed manually afterwards.

Will Miyagi support rendering the GUI to more than one camera?
The SVN version currently renders everything to all viewports.
I thought about adding something like a 'whitelist' for viewports, so the gui is rendered on all of these.
Unfortunately, multiple viewports will lead to some issues with the mouse cursor...

galaktor

31-07-2009 21:38:15

Initialize(MOIS.Mouse mouse, MOIS.Keyboard keyboard, bool suppressGuiLoad)
It gets the former parameters (SceneManager, Camera and resolution) automatically now. But those can also be changed manually afterwards.

How does Miyagi know which camera to use? What if I want to initialize Miyagi before having any scene built up, will the Camera be null then? What exactly are the consequences of having scene manager and camera be null in the GuiManager? It says in the readme that this is only neccessary when using meshes...as what? Does that mean I can use Miyagi without a scene manager or camera as long as no meshes are loaded in my scene?

sorry for bombing you with questions

smiley80

31-07-2009 22:35:20

In beta2 the SceneManager and Camera is only required if you use MeshElements, which are 3d overlays.
The camera is only used to calculate the size of the mesh.

In beta3 the SceneManager will be vital, because it's needed for the rendering.
The renderers are started in the event handlers for RenderQueueStarted and RenderQueueEnded.
And it sets the rendering pass of the SceneManager.

In the Initialize method, it takes the first SceneManager of Root.Singleton.GetSceneManagerIterator and the first Camera of SceneManager.GetCameraIterator. The screen resolution is determined by the primary render target. As mentioned above, all of those can be changed later.

galaktor

02-08-2009 19:10:16

In the readme it says I have to call GuiManager.Update() to update the GUI system. But this already seems to happen automatically, without me having to call Update. I actually prefer to have control over the time the GUI updates or it doesn't. Is there a way to force Miyagi only to update when I tell it to? This is vital for my application design.

Thanks

smiley80

02-08-2009 19:52:56

In beta2, GuiManager.Update() only updates the fade effect (while hiding or showing guis) and the MeshElement rotation.

In beta3, all changes you make to a control (Position, Size and so on) are delayed till the next update.

galaktor

04-08-2009 13:27:57

In beta3, all changes you make to a control (Position, Size and so on) are delayed till the next update.
So Miyagi receives events from MOIS each time I perfom a capture on keyboard and mouse, meaning that in just that moment the changes are applied to the gui - but will only be displayed at the next update (beta3)...right?

rattus

04-08-2009 16:23:58

Hi,
thanks for great GUI, the only one truly usable for MOGRE.

I was trying beta2 and encountered exception when i use XPopup panel
 Miyagi.GuiManager.Singleton.CreateCursor( "Cursor", new Miyagi.Size( 16, 16 ), new Miyagi.Position( 8, 8 ) ); Miyagi.Gui gui = Miyagi.GuiManager.Singleton.CreateGui( "Gui1" ); gui.Mode = Miyagi.GuiMode.XPopup; gui.PopupRange = new Pair<float, float>( 0, 0.05f ); Miyagi.Panel panelXpop = new Miyagi.Panel( "Xpop", "Panel2", new Miyagi.Size( 100, _viewport.ActualHeight), new Miyagi.Position( 0, 0 ) ) { ResizeMode = Miyagi.Orientations.None }; gui.Controls.Add( panelXpop ); 

All runs fine but when quitting, on Miyagi.GuiManager.Shutdown() i get exception disposing label.
 at Miyagi.Label.Dispose(Boolean disposing) at Miyagi.BaseControl.Dispose() at Miyagi.Gui.DeleteAllControls() at Miyagi.Gui.Dispose(Boolean disposing) at Miyagi.Gui.Dispose() at Miyagi.GuiManager.DeleteGui(String name) at Miyagi.GuiManager.Shutdown() at RoboRally.Client.MainWindow.DestroyScene() in \MainWindow.cs:line 429 at RoboRally.Client.MainWindow.Go() in \MainWindow.cs:line 55 at RoboRally.Client.Program.Main(String[] args) in \Program.cs:line 20 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() 

I removed all gui code to confirm this happens when i use just the code above, when i comment out the panel it shuts down correctly.

Also even if i hide the cursor the popup reacts when mouse gets in the position for popup to activate ( i hope this will be solved by the changes to update in beta3 ).

smiley80

04-08-2009 19:22:37

So Miyagi receives events from MOIS each time I perfom a capture on keyboard and mouse, meaning that in just that moment the changes are applied to the gui - but will only be displayed at the next update (beta3)...right?
Right. The properties themselves are changed, but the changes will only be visible if Update is called.

All runs fine but when quitting, on Miyagi.GuiManager.Shutdown() i get exception disposing label.

If that's an NullReferenceException, that'll be fixed in the next release. Happen when DefaultTextScheme is not set.

Also even if i hide the cursor the popup reacts when mouse gets in the position for popup to activate ( i hope this will be solved by the changes to update in beta3 ).

Beta3 will check whether the cursor is visible, before reacting to mouse inputs.

rattus

05-08-2009 08:15:38

If that's an NullReferenceException, that'll be fixed in the next release. Happen when DefaultTextScheme is not set.

You're right. But also the DefaultTextScheme needs to be set before creating the panel actually, otherwise i still get exception.

anyway thanks and please release beta3 soon

galaktor

05-08-2009 19:40:39

anyway thanks and please release beta3 soon
dito

smiley80

07-08-2009 02:04:22

beta 3 is up.

Miyagi doesn't use Overlays and Panels anymore, instead it uses something like the this.
As a result, it doesn't use Ogre materials anymore (the scripts can still be used to create the new 'MaterialSchemes').
Similiar situation with TextSchemes, which create TrueType fonts from their ttf file, and require to set the glyph info manually for image fonts (fonts created by fontdef scripts can be used to create TextSchemes).

The new DialogBox control is a MessageBox-like modal dialog.

The new version has a lot of of breaking changes, sorry about that, won't happen after the final 1.0.

galaktor

08-08-2009 09:23:07

Hi! First of all, thanks for the update. I just played around with it, trying to get my previous test app to run. I encountered a problem, and there are several things I noticed on the way...

1. Xml deserialization fails with a NullPointerException as soon as you remove a child node that describes a GUI in XML. In my case, I did not want the background to have a texture, so I just took out the node. It works if I just leave the node empty. If this applies to all XML elements, and if there is a static structure to follow, this should be noted somewhere It would be better if the deserialization was more flexible, e. g. ignoring XmlElements if they are null.[/*:m]
2. I like that I have more control over the way Miyagi gets it's MOIS inputs. It is weird, though, that the InputManager has methods to inject mouse input, but not for the keyboard. It would be cool if I wouldn't have to give Miyagi keyboard or mouse at all, just use the inject methods every frame to feed it.[/*:m][/list:u]

So, here is my actual error. I get an exception when calling GuiManager.Update() the first time:

System.NullReferenceException wurde nicht behandelt. Message="Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt." Source="Miyagi" StackTrace: bei Miyagi.Core.Cursor.Update() bei Miyagi.Core.GuiManager.Update(Boolean captureInput) bei MogreSpike.Program.root_FrameEnded(FrameEvent evt) in[SOMEPATH]\Program.cs:Zeile 1623. bei Mogre.Root.raise_FrameEnded(FrameEvent evt) bei Mogre.Root.OnFrameEnded(FrameEvent evt) bei Mogre.FrameListener_Director.frameEnded(FrameListener_Director* , FrameEvent* evt) bei Ogre.Root.renderOneFrame(Root* ) bei Mogre.Root.RenderOneFrame() bei MogreSpike.Program.<Main>b__1() in [SOMEPATH]Program.cs:Zeile 1439. bei System.Threading.ThreadHelper.ThreadStart_Context(Object state) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bei System.Threading.ThreadHelper.ThreadStart() InnerException: 

Could there be a problem because I am calling the update from a separate thread? Here is my setup code:

GuiManager.Singleton.Initialize(Program.mouse, Program.keyboard, true ); Miyagi.Serialization.XmlSerializer.ImportFromFile( @"content\materials\textures\gui\mogrespike.mgx" ); Gui gui1 = GuiManager.Singleton.Guis[ "MainGui" ]; gui1.GetControl( "Background" ).MousePressed += ( sender, e ) => { Console.WriteLine("Background clicked!"); }; 

And at the end of FrameEnded, this is where the exception occurrs:

GuiManager.Singleton.Update(false);

Since my app is not running yet (I only get to see the very first frame of ogre before the update error happens) I cannot tell if there are any other issues yet.

Anyway, good work!

smiley80

08-08-2009 13:24:25

Xml deserialization fails with a NullPointerException as soon as you remove a child node that describes a GUI in XML. In my case, I did not want the background to have a texture, so I just took out the node.

Removing nodes which describe reference types (Texture, Border, ...) is currently not supported.
Value types (Position, Size, Visible, ...) might work, but revert back to the default value of the struct (Position(0, 0), Size(0, 0), false, ...).

Btw., I've forgot to mention, that mgx files from previous versions are not supported by beta3.

• I like that I have more control over the way Miyagi gets it's MOIS inputs. It is weird, though, that the InputManager has methods to inject mouse input, but not for the keyboard. It would be cool if I wouldn't have to give Miyagi keyboard or mouse at all, just use the inject methods every frame to feed it.

Will be in the next version. You can change OnKeyReleased and OnKeyPressed in InputManager to public, but that might cause problems with TextBoxes if the key has already been released.

So, here is my actual error. I get an exception when calling GuiManager.Update() the first time:

There's a potential NullReferenceException if the MaterialScheme of the cursor is not defined correctly.

Could there be a problem because I am calling the update from a separate thread? Here is my setup code:

Is it possible, that the separate thread calls Update before the other one finishes initializing the GuiManager?

galaktor

12-08-2009 13:46:36

There's a potential NullReferenceException if the MaterialScheme of the cursor is not defined correctly.

That could be it, I was adapting my old app from beta2 to beta3, maybe I forgot to set MaterialSchemeName correctly. I'll check it out later.

Is it possible, that the separate thread calls Update before the other one finishes initializing the GuiManager?

No, the thread is created and started after initialization.

Zonder

14-08-2009 09:07:52

Next up in Beta 3:
Gui Editor
Python and/or Lua integration

Could I suggest you use the .NET Dynamic Language Runtime (http://www.codeplex.com/dlr) will make things simpler also you have a choice or different scripting languages

luismesas

19-08-2009 12:36:06

Hi,

Can panels be transparent?

I'm trying to create a transparent form, I have created a png of 10x10 pixels all of them fully transparent.

 GuiManager.CreateMaterialScheme("BackgroundMaterial", typeof(Panel), "Magic", true); 

When panels is created it's fully in black and does not allow me to see 3D objects I have behind it.

smiley80

19-08-2009 22:05:46

Could I suggest you use the .NET Dynamic Language Runtime (http://www.codeplex.com/dlr) will make things simpler also you have a choice or different scripting languages

My plan is currently to have a plugin-based system. So if you want another language you would write another plugin.

Hi,
Can panels be transparent?

Transparent textures should work.
Try saving the texture with another program, or use a different file format that supports transparency (gif, tiff).

Another way to achieve that is passing an empty string or null as the parameter for material in the Panel constructor.
new Panel("Panel1", string.Empty, new Size(300, 200), new Position(50, 50));

boyamer

19-08-2009 22:43:54

Sprites can be zoomed or rotated?

luismesas

20-08-2009 09:52:40

Transparent textures should work.
Try saving the texture with another program, or use a different file format that supports transparency (gif, tiff).

Another way to achieve that is passing an empty string or null as the parameter for material in the Panel constructor.
new Panel("Panel1", string.Empty, new Size(300, 200), new Position(50, 50));

string.Empty thing works perfectly thanks

Is any way to get the cursor on a fixed position? for instance, I want the cursor fixed on it's current position when I move a camera.

smiley80

22-08-2009 06:56:39

beta 4 is up.

Main new features:
-Panels cut off child controls if they are larger than the panel (has to be activated with GuiManager.Singleton.DoScissorTest = true)
-the return of importable events.

Importing of events is now implemented through plugins.
Those plugins have to be loaded explicitly:
GuiManager.Singleton.PluginManager.LoadPlugin("Miyagi.Scripting.CSharp");
See the sample's "BindEvents" method for an example on how to programmatically import event.

Sprites can be zoomed or rotated?
No. Resizing a rotated sprite still causes some issues.

Is any way to get the cursor on a fixed position? for instance, I want the cursor fixed on it's current position when I move a camera.

Not if you use Mois. Should work if you use the Inject* methods of GuiManager.Singleton.Inputmanager.

galaktor

22-08-2009 22:27:07

Is any way to get the cursor on a fixed position? for instance, I want the cursor fixed on it's current position when I move a camera.

What I do is make the cursor invisible the moment the camera moves. You could place a button with a cursor on it in the middle of the screen to simulate a fixed cursor

smiley80

23-08-2009 22:32:07

Okey dokey, small update:
IronPython scripting plugin.
LuaInterface.dll is now included in the lua plugin dll.
The name of the class required in C# and VB.Net scripts has to have the name of the EventScriptingScheme.

Adding other DLR languages should be super easy. I have to check if it's possible to have a generic DLR plugin.

token

24-08-2009 17:13:08

Hello all,

One small question. I have not found a way to manually focus a control. I'd like to focus a writeable textbox area , when (another) readonly textbox is clicked on. A console like app. So are there any ideas how to accomplish this?

andreas

smiley80

25-08-2009 01:28:22

beta 4b is up, which fixes some smaller bugs.
Plus four new scripting plugins (F#, Boo, Nemerle and JScript).

At the moment, there are two issues with F#.
To make it work, you need to install this:
And its compiler creates a garbage file in the working directory.

One small question. I have not found a way to manually focus a control.
In 4b, you can either use GuiManager.Singleton.InputManager.FocusedControl or BaseControl.Focused.

token

28-08-2009 16:11:21

Hello,

First, Thanks smiley for the fast build in, for the focus thingie

I have now downloaded and tried beta 4b ( same exceptions in 4a ) and I'm not able to run the sample. First I have ( maybe had ) a problem with the TerrainSceneManager:

...
17:21:40: ***************************************
17:21:40: *** D3D9 : Subsystem Initialised OK ***
17:21:40: ***************************************
17:21:40: Particle Renderer Type 'billboard' registered
17:21:40: OGRE EXCEPTION(5:ItemIdentityException): No factory found for scene manager of type 'TerrainSceneManager' in SceneManagerEnumerator::createSceneManager at ..\src\OgreSceneManagerEnumerator.cpp (line 181)
17:21:40: OGRE EXCEPTION(5:ItemIdentityException): No factory found for scene manager of type 'TerrainSceneManager' in SceneManagerEnumerator::createSceneManager at ..\src\OgreSceneManagerEnumerator.cpp (line 181)
17:21:40: *-*-* OGRE Shutdown
17:21:40: Unregistering ResourceManager for type Compositor
... further shutdown logmessages

I tried using a ST_GENERIC scene manager, so i get psat the root initialize

So now I get a InvalidCastException in SpriteRenderer.cs at line 255 :

tp = TextureManager.Singleton.GetByHandle(currChunk.TexHandle);

I can fix it to some point by casting it by hand to a TexturePtr. So I can see a white cube on the screen. But then it fails on another place, with the same exception ( Sprite.cs line 290 , also a ResourceLoading part).

Maybe I'm missing something or so. Anybody any ideas ?

smiley80

28-08-2009 18:51:11

First I have ( maybe had ) a problem with the TerrainSceneManager:

I've uploaded a new version, which fixes that.

So now I get a InvalidCastException in SpriteRenderer.cs at line 255 :

I can't recreate that.

What's the exact message of the exception?
Are the any errors in the log file?

TexturePtr t = TextureManager.Singleton.Load("Button.png", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
after
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
in MiyagiSample.cs also throws an exception.

token

28-08-2009 22:53:10

Hello,

The ResourceManager now works fine.

I tried the code behind InitialiseAllResourceGroups and this works fine.

(Like in my first posting ) I get to a screen, where 2 buttons lie in the upper left corner. If I click into the window ( no fullscreen mode , but same behaviour there ) , the exception happens. The log is not of real help, as the program exits there immediately. So the log ends abruptly:

 ... ( Ogre Init ) 23:53:42: *************************************** 23:53:42: *** D3D9 : Subsystem Initialised OK *** 23:53:42: *************************************** 23:53:42: ResourceBackgroundQueue - threading disabled 23:53:42: Particle Renderer Type 'billboard' registered 23:53:42: Added resource location '..\Media' of type 'FileSystem' to resource group 'General' 23:53:42: Added resource location '..\Media\Gui' of type 'FileSystem' to resource group 'General' 23:53:42: Parsing scripts for resource group Autodetect 23:53:42: Finished parsing scripts for resource group Autodetect 23:53:42: Parsing scripts for resource group General 23:53:42: Parsing script OldButton.material 23:53:42: Parsing script BerlinSans32.fontdef 23:53:42: Finished parsing scripts for resource group General 23:53:42: Parsing scripts for resource group Internal 23:53:42: Finished parsing scripts for resource group Internal 23:53:42: Texture: Button.png: Loading 1 faces(PF_A8R8G8B8,128x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 23:53:42: Mesh: Loading cube.mesh. 23:53:42: Can't assign material 1 - Default to SubEntity of DummyEntity because this Material does not exist. Have you forgotten to define it in a .material script? 23:53:42: *** Initializing OIS *** 23:53:42: Texture: Button.Focused.png: Loading 1 faces(PF_A8R8G8B8,128x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 23:53:42: Texture: EventButton.MouseEnter.png: Loading 1 faces(PF_A8R8G8B8,128x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 23:53:42: Texture: EventButton.MouseLeave.png: Loading 1 faces(PF_A8R8G8B8,128x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 23:53:42: Texture: EventButton.MousePressed.png: Loading 1 faces(PF_A8R8G8B8,128x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 23:53:42: Texture: EventButton.MouseReleased.png: Loading 1 faces(PF_A8R8G8B8,128x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 23:53:42: Texture: EventButton.png: Loading 1 faces(PF_A8R8G8B8,128x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 23:53:42: Texture: Checkbox.Checked.png: Loading 1 faces(PF_R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,32x32x1. 23:53:42: Texture: Checkbox.Focused.Checked.png: Loading 1 faces(PF_R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,32x32x1. 23:53:42: Texture: Checkbox.Focused.png: Loading 1 faces(PF_R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,32x32x1. 23:53:42: Texture: Checkbox.png: Loading 1 faces(PF_R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,32x32x1. 23:53:42: Texture: Radiobutton.Checked.png: Loading 1 faces(PF_A8R8G8B8,16x16x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,16x16x1. 23:53:42: Texture: Radiobutton.png: Loading 1 faces(PF_A8R8G8B8,16x16x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,16x16x1. 23:53:42: Texture: Panel.Border.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1. 23:53:42: Texture: Panel.png: Loading 1 faces(PF_A8R8G8B8,600x500x1) with 9 generated mipmaps from Image. Internal format is PF_A8R8G8B8,600x500x1. 23:53:42: Texture: Textbox.Focused.png: Loading 1 faces(PF_A8R8G8B8,128x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 23:53:42: Texture: Textbox.png: Loading 1 faces(PF_A8R8G8B8,128x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 23:53:42: Texture: Listbox.png: Loading 1 faces(PF_A8R8G8B8,80x300x1) with 8 generated mipmaps from Image. Internal format is PF_A8R8G8B8,80x300x1. 23:53:42: Texture: Listbox.ScrollBar.png: Loading 1 faces(PF_A8R8G8B8,16x128x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,16x128x1. 23:53:42: Texture: Listbox.ScrollBar.Thumb.Border.png: Loading 1 faces(PF_A8R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1. 23:53:42: Texture: Listbox.ScrollBar.Thumb.png: Loading 1 faces(PF_A8R8G8B8,15x60x1) with 5 generated mipmaps from Image. Internal format is PF_A8R8G8B8,15x60x1. 23:53:42: Texture: DropDownList.List.png: Loading 1 faces(PF_A8R8G8B8,80x300x1) with 8 generated mipmaps from Image. Internal format is PF_A8R8G8B8,80x300x1. 23:53:42: Texture: DropDownList.png: Loading 1 faces(PF_A8R8G8B8,100x25x1) with 6 generated mipmaps from Image. Internal format is PF_A8R8G8B8,100x25x1. 23:53:42: Texture: DropDownList.ScrollBar.png: Loading 1 faces(PF_A8R8G8B8,16x128x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,16x128x1. 23:53:42: Texture: DropDownList.ScrollBar.Thumb.Border.png: Loading 1 faces(PF_A8R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1. 23:53:42: Texture: DropDownList.ScrollBar.Thumb.png: Loading 1 faces(PF_A8R8G8B8,15x60x1) with 5 generated mipmaps from Image. Internal format is PF_A8R8G8B8,15x60x1. 23:53:42: Texture: ProgressbarH.Bar.png: Loading 1 faces(PF_A8R8G8B8,90x20x1) with 6 generated mipmaps from Image. Internal format is PF_A8R8G8B8,90x20x1. 23:53:42: Texture: ProgressbarH.png: Loading 1 faces(PF_A8R8G8B8,128x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 23:53:42: Texture: ProgressbarV.Bar.png: Loading 1 faces(PF_A8R8G8B8,20x90x1) with 6 generated mipmaps from Image. Internal format is PF_A8R8G8B8,20x90x1. 23:53:43: Texture: ProgressbarV.png: Loading 1 faces(PF_A8R8G8B8,128x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 23:53:43: Texture: SliderH.Border.png: Loading 1 faces(PF_A8R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1. 23:53:43: Texture: SliderH.png: Loading 1 faces(PF_R8G8B8,128x16x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x16x1. 23:53:43: Texture: SliderH.Thumb.Border.png: Loading 1 faces(PF_A8R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1. 23:53:43: Texture: SliderH.Thumb.png: Loading 1 faces(PF_A8R8G8B8,10x30x1) with 4 generated mipmaps from Image. Internal format is PF_A8R8G8B8,10x30x1. 23:53:43: Texture: SliderV.png: Loading 1 faces(PF_A8R8G8B8,16x128x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,16x128x1. 23:53:43: Texture: SliderV.Thumb.png: Loading 1 faces(PF_A8R8G8B8,30x10x1) with 4 generated mipmaps from Image. Internal format is PF_A8R8G8B8,30x10x1. 23:53:43: Texture: Cursor.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1. 23:53:43: Texture: Cursor.ResizeBottomLeft.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1. 23:53:43: Texture: Cursor.ResizeBottomRight.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1. 23:53:43: Texture: Cursor.ResizeLeft.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1. 23:53:43: Texture: Cursor.ResizeTop.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1. 23:53:43: Font Miyagi_bluehigh.ttf_12using texture size 256x256 23:53:43: Info: Freetype returned null for character 127 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 128 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 129 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 130 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 131 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 132 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 133 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 134 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 135 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 136 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 137 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 138 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 139 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 140 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 141 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 142 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 143 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 144 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 145 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 146 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 147 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 148 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 149 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 150 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 151 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 152 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 153 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 154 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 155 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 156 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 157 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 158 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 159 in font Miyagi_bluehigh.ttf_12 23:53:43: Info: Freetype returned null for character 160 in font Miyagi_bluehigh.ttf_12 23:53:43: Texture: Miyagi_bluehigh.ttf_12Texture: Loading 1 faces(PF_BYTE_LA,256x256x1) with 0 generated mipmaps from Image. Internal format is PF_BYTE_LA,256x256x1. 23:53:43: Font Miyagi_bluehigh.ttf_16using texture size 512x256 23:53:43: Info: Freetype returned null for character 127 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 128 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 129 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 130 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 131 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 132 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 133 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 134 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 135 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 136 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 137 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 138 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 139 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 140 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 141 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 142 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 143 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 144 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 145 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 146 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 147 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 148 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 149 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 150 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 151 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 152 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 153 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 154 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 155 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 156 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 157 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 158 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 159 in font Miyagi_bluehigh.ttf_16 23:53:43: Info: Freetype returned null for character 160 in font Miyagi_bluehigh.ttf_16 23:53:43: Texture: Miyagi_bluehigh.ttf_16Texture: Loading 1 faces(PF_BYTE_LA,512x256x1) with 0 generated mipmaps from Image. Internal format is PF_BYTE_LA,512x256x1. 23:53:43: Font Miyagi_bluehigh.ttf_14using texture size 512x256 23:53:43: Info: Freetype returned null for character 127 in font Miyagi_bluehigh.ttf_14 23:53:43: Info: Freetype returned null for character 128 in font Miyagi_bluehigh.ttf_14 23:53:43: Info: Freetype returned null for character 129 in font Miyagi_bluehigh.ttf_14 23:53:43: Info: Freetype returned null for character 130 in font Miyagi_bluehigh.ttf_14 23:53:43: Info: Freetype returned null for character 131 in font Miyagi_bluehigh.ttf_14 23:53:43: Info: Freetype returned null for character 132 in font Miyagi_bluehigh.ttf_14 23:53:43: Info: Freetype returned null for character 133 in font Miyagi_bluehigh.ttf_14 23:53:43: Info: Freetype returned null for character 134 in font Miyagi_bluehigh.ttf_14 23:53:43: Info: Freetype returned null for character 135 in font Miyagi_bluehigh.ttf_14 23:53:43: Info: Freetype returned null for character 136 in font Miyagi_bluehigh.ttf_14 23:53:43: Info: Freetype returned null for character 137 in font Miyagi_bluehigh.ttf_14 23:53:43: Info: Freetype returned null for character 138 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 139 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 140 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 141 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 142 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 143 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 144 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 145 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 146 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 147 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 148 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 149 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 150 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 151 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 152 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 153 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 154 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 155 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 156 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 157 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 158 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 159 in font Miyagi_bluehigh.ttf_14 23:53:44: Info: Freetype returned null for character 160 in font Miyagi_bluehigh.ttf_14 23:53:44: Texture: Miyagi_bluehigh.ttf_14Texture: Loading 1 faces(PF_BYTE_LA,512x256x1) with 0 generated mipmaps from Image. Internal format is PF_BYTE_LA,512x256x1. 23:53:44: Texture: berlin_sans32.png: Loading 1 faces(PF_A8R8G8B8,512x512x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,512x512x1. 23:53:44: Texture: Background.png: Loading 1 faces(PF_R8G8B8,1024x768x1) with 10 generated mipmaps from Image. Internal format is PF_X8R8G8B8,1024x768x1. 23:53:44: Texture: Logo.png: Loading 1 faces(PF_A8R8G8B8,283x200x1) with 8 generated mipmaps from Image. Internal format is PF_A8R8G8B8,283x200x1. 23:53:44: Texture: ListBoxTexture1.png: Loading 1 faces(PF_A8R8G8B8,79x20x1) with 6 generated mipmaps from Image. Internal format is PF_A8R8G8B8,79x20x1. end of log 

Maybe it's about the failing fonts ? I can try/catch the Exceptions and bypass them , so I can get to the known GUI screen. But half the textures are not loaded, like in the screen below:

[/url]

I'm using Visual Studio 10 , but I've also tried it on 2008 . Rendermode is D3D.

Maybe this is some help.

Also something small about the releases: The 4b contained an ogre.cfg. If I run it for the first time, it always fails , prompting for incorrect D3D drivers ( but the error message is not a real help ). When i remove the downloaded ogre.cfg and restart, filing out the config dialog it runs nearly fine. The first time i run the miyagi sample after reconfiguring the config dialog, it bitches about an already defined renderwindow, what is true for these lines, if you define a new own config file :

( MiyagiSample.cs line 362 ff)
[code]if (!this.root.RestoreConfig())
{
if (this.root.ShowConfigDialog())
{
// If returned true, user clicked OK so initialise
// Here we choose to let the system create a default rendering window by passing 'true'
this.window = this.root.Initialise(true);
}
else
{
return false;
}
}

this.window = this.root.Initialise(true);
[/code]

Of course this won't happen if you have a working ogre.cfg

I really start liking your great work on miyagi. Will it be ( or maybe it is already) possible to run miyagi without MOIS but with .net key and mouse events ?

Greetings
Andreas

smiley80

29-08-2009 00:29:39

Maybe it's about the failing fonts ?
The font stuff is normal.

I can try/catch the Exceptions and bypass them , so I can get to the known GUI screen. But half the textures are not loaded, like in the screen below:

Try setting DoScissorTest to false (line 446 in the sample).
Have you tried running it with OpenGL?

Will it be ( or maybe it is already) possible to run miyagi without MOIS but with .net key and mouse events ?

You have to use the Inject* methods without the Mois parameters of GuiManager.Singleton.Inputmanager.
However, you will get a FileNotFoundException if you don't have Mois.dll (will be fixed in the next SVN commit).

boyamer

31-08-2009 08:02:39

would be possible for you to explain how your plugin system work? Maybe how/where plugins are loaded?What are the modules?Scripting?

Thanks

smiley80

31-08-2009 14:27:45

The following describes the plugin system the way it currently works in SVN, it was slightly different in 4b and may change till the final 1.0.

GuiManager.Singleton.PluginManager.LoadPlugin(PathToAssembly, ArrayOfObjects(optional));

Then it searches all exported types for the one that derives from Miyagi.Plugin.BasePlugin.
The type doesn't have to derive directly, since it checks the whole inheritance chain.

When it finds the correct type, it gets the constructor that takes a GuiManager and invokes it.
(you'll get an exception, if there's no such constructor)

Then it calls the OnLoaded method of the plugin and passes the array of objects.
(at this point scripting plugins subscribe to GuiManager.BindEventsRequested and input plugins to InputManager.CaptureRequested)

And finally, the plugin gets added to PluginManager.Plugins.

 GuiManager.Singleton.PluginManager.UnloadPlugin(BasePlugin or NameOfPlugin); or GuiManager.Singleton.PluginManager.UnloadAllPlugins() 
Removes the plugin from PluginManager.Plugins and calls OnUnloaded.

smiley80

16-09-2009 22:51:32

I've uploaded a new version that hopefully fixes the InvalidCastException.

boyamer

21-09-2009 22:56:35

Would be fine if you could add some effects to widgets like CEGUI,rotation,wipple,glass effects and so!

smiley80

22-09-2009 20:09:37

Well, the next release will have shader support (albeit there might be limitations, I've tested only a sepia and a radial blur shader so far).

boyamer

23-09-2009 08:13:37

Could you commit that to SVN?
So maybe i can start testing it!
Thanks

smiley80

23-09-2009 20:21:03

The API backend isn't ready yet. I've only tested the rendering by setting the gpu programs of the rendering pass.

kubatp

23-09-2009 21:38:42

Hi,
unfortunately it still throws the same exception : The underlying type of the ResourcePtr object is not of type Texture.

 in Mogre.TexturePtr.op_Implicit(ResourcePtr ptr) v Miyagi.Rendering.SpriteRenderer.RenderSprites() v Miyagi.Rendering.RenderManager.FireRenderers() v Miyagi.Rendering.RenderManager.RenderQueue_Started(Byte queueGroupId, String invocation, Boolean& skipThisInvocation) v Mogre.SceneManager.raise_RenderQueueStarted(Byte queueGroupId, String invocation, Boolean& skipThisInvocation) v Mogre.SceneManager.OnRenderQueueStarted(Byte queueGroupId, String invocation, Boolean& skipThisInvocation) v Mogre.RenderQueueListener_Director.renderQueueStarted(RenderQueueListener_Director* , Byte queueGroupId, basic_string<char\,std::char_traits<char>\,std::allocator<char> >* invocation, Boolean* skipThisInvocation) v Ogre.Root.renderOneFrame(Root* ) v Mogre.Root.RenderOneFrame() v Aggressors.UI.MogreForm.Go() v D:\pavel\uceni\agresori\currentVersion\GUI\MogreForm.cs:řádek 85 v Aggressors.UI.MogreForm.Run() v D:\pavel\uceni\agresori\currentVersion\GUI\MogreForm.cs:řádek 65 v Aggressors.UI.Program.Main() v D:\pavel\uceni\agresori\currentVersion\GUI\Program.cs:řádek 19 

Am I doing something wrong?
Pavel

smiley80

23-09-2009 23:44:17

Am I doing something wrong?

Don't think so. Problem is, I don't know why Ogre can't cast the ResourcePtr to a TexturePtr.

What hardware do you use?

kubatp

24-09-2009 00:15:32

Hi,
I actually have a laptop - Asus f3jp AP098C (GPU ATI Mobility Radeon X1700 256MB)

boyamer

24-09-2009 08:30:02

Which version of Mogre you're using?

kubatp

24-09-2009 10:42:19

Hi,
The weird thing is, that it doesn't happen in the same time...it's undeterministic. Sometimes it takes 10s, sometimes 20s, sometimes it's thrown right after the app starts.
Thank you Pavel

smiley80

24-09-2009 11:20:05

Do you get the same error with the sample?
Any differences between OpenGl and DirectX?

Hi,
I actually have a laptop - Asus f3jp AP098C (GPU ATI Mobility Radeon X1700 256MB)

32 or 64 bit Windows?

kubatp

24-09-2009 11:37:10

It's Windows Vista 32.

Actually, I have never tried that sample packed in the Miyagi package, because it's written in .NET 3.5 and I use .NET 2.0.
I can't try if there is a difference in OpenGL and DirectX right now, but I wil try it this evening.

Thank you for your help. I appreciate it and the Miyagi effort as well.

smiley80

24-09-2009 18:40:43

You should be able to run the sample with 2.0, you only need 3.5 if you want to build it.

kubatp

24-09-2009 22:23:55

You are right, indeed I can run it. I just didn't know it's already compiled in the package.

It works for me, the FPS is low (just 60), but it works. I was playing around with all the features and controls and it crashed once. Unfornately I was not able to reproduce it again, even I was trying it for 10 minutes. But it seems to be ok, at least it doesn't crashes so fast like me app.

smiley80

24-09-2009 23:22:01

the FPS is low (just 60), but it works.
That's normal, VSync is turned on.

You could try to add the controls one by one, perhaps there's one that causes the error or it's influenced by the amount of controls.

kubatp

26-09-2009 10:08:34

Hi,
I tried to play play around with those controls. It seems like, the problem is not just one of those components. I haven't tried one by one, but I tried standalone panel (which was OK), standalone panel with button (crashed), standalone panel with listBox (crashed), standalone panel with button (crashed).
There is probably no proper scenario how to recreate the exception, however there is one thing I have noticed - every time, right before the exception is thrown, one of those components changes colour to white. Is this something helpful or you already know this?

I have one more question - why there is no way to set the position of the mouse cursor? What I try to do, is the ability to change direction of the camera, when user presses right mouse and move with mouse (i.e. the usual 3D view). When user presses the right button, it hides the cursor, however there is no way to say "don't move with the cursor", so even the cursor is not displayed, it moves. When user releases the button, it shows the cursor again, however on another position. I supposed I will remember last cursor position and right before it is showed, it will set the cursor position to the remembered one. It's not possible to set the cursor position. How can I solve this?
Thank you Pavel

smiley80

27-09-2009 00:57:30

however there is one thing I have noticed - every time, right before the exception is thrown, one of those components changes colour to white. Is this something helpful or you already know this?

I get that when I use a wrong texture handle, but it doesn't crash.

I have one more question - why there is no way to set the position of the mouse cursor?

You could use GuiManager.InputManager.InjectMouseMoved(x, y, false) where x and y are the new absolute mouse position.
But Mois doesn't support setting the mouse position, so you'll end up with the old position when you move the mouse.

kubatp

28-09-2009 12:05:59

I get that when I use a wrong texture handle, but it doesn't crash.
It actually doesn't crash at GuiManager.Update() but right after this call in Mogre.Root.RenderOneFrame(). Can I help somehow to solve this issue?

You could use GuiManager.InputManager.InjectMouseMoved(x, y, false) where x and y are the new absolute mouse position.
But Mois doesn't support setting the mouse position, so you'll end up with the old position when you move the mouse.

I see. So another question. Is there a way how to prevent mouse from moving? This would solve my problem. I simply prevent mouse from moving and hide it. When user releases the mouse button, I enable moving and display the cursor again.

kubatp

30-09-2009 23:59:26

Hi,
is there a way how to sort this out?
I already have another question. I am trying to add button with hover and press effect. How to implement this the easiest way? Do I need to use this guis.mgx or this is not necessary?
If there is some kind of tutorial, I will go through it and sort it out on my own, but there isn't a tutorial, is it?

Thank you Pavel

smiley80

01-10-2009 00:53:46

I see. So another question. Is there a way how to prevent mouse from moving?

You could stop capturing it. But since you'd then lose mouse input for your main program, you'll need two Mois.Mouse instances.

I am trying to add button with hover and press effect. How to implement this the easiest way?
The easiest way is to have three image files:
MyButton.png
MyButton.MouseEnter.png
MyButton.MousePressed.png

and then create the MaterialScheme like this:
GuiManager.Singleton.CreateMaterialScheme("ButtonMaterial", typeof(Button), "MyButton", false);
and use it to create a button:
new Button("Button", "ButtonMaterial", new Size(128, 32), new Position(100, 300));

smiley80

01-10-2009 09:02:05

Okay, I take back my previous statement, there is a way to set the mouse position in Mois.
That will be implemented into the next release, in the meantime you can use this method:
 private void SetMousePosition(int x, int y) { MOIS.MouseState_NativePtr msnp = this.inputMouse.MouseState; MOIS.Axis_NativePtr anp = msnp.X; anp.abs = x; anp = msnp.Y; anp.abs = y; GuiManager.Singleton.InputManager.InjectMouseMoved(x, y, false); }

kubatp

01-10-2009 10:23:47

Hi Smiley,
I will definitely try this mouse injection and the new button creation this evening.
Thank you, that you have pointed me to the readme file, it was very useful.

Again few more questions:
1) I read all three options of the text scheme creation. Definitely the easiest way is to use ttf file, but is there a way to extend the look by any "effects"? For example the "outer glow" effect? If not, I guess the only way it to create image font with the glyphs already having this effect, right?
2) Is there a way to find and sort out the exception problem? I would like to help with the issue finding. I guess it may be my code's problem, but I already sent it and you said, that it's ok.
3) What materialScheme method would you recommend? Is it better to learn how to write this mgx file and load it from this or create it in code (like you suggested) or use Ogre Materials (which seem to be depreciated from the note in readme file)?

Thank you Pavel

kubatp

01-10-2009 21:07:05

Hi,
I tried the mouse injection function and it works perfectly! I tried the button creation and it works as well, however I have two questions:
1) I am not sure how can I fix the control to a specified anchor. I know there is this anchor property, but I tried to use it and it still sets the position to top left corner
2) The button texture seems to be "blurred" when I sees it in my application. I have been wondering if it's not because of the texturefiltering, however when I change the texturefiltering to none, it was the same.
Any ideas?
Thanks Pavel

smiley80

01-10-2009 22:31:58

1) I read all three options of the text scheme creation. Definitely the easiest way is to use ttf file, but is there a way to extend the look by any "effects"? For example the "outer glow" effect? If not, I guess the only way it to create image font with the glyphs already having this effect, right?

Yes, you have to use an image font for this.

3) What materialScheme method would you recommend? Is it better to learn how to write this mgx file and load it from this or create it in code (like you suggested) or use Ogre Materials (which seem to be depreciated from the note in readme file)?

I'd recommend the automatical way. The manual way (and how MaterialSchemes are saved to mgx) will most likely change in the next version to allow multiple frames per material.

1) I am not sure how can I fix the control to a specified anchor. I know there is this anchor property, but I tried to use it and it still sets the position to top left corner

Anchor only specifies how the control behaves when its parent gets resized (like in WinForms).

2) The button texture seems to be "blurred" when I sees it in my application. I have been wondering if it's not because of the texturefiltering, however when I change the texturefiltering to none, it was the same.

Might be due to scaling.
Do you see any difference if you set the filtering to linear (i.e. its more blurred)?

kubatp

02-10-2009 00:08:03

Hi Smiley,
thank you.
Anchor only specifies how the control behaves when its parent gets resized (like in WinForms).
I am not sure if I understand it correctly. Does it really work the same way like WinForms do? Winforms can be anchored to the specified corner and when user resizes it, the control will stay in the same distance to the anchored corner. The Mogre GUI works another way. When it's resized, it just "zooms" the same screen, so there is actually no anchor. The question is, how can I anchore the control to the right bottom corner, when I don't know in advance the window size. Is it understanable?

Might be due to scaling.
Do you see any difference if you set the filtering to linear (i.e. its more blurred)?

You were absolutely right. When I changed it to "linear", the texture was clear.

It seems like there is still the problem with exceptions, however I will play around with it to be sure...
Thank you.

smiley80

03-10-2009 02:22:51

I am not sure if I understand it correctly. Does it really work the same way like WinForms do? Winforms can be anchored to the specified corner and when user resizes it, the control will stay in the same distance to the anchored corner. The Mogre GUI works another way. When it's resized, it just "zooms" the same screen, so there is actually no anchor. The question is, how can I anchore the control to the right bottom corner, when I don't know in advance the window size. Is it understanable?

Anchor only works for controls and their parent controls, it doesn't work for top-level controls and the render window.
And unfortunately, changing the screen resolution (i.e. resizing the render window) at runtime messes some things up in the current version.

luismesas

05-10-2009 10:01:29

Hi!!!

Thanks for the SetMousePosition method. It's really usefull.

I have two questions.

Whats the best way to destroy a Control? For isntance, if I have a Panel with a Button, calling

 panel.Controls.Remove(button); button.Dispose(); 

Will remove button from that panel. Will be button properly destroyed or is there a better way?

And more questions.
1. MouseHover is only raised if no mouse button is pressed. Is any way to enable it to be raised with a button pressed?[/*]
2. Is there any way to catch mouse events not used by gui. (moves over no control, clicks over no control...)[/*]
[/list:u]

smiley80

05-10-2009 14:33:35

Will remove button from that panel. Will be button properly destroyed or is there a better way?

Just calling Dispose is sufficient. That includes removing the control from its parent.

MouseHover is only raised if no mouse button is pressed. Is any way to enable it to be raised with a button pressed?

No, but that behaviour might change in future versions.

Is there any way to catch mouse events not used by gui. (moves over no control, clicks over no control...)

You could subscribe to the the Mois events and check whether GuiManager.Singleton.GetTopControl() returns null.

kubatp

05-10-2009 14:59:44

Hi Smiley80,
working with Miyagi goes pretty well, but I can't find these answers in readme file:

1) Is it possible to attach to Miyagi Panel a 3D object (mesh)? I would like to add to one of my panels a 3D object (unit) which will rotate on one of axis. If it's not possible to do it, what is the easiest way to display a 3d unit picture on panel?
2) On one of my another panels should be a game map. This map is dynamic - it's a 2D picture, but dynamic. Is it possible to create a dynamic picture (or texture) on the fly and display it?
3) I have more panels and two of them have one pixel border around them, which doesn't exist in the png texture. I can send a screenshot. The weird thing is, that the border is not around the whole panel. It's ok in the corners. Do you have any ideas, what can be a problem here?
4) I am still getting the same exceptions as I did before. Are there any ways how can I help with the investigation? Just let me know and I will do the best I can. It's currently good for both of us - it can fix my problem and you can find potential bug in Miyagi.

Thank you Pavel

luismesas

05-10-2009 15:05:24

Just calling Dispose is sufficient. That includes removing the control from its parent.
Nice one less line of code.

No, but that behaviour might change in future versions.
Not a big problem.

You could subscribe to the the Mois events and check whether GuiManager.Singleton.GetTopControl() returns null.
Just I thought. Is GetTopControl() a big load?. Will check it.
I created a background transparent panel on bottom and capture that event. But it looses the MouseHover when a button is pressed (that's the reason of my previous question)

PD: Ah I added the SetMousePosition to a new snippet section on Miyagi wiki.

smiley80

05-10-2009 17:06:22

1) Is it possible to attach to Miyagi Panel a 3D object (mesh)? I would like to add to one of my panels a 3D object (unit) which will rotate on one of axis. If it's not possible to do it, what is the easiest way to display a 3d unit picture on panel?

Something like this:
MeshElement me = new MeshElement("MyMeshElement", "MyMeshName", new Size(32, 32), new Position(0, 0)); myPanel.Meshes.Add(me);
Problem at the moment is that the cursor will be rendered behind the mesh.

2) On one of my another panels should be a game map. This map is dynamic - it's a 2D picture, but dynamic. Is it possible to create a dynamic picture (or texture) on the fly and display it?

The next version will have a PictureBox.

3) I have more panels and two of them have one pixel border around them, which doesn't exist in the png texture. I can send a screenshot. The weird thing is, that the border is not around the whole panel. It's ok in the corners. Do you have any ideas, what can be a problem here?

Try a larger texture or a texture with power-of-2 dimensions (if this isn't already the case).

4) I am still getting the same exceptions as I did before. Are there any ways how can I help with the investigation?

It would be nice if you could compile the SVN version, i.e. you'll need .Net 3.5 and VS2008 or #D 3.0.

If you have a lot of controls.

kubatp

05-10-2009 22:22:42

Something like this:
CODE: SELECT ALL
MeshElement me = new MeshElement("MyMeshElement", "MyMeshName", new Size(32, 32), new Position(0, 0));

Problem at the moment is that the cursor will be rendered behind the mesh.

I have tried this with no luck. The mesh is definitely found, but it's not displayed. When I change the mesh name to something non-existing, it throws the exception straight away.

Try a larger texture or a texture with power-of-2 dimensions (if this isn't already the case).
Thank you, that was it!

It would be nice if you could compile the SVN version, i.e. you'll need .Net 3.5 and VS2008 or #D 3.0.
I am currently not able to do it. I have VS2008, but from variety reasons I can't install it for couple months. Here are few things I have found out:
- When I comment the controls creations (i.e. all the material schemes, fonts and cursor are created, but no control is added) there is no exception at all
- When I add one control, it's ok for long time usually, however it crashes as well
- I tried more controls and it seems like all do the same
- More controls mean faster crash

The next version will have a PictureBox.
I absolutely appreciate, that this is just your hobby to create this GUI system. I just need to know roughly when this new version will be created. You mean new version like 1.0 beta 4d or like 2.0?

Thank you Smiley!

smiley80

06-10-2009 00:54:00

I have tried this with no luck. The mesh is definitely found, but it's not displayed. When I change the mesh name to something non-existing, it throws the exception straight away.

Argh, that's a bug. Only happens when you use DirectX, should work fine in OpenGL.

- More controls mean faster crash

I've tested it with ~1000 controls for ~2 hours and it didn't crash.
I'll prepare some test assemblies in the course of this week, maybe that sheds some light upon the cause of the exception.

I absolutely appreciate, that this is just your hobby to create this GUI system. I just need to know roughly when this new version will be created. You mean new version like 1.0 beta 4d or like 2.0?

It will be in 1.0.0 rc1, which is the next planned release (there might be a bug fixing 1.0 beta4d).

In the meantime, if you use a System.Drawing.Bitmap you could try the following:
Create the MaterialScheme of the map:
MaterialScheme msMap = new MaterialScheme("Map"); msMap.Textures["Map"] = "dummy.png"; GuiManager.Singleton.MaterialSchemes.Add(msMap);
'dummy.png' should have the dimensions of the final map.

And then draw the bitmap on the dummy texture:
 unsafe void DrawMap(System.Drawing.Bitmap bitmap) { TexturePtr tex = TextureManager.Singleton.Load("dummy.png", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); HardwarePixelBufferSharedPtr texBuffer = tex.GetBuffer(); texBuffer.Lock(HardwareBuffer.LockOptions.HBL_DISCARD); PixelBox pb = texBuffer.CurrentLock; using (System.Drawing.Bitmap bm = new System.Drawing.Bitmap( (int)tex.Width, (int)tex.Height, (int)((tex.Width * 4) + (pb.RowSkip * 4)), System.Drawing.Imaging.PixelFormat.Format32bppArgb, pb.data)) { using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bm)) { g.DrawImage(bitmap, 0, 0); } } texBuffer.Unlock(); texBuffer.Dispose(); }

boyamer

06-10-2009 16:41:33

Hi,i'm following very much you project and SVN too,refreshing every 20 minutes Lately there
haven't been a lot of activities in SVN,i would like to see shader support on GUI's,that would kill everything,
would be nice if you could provide a SpriteRenderer maybe,with rotation,scale,like XNA now,because you're
the guru of 2d drawing...

Hope you will take this things out and help community!

Cheers

kubatp

06-10-2009 21:52:50

Hi Smiley,
just few quick questions and then I will wait for the next release:)

Argh, that's a bug. Only happens when you use DirectX, should work fine in OpenGL.
Will this be available in the next release?

I've tested it with ~1000 controls for ~2 hours and it didn't crash.
I'll prepare some test assemblies in the course of this week, maybe that sheds some light upon the cause of the exception.

That would be great. Please pass it to me and I will send results asap.

I noticed, that if I define an image font, it is displayed as black only and I can't change colour to something else. Is there some kind of flag, I have to change to have colourful fonts? Currently it's just black.

Thank you Pavel

smiley80

06-10-2009 22:56:43

Will this be available in the next release?

Yes, I only need to add two letters ('R' and 'S') to fix it.

I noticed, that if I define an image font, it is displayed as black only and I can't change colour to something else. Is there some kind of flag, I have to change to have colourful fonts? Currently it's just black.

You can change the colour with:
foreach (MaterialChangingEvent mce in Enum.GetValues(typeof(MaterialChangingEvent))) { myTextScheme.Colours[mce] = new TextScheme.ColourDefinition(colour); }

kubatp

06-10-2009 23:19:01

You can change the colour with:
CODE: SELECT ALL
foreach (MaterialChangingEvent mce in Enum.GetValues(typeof(MaterialChangingEvent)))
{
myTextScheme.Colours[mce] = new TextScheme.ColourDefinition(colour);
}

Unfortunately this doesn't work. Is this valid for image fonts as well? Even this worked, it wouldn't fix it. I would like to have black text with white glow. Is this possible in Miyagi?

I am sorry I have so many questions...

smiley80

06-10-2009 23:42:13

If you use ColourValue.White it should be same colour as the original texture.

kubatp

07-10-2009 10:16:11

Thank you, that works!

smiley80

07-10-2009 20:20:37

Okay, here are the test assemblies: tests.zip

Test 4 will not show any textures.
Test 6 will not render anything at all.

kubatp

07-10-2009 23:34:28

Hi Smiley,
here are the first results, I tested each one of them for five mins:

1 - works
2 - crashes
3 - crashes after a while
4 - works
5 - works
6 - crashes

This doesn't mean, that those working ones would not throw the exception later, but 2 and 6 threw exception in a minute. 3 in three minutes. The rest hasn't creashed at all.
The initial version beta 4c usually crashes even faster (sometimes after 10-20 seconds).
Thank you Pavel

luismesas

08-10-2009 10:19:05

Okay, here are the test assemblies: tests.zip

Test 4 will not show any textures.
Test 6 will not render anything at all.

Could you explain what do you need to do with your test libraries to post here a result? Perhaps I can give you more feedback

luismesas

08-10-2009 10:22:24

For a password textbox, what do you recommend? to use a font with all characters replaced by a mask character or to capture the KeyPress event?

First one does the job transparent to de source code, and second one allows easy design of fonts.

I could ever do the job inside Miyagi and send you a patch file for reviewing it and include it if you want.

kubatp

08-10-2009 10:26:50

Hi luismesas,
the test libraries were created because of there is some kind of exception, which Smiley can't reproduce on his machine and I am constantly able to reproduce it. The exception is described in previous replies in this thread.
Pavel

luismesas

08-10-2009 10:34:57

I'm getting a exception randomly in time when interacting with Miyagi, it can be the same, later at home will do this test to give more feedback.

Perhaps this is related too: I'm constantly adding and removing buttons from a panel and resizing Panel according to number of buttons. I have added to it's Controls Collection. Sometimes Panel texture is rendered on a missplaced position-size. But surprissingly this position-size corresponds to another panel I used in a different class (but on same GUI object). I'm sure on panel names being different and I even checked using different materials for them.

kubatp

08-10-2009 10:47:50

I do get this exception randomly as well. There is no specific list of steps to reproduce it. However I don't even resize or add/remove controls from gui. I just wait a while and it crashes...
Maybe you have the same problem, please take a look on this reply http://ogre3d.org/addonforums/viewtopic.php?f=8&t=9025&start=60#p63853, where is this exception described.

luismesas

08-10-2009 11:04:04

That's not the same Exception. Mine is a crash from Ogre side. Will investigate furter...

Seems like yours is to GPU loosing reference to the texture. Are you using GPU drivers from your laptop manufacturer (Asus) or from ATI? (I suggest ATI ones) Check on your BIOS if those 256mb are fully dedicated to GPU, those kind of laptop GPUs uses to have a config on BIOS where you can say whats the ammount of memory from system you wanna use on GPU.

kubatp

08-10-2009 11:35:00

I guess, it's not the problem with drivers at all. I am currently not sure what drivers are installed there (it's my home laptop), but my GPU works perfectly for almost three years without any problems. All the 3D games work and even MOGRE works. The problem is almost for sure somewhere in Miyagi code. 256MB is not shared, it's dedicated GPU memory.

smiley80

08-10-2009 16:30:28

1 - works
2 - crashes
3 - crashes after a while
4 - works
5 - works
6 - crashes

Hmm, that's strange. If #1 works, #3 and #6 should also work, so please try to crash #1.
Do you see any differences between the debug and release dlls of beta 4c?

For a password textbox, what do you recommend? to use a font with all characters replaced by a mask character or to capture the KeyPress event?
The former should be easier. I'll add a PasswordChar property in the next version.

Perhaps this is related too: I'm constantly adding and removing buttons from a panel and resizing Panel according to number of buttons. I have added to it's Controls Collection. Sometimes Panel texture is rendered on a missplaced position-size. But surprissingly this position-size corresponds to another panel I used in a different class (but on same GUI object). I'm sure on panel names being different and I even checked using different materials for them.

Try to set the parent of the buttons to null or, if feasible, dispose them.

luismesas

08-10-2009 17:53:09

Try to set the parent of the buttons to null or, if feasible, dispose them.

I'm currently dispossing them. To avoid this, I Have a panel, with a string.Empty material name, as parent of a second panel and a group of buttons.

kubatp

08-10-2009 21:48:58

Hmm, that's strange. If #1 works, #3 and #6 should also work, so please try to crash #1.
Do you see any differences between the debug and release dlls of beta 4c?

I let the application go for 30 minutes and then I played with it for another ten minutes and it didn't crash. Assembly Test 1 worked. I can try to let it go longer if you want, but it seems like it really works.
I tried both debug and release 4c dll and both crashed after a while.

kubatp

08-10-2009 22:50:09

Two more questions:
1) I declared two image fonts this way:
 Miyagi.Core.TextScheme nyalaImage2 = Miyagi.Core.TextScheme.FromFont("imagefontsmall", (FontPtr)FontManager.Singleton.Load("guifontsmall", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)); foreach (Miyagi.Core.MaterialChangingEvent mce in Enum.GetValues(typeof(Miyagi.Core.MaterialChangingEvent))) { nyalaImage2.Colours[mce] = new Miyagi.Core.TextScheme.ColourDefinition(ColourValue.White); } nyalaImage2.CreateFont(); nyalaImage2.Name = "imagefontsmall"; nyalaImage2.SpaceWidth = 0; Miyagi.Core.GuiManager.Singleton.TextSchemes.Add(nyalaImage2); Miyagi.Core.TextScheme nyalaImage = Miyagi.Core.TextScheme.FromFont("imagefont", (FontPtr)FontManager.Singleton.Load("guifont", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)); nyalaImage.CreateFont(); nyalaImage.Name = "imagefont"; Miyagi.Core.GuiManager.Singleton.TextSchemes.Add(nyalaImage); foreach (Miyagi.Core.MaterialChangingEvent mce in Enum.GetValues(typeof(Miyagi.Core.MaterialChangingEvent))) { nyalaImage.Colours[mce] = new Miyagi.Core.TextScheme.ColourDefinition(ColourValue.White); } 
Unfortunately only the imagefontsmall works. If I use imagefont, it doesn't display anything. If I remove the imagefontsmall declaration, it displays correctly imagefont.

2) Is there a way how to set MOIS mouse sensitivity? (it's maybe not directly related to Miyagi).
Thank you

smiley80

09-10-2009 01:20:20

Assembly Test 1 worked.
Since it only contains fixes, you can continue to use it.

1) I declared two image fonts this way:

Do those fonts, by any chance, point to the same texture or have both textures the same name?

2) Is there a way how to set MOIS mouse sensitivity? (it's maybe not directly related to Miyagi).

Not to my knowledge. But because I now know how to set the mouse position, I'll try to implement it.

kubatp

09-10-2009 08:23:17

Do those fonts, by any chance, point to the same texture or have both textures the same name?
No, I checked all the possibilities how those fonts can be related and nothing. Here are font defs:
 guifontsmall { type image source guifontsmall.png glyph ! 0.0859375 0.125 0.101563 0.1875 

 guifont { type image source guifont.png glyph ! 0.0859375 0.125 0.101563 0.1875 

But let me experiment with it little bit more, it could be a problem with my code. I was just wondering if you know any obvious hints why it doesn't work.

Not to my knowledge. But because I now know how to set the mouse position, I'll try to implement it.
Smiley thank you for your efford, but this is really low priority and not related to Miyagi anyway. I think you have helped me (and all the guys who use Miyagi) already a lot. I know you have lot of work with Miyagi itself, so don't waste your valuable time with this:)

Pavel

luismesas

09-10-2009 09:13:48

Smiley thank you for your efford, but this is really low priority and not related to Miyagi anyway. I think you have helped me (and all the guys who use Miyagi) already a lot. I know you have lot of work with Miyagi itself, so don't waste your valuable time with this:)

Same. It's more on MOIS side...

kubatp

09-10-2009 10:30:00

I actually have one more question. Is it possible to add Miyagi controls to the MOGRE node (i.e. to SceneNode)? I would like to display small panels with texts on the terrain.

luismesas

09-10-2009 17:14:48

For a password textbox, what do you recommend? to use a font with all characters replaced by a mask character or to capture the KeyPress event?
The former should be easier. I'll add a PasswordChar property in the next version.

Thanks! Shaw this change on SVN version!

Works perfectly

kierenj

09-10-2009 18:11:31

Hiya -

I'm writing my own GUI for Mogre (only for my use atm), from first principles - I was wondering how you dealt with scrolling content, eg text within a textbox or vertically scrolling windows / parent controls (does Miyagi do the latter?). Do you just manually calculate each character's position/texcoords to fit the textbox, or do something stencilly/clippy?

Thanks!

kubatp

09-10-2009 20:08:14

Hi Smiley,
actually one more - Panel has Border property. How should I use this UV? It's not describe in the help file.
Thank you

smiley80

10-10-2009 01:41:07

I actually have one more question. Is it possible to add Miyagi controls to the MOGRE node (i.e. to SceneNode)? I would like to display small panels with texts on the terrain.
You need to get the 2D coordinates of the node like described here (Note: they are [0;1]), and then update the position of the control. If you want to zoom the controls, you need the distance of the node to the camera, and then change the size of the control appropriately.

Hiya -
I'm writing my own GUI for Mogre (only for my use atm), from first principles - I was wondering how you dealt with scrolling content, eg text within a textbox or vertically scrolling windows / parent controls (does Miyagi do the latter?).

Miyagi currently only has the option to cut away overhanging controls (for that, it uses RenderSystem.SetScissorTest).
However, scrolling content for panels is on my list for rc1, something like:
When the size/position of a child or the size of the parent changes -> check if (and how much) the children are outside of the parent -> show/adjust the scrollbar.
When the user moves the scrollbar -> translate the verticies of the children.

Do you just manually calculate each character's position/texcoords to fit the textbox, or do something stencilly/clippy?

It gets the glyth's texcoords and calculates the size in pixels, and creates the corresponding quad (well, 2 triangles) till it runs out of space or characters.

Hi Smiley,
actually one more - Panel has Border property. How should I use this UV? It's not describe in the help file.
Thank you

UV describes the uv-coordinates of the center rectangle in the texture that's not used for the actual border.
See Panel.Border.png in the sample, which uses the default value (0.25, 0.25, 0.75, 0.75).

kierenj

10-10-2009 09:52:13

Thankyou

luismesas

11-10-2009 18:57:36

smiley,

Setting Loglevel to BOREME there is a Warning that may be related with recurrent exception of kubatp and me

 19:58:14: WARNING: Texture instance 'Miyagi_Caret' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.

I have an empty screen with two textboxes (a clena login screen), if no one have focus (no caret) there is no exception for ages. If any of both has focus then there is a crash at random time elapsed.

smiley80

11-10-2009 20:33:01

If you get an InvalidCastException try the test1 assembly from here.

kubatp

12-10-2009 11:48:54

Hi Smiley,

You need to get the 2D coordinates of the node like described here (Note: they are [0;1]), and then update the position of the control. If you want to zoom the controls, you need the distance of the node to the camera, and then change the size of the control appropriately.
This solution seems to be little bit dirty. I understand, that you get position of the element on the screen and you can place there Miyagi controls. But isn't it dirty solution? I appreciate your knowledge of MOGRE, so I have a question is (even it doesn't have to be Miyagi related) - isn't there a better way to do this? Maybe Miyagi is not useful here, but is there something ready to use, which can solve this problem?
I attach the screenshot from Civ4. I try to gain something similar - when you move or rotate the camera, the city "name" rotates slowly to your direction against "you".

kubatp

12-10-2009 11:56:37

Btw. the Border.UV property - great and easy to use. Thank you!

smiley80

12-10-2009 18:24:01

This solution seems to be little bit dirty. I understand, that you get position of the element on the screen and you can place there Miyagi controls. But isn't it dirty solution?
Well, I can't really attach a control to a SceneNode, because they aren't MovableObjects.

But the following will center the control below the center of the bottom face of a MovableObject's bounding box:
 private void AttachToMovableObject(MovableObject mo, BaseControl control) { Vector2 result; if (GetScreenspaceCoords(mo, this.camera, out result)) { int x = (int)(result.x * this.window.Width); x -= control.Width / 2; int y= (int)(result.y * this.window.Height); control.Position = new Position(x,y); } } private bool GetScreenspaceCoords(MovableObject mo, Camera camera, out Vector2 result) { result = Vector2.ZERO; if(!mo.IsInScene) return false; AxisAlignedBox AABB = mo.GetWorldBoundingBox(true); Vector3 point = (AABB.GetCorner(AxisAlignedBox.CornerEnum.FAR_LEFT_BOTTOM) + AABB.GetCorner(AxisAlignedBox.CornerEnum.FAR_RIGHT_BOTTOM) + AABB.GetCorner(AxisAlignedBox.CornerEnum.NEAR_LEFT_BOTTOM) + AABB.GetCorner(AxisAlignedBox.CornerEnum.NEAR_RIGHT_BOTTOM)) / 4; // Is the camera facing that point? If not, return false Plane cameraPlane = new Plane(camera.DerivedOrientation.ZAxis, camera.DerivedPosition); if(cameraPlane.GetSide(point) != Plane.Side.NEGATIVE_SIDE) return false; // Transform the 3D point into screen space point = camera.ProjectionMatrix * (camera.ViewMatrix * point); // Transform from coordinate space [-1, 1] to [0, 1] and update in-value result.x = (point.x / 2) + 0.5f; result.y = 1 - ((point.y / 2) + 0.5f); return true; } 
It has to be called manually whenever the object or the camera is moved (unless you use listeners).

rattus

23-10-2009 11:38:54

Hi,
i'm fighting with getting listboxes to display anything.
Sample works, but when i try create listbox by code, or even load it then from xml there are no visible items.

 Miyagi.ListBox tmpList = new Miyagi.ListBox( "tmpList", "Listbox", new Miyagi.Size( 150, 150 ), new Miyagi.Position( 20, 10 ) ) { TextSchemeName = "WhiteText", Anchor = Miyagi.Alignments.Left | Miyagi.Alignments.Top, ItemTextSchemeName = "WhiteText", }; tmpList.Items.Add( "Test1" ); tmpList.Items.Add( "Test2" ); tmpList.Items.Add( "Test3" ); Miyagi.GuiManager.Singleton.AddOrphanControls( panelBottom.Controls ); 
WhiteText is defined as white font, works on other elements
result is empty listbox, visibleItems = 0.
i'm using mogre 1.4.8 and miyagi 1.0 beta 2 ( latest version crashes even on sample for me )
Any suggestions welcome

smiley80

23-10-2009 12:38:54

Try setting tmpList.ItemSize to an appropriate size.

Try the dll in the test1 folder from here (together with the latest release) if it's an InvalidCastException.

rattus

23-10-2009 12:59:29

Try setting tmpList.ItemSize to an appropriate size.
my hero
thanks

Try the dll in the test1 folder from here (together with the latest release) if it's an InvalidCastException.

with the test1 dll debug version works well, on release i get
"Method not found: 'Void Mogre.RenderSystem._setSeparateSceneBlending(Mogre.SceneBlendFactor, Mogre.SceneBlendFactor, Mogre.SceneBlendFactor, Mogre.SceneBlendFactor)'." which is probably because of mixed dll versions from mogre ( i got big mess of it now in release dir).
But i will stick to the older version for some time anyway until moving to the newer ( i bet you'll release yet another version meantime )

PantheR

25-10-2009 06:35:51

I have a qusetion:
Is there smth special about DropDownList scrollbar? It doesn't work for me with dll from Test #1 so i can't scroll down items i need Btw, no crashes yet - that;s good.

Another question: Do you have any ideas how to restrict click through GUI elements?

And the last one: Is there any potential release date of a new dll version or may be usable SVN update including Ptr exception hotfix?

smiley80

25-10-2009 08:09:04

Is there smth special about DropDownList scrollbar? It doesn't work for me with dll from Test #1 so i can't scroll down items i need

It should work if there are more items than the DropDownList can display.

Another question: Do you have any ideas how to restrict click through GUI elements?

Sorry, I'm not entirely sure what you mean.

And the last one: Is there any potential release date of a new dll version

When it's done.™

or may be usable SVN update including Ptr exception hotfix?

The fix has already been committed to SVN. I wouldn't say that the trunk is 'stable' but it's 'usable'.

PantheR

25-10-2009 22:28:00

Another question: Do you have any ideas how to restrict click through GUI elements?

Sorry, I'm not entirely sure what you mean.

I mean that i need to check which Panels(with elements) i click on and do not allow further OnClick event processing for some of them (so called click-through element feature i.e. i'm coding game level editor with mouse pickup functions - i don't need to process pickup on Panel click etc. ). So i have OnMouseClick event working - how can i check which Miyagi elements has been clicked?

It should work if there are more items than the DropDownList can display.
I have more items in ddl than i can see but scrollbar isn't interactible - i can see it but i can't do anything with it. I've copied ddl creation from examples found in Miyagi SDK.

P.S.: Smiley80, There is a feature with DropDownListBox i want you to take a notice: when i click ddlb button that show ddList it is Ok but it will be nice to close ddList by clicking that button again (by now you must click elsewhere to close it - it is uncomfortable for apps where every single click elsewhere doeas matter)

smiley80

25-10-2009 23:14:23

I mean that i need to check which Panels(with elements) i click on and do not allow further OnClick event processing for some of them (so called click-through element feature i.e. i'm coding game level editor with mouse pickup functions - i don't need to process pickup on Panel click etc. ). So i have OnMouseClick event working - how can i check which Miyagi elements has been clicked?

If you set the Active property to false, the click goes through the control (this is currently also the case with Enabled set to false, but the next version will change that).
The 'sender' parameter of the eventhandler is the clicked control.

I have more items in ddl than i can see but scrollbar isn't interactible - i can see it but i can't do anything with it. I've copied ddl creation from examples found in Miyagi SDK.

Does it work in the sample?

P.S.: Smiley80, There is a feature with DropDownListBox i want you to take a notice: when i click ddlb button that show ddList it is Ok but it will be nice to close ddList by clicking that button again (by now you must click elsewhere to close it - it is uncomfortable for apps where every single click elsewhere doeas matter)

Will be in the next SVN update.

PantheR

25-10-2009 23:31:40

I have more items in ddl than i can see but scrollbar isn't interactible - i can see it but i can't do anything with it. I've copied ddl creation from examples found in Miyagi SDK.

Does it work in the sample?

Yes it work. I've checked my code and it seems to be similar... my be i missed smth. So i'm listing my piece of code here:
 GuiManager.Singleton.Initialize(false); Gui mygui = GuiManager.Singleton.CreateGui("lvleditor_gui"); GuiManager.Singleton.DefaultTextScheme = GuiManager.Singleton.CreateTextScheme("MyTextScheme", "bluehigh.ttf", 16, 72, ColourValue.Black); GuiManager.Singleton.CreateTextScheme("MyTextScheme", "bluehigh.ttf", 16, 72, ColourValue.Black); GuiManager.Singleton.DoScissorTest = true; TextScheme ts_list = new TextScheme("ts_list", "bluehigh.ttf", 14, 72, ColourValue.Black); ts_list.Colours[MaterialChangingEvent.MousePressed] = new TextScheme.ColourDefinition(ColourValue.Red, ColourValue.White); ts_list.Colours[MaterialChangingEvent.MouseEnter] = new TextScheme.ColourDefinition(new ColourValue(1, 1, 1)); GuiManager.Singleton.TextSchemes.Add(ts_list); GuiManager.Singleton.CreateMaterialScheme("DropDownListMaterial", typeof(Miyagi.Controls.DropDownList), "DropDownList", true); //Object select panel Miyagi.Controls.Panel ws_panel = new Miyagi.Controls.Panel("ws_panel", "PanelMaterial", new Miyagi.Core.Size(210, 350), new Position(100, 100)) { Movable = true, MinSize = new Miyagi.Core.Size(100,100), MagneticDockSize = new Miyagi.Core.Size(), ResizeAreaSize = new Miyagi.Core.Size(), ZOrder = 10, Border = { Size = new BorderSize(3, 16, 3, 3) } }; Miyagi.Controls.DropDownList comb = new Miyagi.Controls.DropDownList("DropDownList", "DropDownListMaterial", new Miyagi.Core.Size(100, 25), new Position(10, 40)) { ZOrder = 41, DropDownListSize = new Miyagi.Core.Size(100, 300), Items = { Offset = new Position(5, 0), Size = new Miyagi.Core.Size(79, 20), TextScheme = ts_list, }, Text = { Offset = new Position(8, 0) }, ScrollBar = { AlwaysVisible = true, Width = 16, Thumb = { Border = { Size = new BorderSize(2, 2, 2, 2) } } } }; comb.Items.AddRange(new string[] { "Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9", "Item10", "Item11", "Item12", "Item13", "Item14", "Item15", "Item16", "Item17", "Item18" }); ws_panel.Controls.Add(comb); mygui.Controls.Add(ws_panel); 
Mouse and Update stuff is not included.

PantheR

25-10-2009 23:36:35

Btw, there is a weird but understandable feature with DropDownList: ddl placed in the panel is croped inside the panel rectangle so if opened ddl is too long in height it will be cut off by the panel rectangle. Instead of this it will be nice to have ddl added to the Panel, but drop down list itself placed as a standalone object above parent panel.

PantheR

26-10-2009 00:05:55

Hmmm... SVN tells me that last update was:
r202
* fixed Padding and Border issues
Oct 10, 2009
Tobias.Bohnen

Is that Ok? You've mentioned an update to SVN.
Am i messed up smth?

smiley80

26-10-2009 23:31:06

Yes it work. I've checked my code and it seems to be similar... my be i missed smth. So i'm listing my piece of code here

Do the items change their colour if you move the mouse over them?

Btw, there is a weird but understandable feature with DropDownList: ddl placed in the panel is croped inside the panel rectangle so if opened ddl is too long in height it will be cut off by the panel rectangle. Instead of this it will be nice to have ddl added to the Panel, but drop down list itself placed as a standalone object above parent panel.
Yeah, that'll change when I implement manual cropping.

Is that Ok? You've mentioned an update to SVN.
Am i messed up smth?

This has the InvalidCastException fix. The DropDownList change will be in the next update (in the next couple of days).

PantheR

27-10-2009 23:39:03

Yes it work. I've checked my code and it seems to be similar... my be i missed smth. So i'm listing my piece of code here

Do the items change their colour if you move the mouse over them?

Yes, items are fully functional. Only scroll bar seems frozen.

smiley80

29-10-2009 11:12:42

Do you get the same behaviour with ListBoxes?

Note: ScrollBars only move if you drag the thumb; background clicks don't work yet.

PantheR

31-10-2009 16:55:47

Do you get the same behaviour with ListBoxes?

Note: ScrollBars only move if you drag the thumb; background clicks don't work yet.

Yes, same thing for ListBoxes too.

kubatp

03-11-2009 21:42:50

Hi Smiley,
I have interesting news!
I think it still throws the exception with test1.dll from time to time, but at least it's not so prompt, so I am able to test my own stuff.

However there is another exception I am able to reproduce every time! This is probably another exception, but because of I am able to reproduce it every time, we can work on this and fix it. The exception is actually described here http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=11487 . I am sure it's caused by Miyagi, because I have tested it with and without Miyagi and it fails every time with Miyagi and never without it.
I have tried it with all six test dlls you sent and it fails with all of them.

smiley80

04-11-2009 00:30:04

Try this one.

kubatp

04-11-2009 10:01:01

Hi Smiley,
unfortunately this didn't help. I know it's really difficult to find and issue when I don't have VS2008 to use your source code, however is there a chance that we can sort this out?
Pavel

kubatp

20-11-2009 10:11:15

Hi Smiley,
I have a button, which has UV border. I know, that I can change a texture of content on some events, but is it possible to change border texture on these events as well?
Thank you Pavel

luismesas

20-11-2009 10:16:46

Hi Kubatp

I don't have any code now here, but if I remmember corerctly, you can have a set of textures with _border on witch you can set your border texture. There is a control on smiley samples that is using it.

luismesas

20-11-2009 10:20:03

The name of the file must be in format

texturename.Border.png

luismesas

20-11-2009 10:21:14

Hi Smiley,
actually one more - Panel has Border property. How should I use this UV? It's not describe in the help file.
Thank you

UV describes the uv-coordinates of the center rectangle in the texture that's not used for the actual border.
See Panel.Border.png in the sample, which uses the default value (0.25, 0.25, 0.75, 0.75).

smiley80

20-11-2009 11:02:29

Hi Smiley,
I have a button, which has UV border. I know, that I can change a texture of content on some events, but is it possible to change border texture on these events as well?
Thank you Pavel

No, you'd have to change that manually in the event handler.
But there's separate border material for focused controls (which is somewhat like MousePressed):
BaseName.Focused.Border

kubatp

20-11-2009 11:22:08

Thank you Smiley, I will try it during weekend.

Hi Luismesas, I actually talked about texture of the border for specified events. I.e. you specify border texture. When user hovers over the button, it should change the border texture and inner texture as well.

kubatp

20-11-2009 19:31:31

No, you'd have to change that manually in the event handler.
But there's separate border material for focused controls (which is somewhat like MousePressed):
CODE: SELECT ALL
BaseName.Focused.Border

Hi Smiley, I have tried this, but none of these solutions work for me.
How can I set border texture in the event handler, when BorderElement doesn't have the Texture property?
This BaseName.Focused.Border doesn't work either. I have these files:
windowActionButton.png
windowActionButton.Border.png
windowActionButton.MouseEnter.png
and I tried windowActionButton.Focused.Border.png
but it doesn't change the border texture.
What am I doing wrong?
Thank you Pavel

smiley80

20-11-2009 20:01:15

How can I set border texture in the event handler, when BorderElement doesn't have the Texture property?

You can change the filename in the MaterialScheme, but this will also change the borders of other controls, that use this MaterialScheme.
e.g.:
myMs.Textures["windowActionButton.Border"] = "windowActionButton.Focused.Border.png";

This BaseName.Focused.Border doesn't work either.

I've forgot to mention, that it doesn't work if you don't have the basic focused material (i.e. BaseName.Focused).
Make a copy of 'windowActionButton.png' and name it 'windowActionButton.Focused.png'.

Beauty

29-11-2009 06:13:38

I tried the demo of the current version and found a bug.

When you type an unknown letter to the TextBox then the application crashes. (Exit without error message)
For such cases there could be included a try/catch block.
Or define a list of supported letters and ignore the rest. (not so nice if somebody need special letters of other languages)

Maybe the crash happens when a letter wasn't found in the used font.
If so - nice would be to check available letters and ignore other inputs (or use an other symbol like ? or a box or bullet).

Beauty

29-11-2009 06:19:45

smiley80, in the sample application you forgot to rename the name of GUI system.

Look to file AssemblyInfo.cs in directory MiyagiSample\Properties.
[assembly: AssemblyTitle("MbuttonGUI")] [assembly: AssemblyProduct("MbuttonGUI")]

Beauty

01-12-2009 00:40:59

I looked to the current Miyagi, because I would like to add the example to the MogreSDK.

When I tried to compile, I got an error: "FSharp" didn't found.
Related to Miyagi.Scripting.FSharp
For the SDK I don't need it, but I just wanted to tell you.

The media files I would like to add to the MogreSDK.
Am I allowed to do so? I have no idea about the licences. Or if it's public domain.
Some things could be allowed only when adding an extra comment or licence file.

smiley80

01-12-2009 01:33:27

You'll need the F# CTP May 2009 release (I mentioned that in this thread, but forgot to add it to the readme).

You can add the media files, as long as you DON'T attribute me.

boyamer

01-12-2009 09:59:30

Does rendering of sprites influences by compositor?
Seams my gui is getting changes after applying HDR or Glass,do you know how
to disable Compositors on GUI?

Thanks

smiley80

01-12-2009 15:51:42

Create a transparent viewport (SetClearEveryFrame(false)) with a higher zOrder than your main viewport, and set GuiManager.Singleton.Camera to the camera of that viewport.

sirleon

04-12-2009 17:55:25

Create a transparent viewport (SetClearEveryFrame(false)) with a higher zOrder than your main viewport, and set GuiManager.Singleton.Camera to the camera of that viewport.

how?

//this doesn't work
guiView.SetClearEveryFrame(false);

//_guiMgr.Camera.Viewport = guiView; <- error is read-only

smiley80

04-12-2009 18:50:16

You have to create a new camera, and a new viewport from that camera.
So something like this:
this.guiCam = this.sceneMgr.CreateCamera("GuiCam"); this.guiViewport = this.window.AddViewport(this.guiCam, 10); this.guiViewport.SetClearEveryFrame(false); this.guiViewport.ShadowsEnabled = false; this.guiViewport.SetVisibilityMask(0); GuiManager.Singleton.Camera = this.guiCam;

rattus

09-12-2009 15:10:47

Hello again,

I am trying to use the new version ( beta 4c ) and still having problems running it - even sample application.

I tried default mogre in the miyagi build ( 1.6.2 ), 1.6.4, 1.4.8 but none work, all give me following error

 16:04:27: Texture: Miyagi_bluehigh.ttf_14Texture: Loading 1 faces(PF_BYTE_LA,512x256x1) with 0 generated mipmaps from Image. Internal format is PF_BYTE_LA,512x256x1. 16:04:28: Texture: Logo.png: Loading 1 faces(PF_A8R8G8B8,283x200x1) with 9 generated mipmaps from Image. Internal format is PF_A8R8G8B8,512x256x1. 16:04:28: D3D9 : ***** Dimensions altered by the render system 16:04:28: D3D9 : ***** Source image dimensions : 79x20 16:04:28: D3D9 : ***** Texture dimensions : 128x32 16:04:28: Texture: ListBoxTexture1.png: Loading 1 faces(PF_A8R8G8B8,79x20x1) with 7 generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1. 16:04:28: OGRE EXCEPTION(3:RenderingAPIException): Failed to DrawPrimitive : Invalid call in D3D9RenderSystem::_render at ..\src\OgreD3D9RenderSystem.cpp (line 2912) 16:04:28: OGRE EXCEPTION(3:RenderingAPIException): Failed to DrawPrimitive : Invalid call in D3D9RenderSystem::_render at ..\src\OgreD3D9RenderSystem.cpp (line 2912) 16:04:28: *-*-* OGRE Shutdown 

i recompiled miyagi dll for each of these mogre versions but the error is still there. when stepping through miyagi sample, setup finishes correctly, exception is thrown on root.StartRendering();

i'm out of ideas what could be wrong, maybe something with my system, this crashes on my laptop ( running old miyagi sample ok ) but beta4c build works on my home computer without hitch when just unzipped..

EDIT: I have probably just old direct x version on laptop, opengl version works.

Beauty

09-12-2009 20:17:20

Here you can download the DirectX web installer, which installes the latest DirectX version to your computer.

rattus

09-12-2009 20:44:46

tried webinstaller which told me i have nothing missing, ran also latest redist package, didn't help.

OpenGL renderer works though. now i'm totaly confused
I doubt there is something in miyagi that is not working on intel GMA950 graphic, i have to try some mogre 1.6.x demos to confirm i have at least basic mogre running

EDIT : all mogre 1.6.4 samples are working on d3d without problem. miyagi ends with same error in logs.

smiley80

09-12-2009 23:21:09

Make sure you use the latest graphics card driver.
Set GuiManager.DoScissorTest to false (the card might not support scissor tests).

Unfortunately, nothing of that seems to be related to what Miyagi does.

running old miyagi sample ok
That's the overlay-based beta 2, right?

rattus

10-12-2009 10:34:17

Setting scissor test to false did not help.

old version - yes, beta 2.

I would be fine with running my project under opengl on laptop and d3d on home computer, but the project is using some d3d only features.. damn luck.

smiley80

10-12-2009 13:19:47

In SpriteRenderer.cs change the following:
line 147: 'this.spriteList.Remove(sprite);' to 'if (this.spriteList.Remove(sprite))'
line 348: 'true' to 'false'

If this doesn't make a difference (and I don't think it will) try the SVN trunk version.

WarehouseJim

11-12-2009 11:02:26

I'm using r210 from Source:
I found that to update Miyagi when you resize the screen requires the following:
 GuiMgr.ScreenResolutionX = x; GuiMgr.ScreenResolutionY = y; GuiMgr.Cursor.Dispose(); //Dispose, don't set to null, or you'll get dead cursors lying around the screen. GuiMgr.CreateCursor("CursorMaterial", new Size(16, 16), new Position(0, 0)); GuiMgr.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeLeft, new Position(8, 8)); GuiMgr.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeTop, new Position(8, 8)); GuiMgr.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeTopLeft, new Position(8, 8)); GuiMgr.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeTopRight, new Position(8, 8)); foreach(var gui in GuiMgr.Guis) { foreach(var control in gui.Controls) { control.ForceRedraw(); } } MOIS.MouseState_NativePtr state = inputMouse.MouseState; state.width = x; state.height = y; 
Is this the right way to do it? Is there a single function to update all?

WarehouseJim

11-12-2009 11:36:56

A bug:

I'm currently using r210 from SVN.

I've had a bug, which has been a big issue for a while whereby my program crashes due to something in Miyagi, hence I now compile from source. It happens at a random point in the program's execution, but typically will have happened within a few minutes. I have narrowed it down to a control which has a number of Labels which are updated every frame (they show stats like FPS etc). The exception is:
 System.InvalidCastException was unhandled Message="The underlying type of the ResourcePtr object is not of type Font." Source="Mogre" StackTrace: at Mogre.FontPtr.op_Implicit(ResourcePtr ptr) at Miyagi.Core.TextScheme.MeasureString(String text) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Core\TextScheme.cs:line 345 at Miyagi.Controls.Label.OnTextChanged(String newText) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Label.cs:line 326 at Miyagi.Controls.Label.Miyagi.Controls.Elements.ITextElementOwner.OnTextChanged(String newText) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Label.cs:line 237 at Miyagi.Controls.Elements.TextElement.OnTextChanged(String newText) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Elements\TextElement.cs:line 235 at Miyagi.Controls.Elements.TextElement.OnStylePropertyChanged(Object sender, PropertyChangedEventArgs e) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Elements\TextElement.cs:line 194 at Miyagi.Controls.Elements.BaseStyle.OnPropertyChanged(String propertyName) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Elements\BaseStyle.cs:line 71 at Miyagi.Controls.Elements.TextStyle.set_Value(String value) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Elements\TextStyle.cs:line 214 at Miyagi.Controls.Label.set_Text(String value) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Label.cs:line 131 at _3dViewer.MogreForm.UpdateFpsStats() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\myproject\3dViewer\MogreForm.cs:line 952 at _3dViewer.MogreForm.FrameStarted(FrameEvent evt) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\myproject\3dViewer\MogreForm.cs:line 608 at Mogre.Root.raise_FrameStarted(FrameEvent evt) at Mogre.Root.OnFrameStarted(FrameEvent evt) at Mogre.FrameListener_Director.frameStarted(FrameListener_Director* , FrameEvent* evt) at Ogre.Root.renderOneFrame(Root* ) at Mogre.Root.RenderOneFrame() at _3dViewer.MogreForm.Go() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\myproject\3dViewer\MogreForm.cs:line 342 at Test.Program.Main() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\myproject\3dViewer\Program.cs:line 20 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: 
-the code that errored was: FontPtr font = FontManager.Singleton.GetByName(this.Font.Name);
-this.Font.Name = "Miyagi_bluehigh.ttf_16"

Another exception from another run:
System.AccessViolationException was unhandled Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Source="Mogre" StackTrace: at Ogre.TextureUnitState.getTextureName(TextureUnitState* ) at Mogre.TextureUnitState.get_TextureName() at Miyagi.Core.TextScheme.FontDefinition.get_TextureName() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Core\TextScheme.cs:line 803 at Miyagi.Rendering.RenderManager.CreateQuadsForText(Rect rect, String text, TextScheme textScheme, ColourDefinition colour, TextAlignment alignment, Boolean multiline) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Rendering\RenderManager.cs:line 334 at Miyagi.Controls.Elements.TextElement.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Elements\TextElement.cs:line 127 at Miyagi.Controls.Label.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Label.cs:line 269 at Miyagi.Controls.BaseControl.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\BaseControl.cs:line 2018 at Miyagi.Controls.Label.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Label.cs:line 267 at Miyagi.Controls.BaseTexturedControl.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\BaseTexturedControl.cs:line 351 at Miyagi.Core.Gui.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Core\Gui.cs:line 566 at Miyagi.Core.GuiManager.Update(Boolean captureInput) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Core\GuiManager.cs:line 998 at _3dViewer.MogreForm.Scene_FrameStarted(FrameEvent evt) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\myproject\3dViewer\MogreFormMiyagi.cs:line 605 at Mogre.Root.raise_FrameStarted(FrameEvent evt) at Mogre.Root.OnFrameStarted(FrameEvent evt) at Mogre.FrameListener_Director.frameStarted(FrameListener_Director* , FrameEvent* evt) at Ogre.Root.renderOneFrame(Root* ) at Mogre.Root.RenderOneFrame() at _3dViewer.MogreForm.Go() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\myproject\3dViewer\MogreForm.cs:line 380 at Test.Program.Main() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\myproject\3dViewer\Program.cs:line 20 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: 

TextScheme Line 803: return ((FontPtr)FontManager.Singleton.GetByName(this.Name)).GetMaterial().GetTechnique(0).GetPass(0).GetTextureUnitState(0).TextureName;
-this.Name = "Miyagi_bluehigh.ttf_16"

In both cases, the piece of text will have been altered (and rendered) hundreds of times before the crash occurred and the font won't have been changed.

The labels are created like:
averageFpsLabel = new Label("averageFpsLabel", new Size(farRightPosition - rightPosition, height), new Position(rightPosition, i * (height + vSpacing))) { Text = "0" };

These exceptions are fairly repeatable and other labels (created in the same way) that don't have their label.Text updated don't seem to cause the crashes.

Do you have any idea what could be causing this?

thanks in advance. Miyagi's been great generally.

smiley80

11-12-2009 15:11:59

Is this the right way to do it? Is there a single function to update all?
At the moment, there are two ways that should work properly:
Saving the guis to XML, changing the resolution, resetting the GuiManager and then loading the guis again.
Or, if you use relative values when you create the guis, changing the resolution, resetting the GuiManager and creating the guis again.

I'm looking into alternatives, because these methods are rather impracticable and slow, especially if you change the resolution a lot, e.g. resizing a embedded Mogre render window.

Do you have any idea what could be causing this?

I hope that's caused by undisposed pointers getting finalized. If that's the case, then it's fixed in r213.

boyamer

12-12-2009 08:04:29

Would be nice if you remove the PINVOKE methods and make it cross platfrom,so anyone can use it also on different OS than windows,what about shader effects on GUI? like glass,etc?

WarehouseJim

14-12-2009 15:37:53

I hope that's caused by undisposed pointers getting finalized. If that's the case, then it's fixed in r213.

I updated to r224. I think the change has improved it somewhat, but it hasn't fixed it. I still get exceptions which are caused by the same rapid updating panel.

An exception that's been raised more than once is below, but sometimes they are exceptions that the debugger doesn't catch properly.
System.AccessViolationException was unhandled Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Source="Mogre" StackTrace: at Ogre.TextureUnitState.getTextureName(TextureUnitState* ) at Mogre.TextureUnitState.get_TextureName() at Miyagi.Core.FontDefinition.get_TextureName() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Core\FontDefinition.cs:line 146 at Miyagi.Controls.Elements.TextElement.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Elements\TextElement.cs:line 129 at Miyagi.Controls.Label.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Label.cs:line 260 at Miyagi.Controls.BaseControl.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\BaseControl.cs:line 2043 at Miyagi.Controls.Label.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\Label.cs:line 258 at Miyagi.Controls.BaseTexturedControl.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Controls\BaseTexturedControl.cs:line 342 at Miyagi.Core.Gui.Update() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Core\Gui.cs:line 564 at Miyagi.Core.GuiManager.Update(Boolean captureInput) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\miyagitk2\Miyagi\Core\GuiManager.cs:line 1037 at _3dViewer.MogreForm.Scene_FrameStarted(FrameEvent evt) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\mysoln\3dViewer\MogreFormMiyagi.cs:line 619 at Mogre.Root.raise_FrameStarted(FrameEvent evt) at Mogre.Root.OnFrameStarted(FrameEvent evt) at Mogre.FrameListener_Director.frameStarted(FrameListener_Director* , FrameEvent* evt) at Ogre.Root.renderOneFrame(Root* ) at Mogre.Root.RenderOneFrame() at _3dViewer.MogreForm.Go() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\mysoln\3dViewer\MogreForm.cs:line 380 at Test.Program.Main() in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\mysoln\3dViewer\Program.cs:line 20 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: erroring line: return fp.GetMaterial().GetTechnique(0).GetPass(0).GetTextureUnitState(0).TextureName; fp points to "Miyagi_bluehigh.ttf_16"

smiley80

14-12-2009 18:53:37

I've overlooked some pointers, so please try r225

Would be nice if you remove the PINVOKE methods and make it cross platfrom
I use the pinvoke to translate keyboard scancodes/virtualkeys to unicode characters.
It's possible to replace it with a lookup table based on the keyboards from here (virtualkey to character).
But since Mogre isn't cross-platform, that's somewhat of a low priority for me.

WarehouseJim

15-12-2009 12:25:45

I've overlooked some pointers, so please try r225
I've just run it over lunch without it crashing Thanks for fixing it.

boyamer

16-12-2009 11:13:23

I want to know where can i find media files used by Miyagi? THey aren't in SVN? would be fine if you put
them there and after compiling app can be run..

Thanks

smiley80

24-12-2009 03:56:33

kubatp

24-12-2009 10:01:27

Hi Smiley,
I have tried to use the method posted earlier to display the city name. It works perfectly, however there are some problems, maybe not related to this method but to Miyagi.
When I add the city mesh to the space, I call this method as well:

 private Miyagi.Controls.Panel GetCityPanel(string cityName, int x, int y) { string id = String.Format("citylabel-{0}-{1}", x, y); Miyagi.Controls.Panel result = new Miyagi.Controls.Panel(id + "panel", "CityPanelMaterial", new Miyagi.Core.Size(130, 24), new Miyagi.Core.Position(0, 0)); result.Movable = false; result.ResizeMode = Miyagi.Core.ResizeModes.None; Miyagi.Controls.Label cityLabel = new Miyagi.Controls.Label(id + "label",new Miyagi.Core.Size(120, 20), new Miyagi.Core.Position(5, 2)); cityLabel.Text.Value = cityName; cityLabel.Text.Alignment = Miyagi.Core.TextAlignment.Center; cityLabel.Text.TextScheme = EffectTextScheme; gui.Controls.Add(result); return result; } 

This method should return the Miyagi Panel, which is later used in AttachToMovableObject method.
EffectTextScheme is getter to previously created Text Scheme. This text scheme works correctly and I display with them another texts as well.
gui is actual Miyagi gui.

I currently have test map with two cities on it. This method is called twice and two panels are created, however only one is really displayed and without the label...It's just empty panel. Do you have any ideas?
I tried to play with ZOrder as well, but unfortunately without any luck.

Thank you Pavel

smiley80

24-12-2009 11:23:10

You have to add the label to the panel.
result.Controls.Add(cityLabel);

kubatp

24-12-2009 16:55:14

Hi,
I am sorry I have posted the incorrect version of my method. Here is the correct one:
 private Miyagi.Controls.Panel GetCityPanel(string cityName, int x, int y) { string id = String.Format("citylabel-{0}-{1}", x, y); Miyagi.Controls.Panel result = new Miyagi.Controls.Panel(id + "panel", "CityPanelMaterial", new Miyagi.Core.Size(130, 24), new Miyagi.Core.Position(0, 0)); result.Movable = false; result.ResizeMode = Miyagi.Core.ResizeModes.None; Miyagi.Controls.Label cityLabel = result.CreateChildControl<Miyagi.Controls.Label>(id + "label",new Miyagi.Core.Size(120, 20), new Miyagi.Core.Position(5, 2)); cityLabel.Text.Value = cityName; cityLabel.Text.Alignment = Miyagi.Core.TextAlignment.Center; cityLabel.Text.TextScheme =EffectTextScheme; gui.Controls.Add(result); return result; } 

Unfortunately the problem remains with this version as well

kubatp

24-12-2009 17:01:00

The interesting thing is, that if I add only the label (without panel), it is displayed correctly.

Btw. Merry Christmas!

smiley80

26-12-2009 12:18:55

I tested it in the sample (of course with a different material and textscheme) and it works as it should.
But there is an issue with panels having the same zorder, so ensure they have unique ones (and that the label zorder is higher than the one of its panel).

kubatp

26-12-2009 21:25:58

The ZOrder of every panel was different and the citylabel as well, but the result is still the same. I tried to display only the cityLabel, but it doesn't appear there as well (as standalone element).
There are two problems

- why is not displayed the second panel (it is definitely called twice, with different ID, different position and it calls twice this AttachToMovableObject method as well
- why the labels are not displayed, even this textscheme works correctly for another labels

I have few questions related to ZOrder:
- I would suppose, that the ZOrder works this way - you create controls and attach to gui. For these controls, it compares ZOrder and according to this are those controls displayed. When CreateChildControl method is called, it should (I suppose) be displayed this way - all the childs are compared according to ZOrder but this ZOrder is not the same as the ZOrder of the parent controls. I.e. every parent creates its own "stack".
For example I create two elements and add them to GUI root - element A with ZOrder 1, Element B with ZOrder 2. I add child to element B (lets call him C) with ZOrder 1. From my view, it should be displayed the way, that B is over Element A and because of C is the child of B, it is over A as well.
- When two panels (or any elements) have the same zorder, what exactly is the bug? I don't know why, but I already saw occurances, when one element dissapears when another is displayed. Is this it?
- There probably is a problem with border of panel. When I don't use border property, the panel is displayed like this: [attachment=1]withoutBorder.png[/attachment]
but when I do use border, the panel is displayed like this:
[attachment=0]withBorder.png[/attachment]
ZOrders are correctly set but the panel below the window title is not displayed.

Thank you Pavel

smiley80

27-12-2009 03:37:00

The ZOrder of every panel was different and the citylabel as well, but the result is still the same. I tried to display only the cityLabel, but it doesn't appear there as well (as standalone element).
Try to add the panels right in the beginning, don't call AttachToMovableObject and make sure the text is small enough to fit into the label.

- I would suppose, that the ZOrder works this way - you create controls and attach to gui. For these controls, it compares ZOrder and according to this are those controls displayed. When CreateChildControl method is called, it should (I suppose) be displayed this way - all the childs are compared according to ZOrder but this ZOrder is not the same as the ZOrder of the parent controls. I.e. every parent creates its own "stack".
Something like that will be in the next version. My original plan was not to restrict the zorder, but that does too much harm for virtually no benefit.

- When two panels (or any elements) have the same zorder, what exactly is the bug? I don't know why, but I already saw occurances, when one element dissapears when another is displayed. Is this it?
The scissor test picks up the wrong end sprite, making one panel invisible, unless you move the other one over it.

- There probably is a problem with border of panel. When I don't use border property, the panel is displayed like this:
I can't recreate that.

kubatp

27-12-2009 19:56:07

Try to add the panels right in the beginning, don't call AttachToMovableObject and make sure the text is small enough to fit into the label.
The problem was really in the size of the label. When the label is not big enough to display the whole text, it doesn't display anything.

All the other problems were solved by setting
 Miyagi.Core.GuiManager.Singleton.DoScissorTest = false; 

The menu is displayed ok now and panels don't dissapear anymore. What is the consequence to have ScissorTest set to false? Does it have any drawbacks?

Thank you Smiley!

smiley80

28-12-2009 13:29:51

The scissor test is used to clip child controls that are outside of a panel.
It's removed in SVN, and will be replaced with a different method in the future.

WarehouseJim

30-12-2009 15:20:13

smiley80 - have you made scrollable panels? Are we likely to see them any time soon?

smiley80

03-01-2010 19:34:00

Not yet. But should be fairly easy to implement when the new cropping method is in place.

WarehouseJim

05-01-2010 21:36:57

Today I asked my manager if I could open source some of the GUI code I am building on top of Miyagi to the community. He pretty much said yes, but needs to check up the chain of command. So, hopefully, over time, I should be able to contribute some things like a table layout control, a tree control... and whatever else I need. My project's fairly comparable to a level editor and will have quite a lot of data entry and viewing (currently done in Windows Forms), so I'll be doing quite a lot of GUI work.

Although it's not certain yet, I thought I'd give a heads up in case anyone else was making similar stuff.

smiley80

06-01-2010 15:09:58

Contributions are always welcome.
But keep in mind, in order to be included into Miyagi, they have to be licensed under the MIT/X11 license.

kubatp

06-01-2010 19:59:08

Hi Smiley,
I have just a quick question. I wanted to test my project with MOGRE 1.6.5. but it throws the exception "Entry Point Not Found". I guess this is because of MOGRE was changed and Miyagi doesn't correspond to the new library. Is this correct? I just want to be sure I haven't done anything wrong.

smiley80

06-01-2010 20:48:02

No, the API hasn't changed, so it should work.
The sample works without rebuilding it, and I don't get any errors with the trunk version.
Make sure you've replaced all Mogre dlls with the latest ones.

kubatp

09-01-2010 23:04:04

Hi,
I try to change cursor when user hovers over a place. I do it this way:
 //main cursor Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("CursorMaterial", typeof(Miyagi.Core.Cursor), "Cursor", true); Miyagi.Core.GuiManager.Singleton.CreateCursor("CursorMaterial", new Miyagi.Core.Size(16, 16), new Miyagi.Core.Position(0, 0)); //test cursor string cursorName = "testCursor"; Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme(cursorName, typeof(Miyagi.Core.Cursor), cursorName , true); Miyagi.Core.GuiManager.Singleton.CreateCursor(cursorName, new Miyagi.Core.Size(56, 56), new Miyagi.Core.Position(28, 28)); 
and I call
 Miyagi.Core.GuiManager.Singleton.Cursor.ActiveCursor = cursorName; 
when user hovers this place.

Unfortunately it doesn't change anything, even after this ActiveCursor setter call, it tells me, that ActiveCursor is till "Main".
Any ideas?

I know I can change MaterialScheme, however cursors have different size and position, so I would have to change them as well when I change MaterialScheme only and not the cursor...

smiley80

10-01-2010 00:36:05

'ActiveCursor' is somewhat misnamed, it should be 'ActiveMode'.
Where 'Mode' is the combination of a texture and a hotspot, and a cursor is a collection of these modes.

With 'GuiManager.Singleton.CreateCursor' you'll dispose the current cursor and replace it with the new one (use this if you have to use different texture sizes).

But I'd recommend you'll use the same size for all cursor textures, and do the following:

For the texture, the easiest is to have a file called something like 'Cursor.MyCustomMode.png', which gets picked up on MaterialScheme creation.
Then you have to add the hotspot (i.e. the center point of the cursor):
Cursor cursor = GuiManager.Singleton.CreateCursor("CursorMaterial", new Miyagi.Core.Size(16, 16), new Miyagi.Core.Position(0, 0)); cursor.Hotspots.Add("MyCustomMode", new Position(8,8));

And then call:
Miyagi.Core.GuiManager.Singleton.Cursor.ActiveCursor = "MyCustomMode";
Note: the active cursor mode will be set by Miyagi back to the built-in types under certain circumstances, so if you want to be sure that the cursor stays at your mode, you'll have to call the above code constantly.

kubatp

10-01-2010 12:33:15

Hi Smiley,
thank you, this works perfectly. Can I just ask you what are these circumstances you talk about?
Thank yoU Pavel

smiley80

10-01-2010 15:07:12

When a panel is resizable and the mouse is hovering over it, the cursor is either set to the corresponding resize mode or to the main cursor.
When the cursor leaves a panel while being in one of the resize modes, it's also set back to the main cursor.

Tweetak

11-01-2010 18:44:27

Hello,
I have little question about fonts. I want use font with chars like "ěšč" and others. I use czech font, but Miyagi crash.

Error:
 V externí součásti došlo k výjimce. v Ogre.Font.getGlyphInfo(Font* , UInt32 ) v Mogre.Font.GetGlyphInfo(UInt32 id) v Miyagi.Rendering.RenderManager.CreateQuadsForText(Rect rect, String text, TextScheme textScheme, ColourDefinition colour, TextAlignment alignment, Boolean multiline) v Miyagi.Controls.Elements.TextElement.Update() v Miyagi.Controls.Label.Update() v Miyagi.Controls.BaseControl.Update() v Miyagi.Controls.Label.Update() v Miyagi.Controls.BaseTexturedControl.Update() v Miyagi.Controls.Panel.Update() v Miyagi.Core.Gui.Update() v Miyagi.Core.GuiManager.Update(Boolean captureInput) 

Thank you for your opinion and idea.

smiley80

11-01-2010 19:48:07

Miyagi creates fonts with the default Ogre code point range, which doesn't include all UTF-8 characters.

Two ways to fix it:
Add the following line to TextScheme.cs after line 245:
font.SetParameter("code_points", "32-255");
and rebuilt it.

Or, use TextScheme.FromFont with a Mogre font whose .fontdef script defines this code point range.
http://www.ogre3d.org/docs/manual/manual_44.html

kubatp

12-01-2010 16:14:33

If you use image font and this glyph is not defined in the fontdef file, Miyagi will crash.

Tweetak

12-01-2010 18:24:26

Miyagi creates fonts with the default Ogre code point range, which doesn't include all UTF-8 characters.

Two ways to fix it:
Add the following line to TextScheme.cs after line 245:
font.SetParameter("code_points", "32-255");
and rebuilt it.

Or, use TextScheme.FromFont with a Mogre font whose .fontdef script defines this code point range.
http://www.ogre3d.org/docs/manual/manual_44.html

First way doesn't work. Second way I didn't try yet, but my priority is use *.ttf file.
If you have any idea, please write.
But anyway, thanks a lot.

smiley80

12-01-2010 18:52:18

@kubatp
The crash should be fixed in SVN.
You should be able to workaround that by defining dummy glyphs.

@Tweetak
Argh, those fancy characters of yours aren't in UTF-8.
The highest number of the three you mentioned is š (353), so it should work if you change 255 to 353.
But check the other characters first, maybe there's a higher one.

Tweetak

12-01-2010 19:11:44

@Tweetak
Argh, those fancy characters of yours aren't in UTF-8.
The highest number of the three you mentioned is š (353), so it should work if you change 255 to 353.
But check the other characters first, maybe there's a higher one.

Now it works. Unicode has 4095 chars, then i change 255 to 4095 and now..... it is perfect.

Thank you very much.

Solver

12-01-2010 19:30:08

I have a question sort of related to Miyagi. I'm starting to move an application that uses another graphics engine to Mogre + Miyagi. Miyagi, from what I've seen so far, seems perfect for my GUI requirements. But I also need handling of 2D graphics - I need to be drawing part of a texture as the background, and placing a bunch of sprites on the screen. No need for 3D.

Any recommendations on what combination to use? So far I've seen that I can use Billboards or the SpriteManager. I like the fact that SpriteManager is also written by Smiley, so perhaps it's the best 2D graphics handler to use with Miyagi?

smiley80

12-01-2010 20:00:26

@Tweetak
Generally, you should keep the number as low as possible, otherwise the font texture becomes rather large.

@Solver
You can use Miyagi to draw static textures. Everything beyond that would require a varying amount of fiddling (although I think about adding more general 2d APIs in future versions).
The SpriteManager2d is relatively slow if you have a lot of sprites, since it adds and removes them constantly.
Another alternative is using 2D ManualObjects.

Solver

12-01-2010 21:00:09

Smiley:

Thanks for the response. I've seen Miyagi draw textures as per the example, where you create a material scheme for it and just create an inactive GUI button with the texture as its material. But is it possible to use Miyagi to draw part of a larger texture? I have a larger texture (approx. 1600 x 1000) and I need to be drawing only a part of it (approx. 1024 x 600) at any time. That's why I was looking into SpriteManager, as I didn't notice a way for Miyagi to do this.

smiley80

12-01-2010 21:51:44

It's possible, but it's not pretty:
 SpriteRenderer rend = GuiManager.Singleton.RenderManager.CreateRenderer(3); Sprite sprite = new Sprite(null); sprite.SetTexture("Logo.png"); // Rect -> position and size, FloatRect -> UV-coordinates Quad q = GuiManager.Singleton.RenderManager.CreateQuad(ColourValue.White, ColourValue.White, new Rect(0, 0, 100, 100), new FloatRect(0,0,0.5f,0.5f)); sprite.SetQuads(q); sprite.SetProperties(true, 1, 0, TextureFiltering.Linear); rend.AddSprite(sprite);
This would render the upper-left quarter of 'Logo.png' at position 0, 0 with a width and height of 100.

Solver

12-01-2010 21:55:01

Thanks, I'll try that. If I understand correctly, it basically creates a quad that's too small for the entire texture to fit, and because of that when it's textured only a part of the texture appears?

smiley80

12-01-2010 22:54:19

Size doesn't matter.

The UV coordinates (the FloatRect) map the texture to the verticies.
The ones of the example mean, that it takes everything from the top-left corner (0, 0) to the center (0.5, 0.5) of the original texture as the texture of the sprite.
The resulting texture is resized to fit the size of the sprite.

kubatp

12-01-2010 23:55:31

Hi Smiley,
I would like to suggest one improvement. Like for the buttons and other elements there is special texture naming convention (like mouseover and mousepressed), it could be nice to have the similar thing when enabled is set to false (like buttonname.disabled), which will be used when button is disabled.
What do you think?

smiley80

13-01-2010 00:39:21

That's already in the SVN version.

kubatp

13-01-2010 13:24:11

Hi,
many thanks. I have used 4c, so I didn't realized it.

kubatp

14-01-2010 14:59:25

I am trying to update my code to be compatible with the Miyagi latest SVN version and I have noticed one thing. PictureBox can only display an image taken from file. It would be nice to have the ability to display Bitmap in memory as well. It's not a big change but can open new possibilities to this control.

smiley80

15-01-2010 00:19:38

The Bitmap is now public. Though the next revision will change it to an System.Drawing.Image.

Solver

16-01-2010 15:33:29

I've been working with Mogre + Miyagi here for the past week, a pleasure so far, but I'm developing questions as I go.

1. Are there plans to include a Tooltip property for controls in a future version? I mean something that would display a tool tip when the mouse is hovered over a control.

2. I know I must be missing something obvious here, but how do I get the size of a texture loaded in a materialscheme? Or am I too used to working with 2D here? What I mean is, say I do

 GuiManager.Singleton.CreateMaterialScheme("MyMaterial", "cooltexture", typeof(Panel), true); 

Then I can easily create a panel with that uses the cooltexture of course, but how can I get the width/height of that texture at run-time? I want to do it, mainly, for placing GUI elements in correct positions determined at run-time.

smiley80

16-01-2010 18:03:28

1.
Yes.

2.
MaterialScheme ms = GuiManager.Singleton.MaterialSchemes["MyMaterial"]; Mogre.TexturePtr tPtr = (Mogre.TexturePtr)Mogre.TextureManager.Singleton.GetByName(ms.Textures["MyMaterial"]);
The texture pointer has a width and a height property.

But it's not really necessary for a control to have the same size as its texture, since the displayed texture is scaled to fit the size of the control.

Solver

16-01-2010 19:19:11

Thanks. I know textures are scaled to control size, I just want to use this for spacing multiple controls. I'm placing several panels and I use the texture width to determine how far from one another to place them, etc.

I'm also thinking of modifying textures at runtime, and here I'll even be satisfied by slowly-executing methods. Looks like getting a TexturePtr this way would then also allow me to modify the image in memory - great

APXEOLOG

31-01-2010 08:31:13

HI. could you give me simple example of using lua (show messagebox on button click).

smiley80

31-01-2010 16:26:54

Lua:
--assemblies luanet.load_assembly("System") luanet.load_assembly("Miyagi") luanet.load_assembly("Miyagi.Controls") luanet.load_assembly("Mogre") --imports DialogBox = luanet.import_type("Miyagi.Controls.DialogBox") DialogBoxButtons = luanet.import_type("Miyagi.Core.DialogBoxButtons") DialogResult = luanet.import_type("Miyagi.Core.DialogResult") Root = luanet.import_type("Mogre.Root") function Event_Quit_Click(sender, e) if DialogBox.Show("Do you really want to quit?", "Miyagi Sample", DialogBoxButtons.YesNo) == DialogResult.Yes then Root.Singleton.RenderSystem:GetRenderTarget("OGRE Render Window"):Destroy() end end

Binding to a button's mouse click event:
 // load the Lua scripting plugin GuiManager.Singleton.PluginManager.LoadPlugin("Plugins\\Miyagi.Scripting.Lua"); // create the EventScriptingScheme (called ScriptingScheme in SVN) EventScriptingScheme esd = GuiManager.Singleton.CreateEventScriptingScheme("Events"); // set the file path to the above Lua file esd.FilePath = @"..\Media\Scripts\Events.lua"; // create the EventMethodDefinition (called ScriptMap in SVN) for a control named 'QuitButton' EventScriptingScheme.EventMethodDefinition emd = new EventScriptingScheme.EventMethodDefinition(GuiManager.Singleton.GetControl("QuitButton")); // the button's 'MouseClick' event is to be bound to the 'Event_Quit_Click' method emd.SetEventMethod("MouseClick", "Event_Quit_Click"); esd.EventMethodDefinitions.Add(emd); // bind all EventScriptingSchemes GuiManager.Singleton.BindAllEventMethods();

APXEOLOG

31-01-2010 16:59:19

Thank you! And could you explain me some fields in gui xml file:
<Border> // When it would work? if define special border image?
<Size>
<Bottom>0</Bottom>
<Left>0</Left>
<Right>0</Right>
<Top>0</Top>
</Size>
<UV> // What is it?
<Left>0.25</Left>
<Top>0.25</Top>
<Right>0.75</Right>
<Bottom>0.75</Bottom>
</UV>
</Border>
<Rectangle> // Cant understand what this parameters do
<Left>0.09</Left>
<Top>0.026041666045785</Top>
<Right>0.22265625</Right>
<Bottom>0.0677083358168602</Bottom>
</Rectangle>

<Texture> // I use material, need i this property?
<FileName>exit.png</FileName>
</Texture>

smiley80

01-02-2010 03:23:45

<Border> // When it would work? if define special border image?
The material has to have the '.Border' sub-material and one of the sizes has to be larger than zero.

<UV> // What is it?
UV describes the uv-coordinates of the center rectangle in the texture that's not used for the actual border.
See Panel.Border.png in the sample, which uses the default value (0.25, 0.25, 0.75, 0.75).

<Rectangle> // Cant understand what this parameters do
It's the position and size relative to the screen dimensions.

<Texture> // I use material, need i this property?
Nope.

kubatp

09-02-2010 15:50:50

Hi,
I have downloaded the latest SVN version and I have noticed the behavior change for buttons. Previously I had button with MouseEnter and MousePressed images. There weren't any MouseReleased images and no exceptions were thrown. Now it tries to find MouseReleased image for this button and when it's not found it throws the exception.
Is there a reason for this change?
Thank you

smiley80

09-02-2010 22:28:50

How did you create the skin?

It should work when you use typeof(Button) or any type of a class that inherits from Button in ResourceManager.CreateSkin or Skin.Create.

kubatp

10-02-2010 09:05:50

the skin was created this way
 MiyagiSystem.ResourceManager.CreateSkin("buttonActionUnload", typeof(Miyagi.UI.Controls.Button), "buttonActionUnload", false); 
and there are four files

it fails when I hover the button and move cursor away of the button (it tries to find buttonActionUnload.MouseReleased) in Miyagi code here:

Texturecollection:
 public string this[string skin] { get { return this.items[skin];//exception thrown here } } 

smiley80

10-02-2010 13:22:36

I can't reproduce this. Could you please check what's happening on skin creation (i.e. which files are found in Skin.Create and what it does in Skin.FillUpEvents).

fails when I hover the button and move cursor away of the button (it tries to find buttonActionUnload.MouseReleased) in Miyagi code here:
That's strange, it should look for buttonActionUnload.MouseLeave.

However, the exception should not be thrown anymore in the latest commit.

kubatp

10-02-2010 16:56:31

Hi,
I have get the latest and it doesn't throw the exception anymore. However when I click on the button, it shows this "MousePressed" image, but it keeps this mousepressed image, even the mouse button is not pressed anymore (has been released). To let the button have the initial image again I have to click somewhere else one more time.
Thank you

10-02-2010 22:25:15

Hi, Miyagi isn't processing my mouse clicks. I originally had this code, but at the point it wasn't processing any of my input.

 Keyboard.Capture(); Mouse.Capture(); GuiManager.Singleton.Update(true); 
I checked later in the code and the Mouse is capturing just fine, but the Miyagi cursor wasn't moving. So Made the code look like this:

 Keyboard.Capture(); Mouse.Capture(); GuiManager.Singleton.InputManager.InjectMouseMoved(Mouse.MouseState.X.abs, Mouse.MouseState.Y.abs, false); GuiManager.Singleton.Update(true); 

So now the mouse moves, the MouseExit and MouseEnter events fire just fine, but click events are never processed. Any ideas?

Edit: Solved, when I created the Mouse with inpuManager.CreateInputObject I had set buffer mode to false

smiley80

10-02-2010 23:28:08

@kubatp
As I said, please try to debug into CreateSkin.
In Skin.cs, line 161:
retValue.Textures[skinname] = texturefile;
I need the values of 'skinname' and 'texturefile' for each iteration of the loop.

Pass 'false' to GuiManager.Singleton.Update, otherwise you tell the input manager to capture the input devices, i.e. you capture them twice.

kubatp

11-02-2010 14:37:13

Hi Smiley,
I am really sorry, but it was totally my fault. I passed typeof(Control) instead of typeof(Button) to the CreateSkin function. I am sorry again!

I have one more question. In initial 4c version, Panel has collection of Meshes, which was removed. Will this be supported in the near future or not?
I would like to append Mesh to Panel, which will rotate on this Panel.
Thank you

smiley80

11-02-2010 22:34:09

Yeah, to be honest I was anything but reluctant to remove them.

I'm thinking about replacing it with a control that displays a RenderTexture, but I haven't done any work in that direction yet.

kubatp

12-02-2010 11:50:20

Hi Smiley,
thank you. The rotated mesh is actually not so important for me, I can use this AttachToMovableObject function you posted before.
The only thing I am concerned about is the performance here. There is no problem with one Mesh which location is recalculated with every move, but I want to use this functionality to display "state" of every unit displayed. There can be for example 50 units with this panel. Do you think, that performance should be kept in mind here? It seems like the screen "freezes" for milliseconds when I have all these 50 panels displayed on screen.

The AttachToMovableObject is here

thank you

smiley80

12-02-2010 14:08:00

50 panels plus text are currently 100 render batches, because it has to switch back and forth between the font and the panel texture.
This will be adressed in the future with the support of texture atlases, which will reduce that to a single render batch (best case scenario).

kubatp

12-02-2010 15:16:50

Thank you Smiley. I will leave this for now and change this behavior when texture atlases are supported.

Hopefully last question today...

I have a panel and another panel as its child. I set the inner panel location -20,20 and I pressumed, that this will expand over the edges of the parent panel (it did before when I specified DoScissorTest=false). I know there is no such a thing like DoScissorTest anymore, so the question is, if this behavior - overlapping of inner controls - can still be achieved and how
Thank you

kubatp

12-02-2010 17:05:20

Btw. there is an error in ControlBase line 2472

 protected virtual void OnMouseHover() { if (this.MouseHover != null) { ->> this.MouseHover(this, (MouseEventArgs)MouseEventArgs.Empty); } } 

MouseEventArgs.Empty is actually only EventArgs so, it cannot be casted to MouseEventArgs and it throws the exception.

koirat

12-02-2010 22:46:04

I have got application that can be in full-screen or windowed mode.
Problem is that after I change my window size (resize) ( in windowed mode) Miyagi is using old viewport width/height.
As a result when I move my cursor left to right or top to bottom cursor in Miyagi got different speed than my normal window cursor. (accelerating deaccelerating)

Any solutions. (Different than setting screen resolution in Miyagi)
I think it should be automatic, resolved by Miyagi.

smiley80

13-02-2010 00:47:22

if this behavior - overlapping of inner controls - can still be achieved and how
Currently, you have to derive your own class from Panel and in the constructor add these lines:
this.TextureElement.DoNotCrop = true; this.TextElement.DoNotCrop = true; this.BorderElement.DoNotCrop = true;

Btw. there is an error in ControlBase line 2472
Thanks, fixed.

Any solutions. (Different than setting screen resolution in Miyagi)
At the moment, there are two ways that should work properly:
Saving the guis to XML, changing the resolution, resetting the GuiManager and then loading the guis again.
Or, if you use relative values when you create the guis, changing the resolution, resetting the GuiManager and creating the guis again.

koirat

14-02-2010 00:05:12

I have compiled Miyagi 1.0 beta4c with Mogre 1.6.5 dll from MogreSDK.

I have copied Media directory from Miyagi compiled miyagi.dll with MOIS.dll.
I did not copied plugins directory.

 ResourceGroupManager.Singleton.AddResourceLocation(@".\Media", "FileSystem"); ResourceGroupManager.Singleton.AddResourceLocation(@".\Media\Gui\", "FileSystem"); ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); guiMgr.Initialize(true); guiMgr.DoScissorTest = true; guiMgr.XmlSerializer.ImportFromFile("guis.mgx"); guiMgr.Update(false); 

Also when I was making gui with my own *.mgx file I had problems with font (not visible, like in attachment). and my button that should be inside my panel was outside it, but still was following it when panel was moved.
Overall it was buggy.

Any body got more luck with it ?
Also is Miyagi going to be a part of MogreSDK ?

And here is the result.

smiley80

16-02-2010 21:07:31

The transparent panels are caused by a bug in the scissor test, so:
guiMgr.DoScissorTest = false;

nico008

18-02-2010 13:39:55

Hi guys
Nice work done with Miyagi

When is the next release?
I really like Miyagi!

GuiMgr.DoScissorTest = false;
-> it solved a lot of bugs for me.

Anyway, I just noticed the "Ok" is not displayed on the DialogBox's button. (Thought DialogBox.TextOk == "Ok" :-s)
Take the MiyagiSample, add "DialogBox.Show("Done!", "Test", DialogBoxButtons.Ok);" in the "Event_Button_RunProgress" method for example, run the sample, click on that button (Activate!).
Do you also have this little bug?

Also :
I want a TextBox component to be hidden just after it has been created
If I set : Visible = false, then it is still visible
If I call box.Hide(false); -> it is hidden but I then have to call twice box.Show(false);
Do you know where it comes from?

Another little bug :
if I call (by quickly pressing a key for example)
panel3.Hide(true, 300);
and then
panel3.Show(true, 300);
and that I start this again and again the panel is not anymore fully visible

smiley80

19-02-2010 16:24:44

When is the next release?

When it's done.

Anyway, I just noticed the "Ok" is not displayed on the DialogBox's button. (Thought DialogBox.TextOk == "Ok" :-s)

That's because the size of the default font is too large.

I want a TextBox component to be hidden just after it has been created
[...]
and that I start this again and again the panel is not anymore fully visible

Both should be fixed in SVN.

nico008

20-02-2010 15:33:53

I just have tryed the SVN's version of Miyagi, nice work (even if I had some problems as I didn't have your Media folder, but now it's ok)

"I want a TextBox component to be hidden just after it has been created"
-> solved
about the panel fading away, it is a bit better, but the problem is still there

Unluckily, with the SVN version, I'm not able anymore to put a "CloseButton" over the top border (I think that the button is hidden by the border)
I have to use a negative Top position right? As 0 is just below the top border...
See the picture in attachments : this is what I want

Any clue?

Also, now with ListBox, when I call Items.Clear(); -> it throws an Exception from line 106 of ListBoxItem.
Is there a better way to remove all the items of a ListBox component?

Thanks in advance, and congratulation for that great work!

kubatp

20-02-2010 16:22:06

Hi Nico008,

nico008

20-02-2010 16:49:28

Hi kubatp

I guess you are talking about my CloseButton problem, sorry if I'm wrong.

Currently, you have to derive your own class from Panel and in the constructor add these lines:
this.TextureElement.DoNotCrop = true;
this.TextElement.DoNotCrop = true;
this.BorderElement.DoNotCrop = true;

-> I tried this but it didn't change anything

smiley80

20-02-2010 19:12:51

about the panel fading away, it is a bit better, but the problem is still there

Fixed in r290.

Also, now with ListBox, when I call Items.Clear(); -> it throws an Exception from line 106 of ListBoxItem.

Fixed in r289.

-> I tried this but it didn't change anything

In your case, you have to derive from Button, and use that as the CloseButton.

nico008

20-02-2010 20:14:18

Pretty impressive, you just solved all the bug that I told you plus some other that I didn't tell
Good job and thanks again!!

luismesas

21-02-2010 01:32:50

Hi smiley80,

I have been playing a bit with textboxes. If you press a key or key combination that is not handled by TextBox.HandleKey method and does not have a Glyph I get a KeyNotFoundException on Glyphs table. Is there any way to avoid this exception when pressing escape key (for instance) when focus is on a textbox?

There is another exception if you click on an active textbox with no text inside it. This line on GetClickedQuad method raises an exception too

int count = spr.QuadCount; //line 695 on TextBox.cs

I'm using your current SVN revision.

smiley80

21-02-2010 10:02:01

Should be fixed in r291.

luismesas

21-02-2010 14:14:21

It now goes ok!

luismesas

27-02-2010 15:03:25

Hi smiley,

I'm using your latest code (r292) and it seems that default behaviour on textboxes has changed. Now textbox max characters are limited by size of textbox. Previously there was an internall scroll that allowed you to write as many characters as you want. I don't see if there is a property that reactivates this behaviour or you wanted this limitation.

I have another question about font textures. I have defined this two fonts:

 TrueTypeFont white = resMgr.CreateTrueTypeFont("BlueHighwayWhite", "bluehigh.ttf", 10, 96, Color.White); TrueTypeFont black = resMgr.CreateTrueTypeFont("BlueHighwayBlack", "bluehigh.ttf", 10, 96, Color.Black); 

If I select first texture for a textbox, I can see characters written and .Text property is the word written.
If I select second one on textboxes there is no characters written and .Text property is allways string.empty.

If I swap font definitions:
 TrueTypeFont black = resMgr.CreateTrueTypeFont("BlueHighwayBlack", "bluehigh.ttf", 10, 96, Color.Black); TrueTypeFont white = resMgr.CreateTrueTypeFont("BlueHighwayWhite", "bluehigh.ttf", 10, 96, Color.White); 
Then I can only use black font. White one cannot be used anymore even on labels.

You have lost Caret somewhere in revision 291

smiley80

27-02-2010 17:51:42

Now textbox max characters are limited by size of textbox. Previously there was an internall scroll that allowed you to write as many characters as you want.

Scrolling the textbox isn't implemented yet, but it's on my list.

I have another question about font textures. I have defined this two fonts:

Thanks for reporting. This happens when two TTFs use the same texture (i.e. only differ in colour). Fixed in r293.

You have lost Caret somewhere in revision 291

Carets work fine for me. Make sure you have the size set.

Btw.:
Everyone who has a Google account can also report bugs via the issue tracker:

luismesas

27-02-2010 18:08:28

Carets work fine for me. Make sure you have the size set.
Sorry it was my fault.

Btw.:
Everyone who has a Google account can also report bugs via the issue tracker:

Great!

fac

02-03-2010 16:27:16

Hi, I am interested in using the graphical editor. What is its status? I've downloaded the b4 tag in the repo, but it seems to lack one dll (Scintilla). Is is still being developed?

kubatp

02-03-2010 17:43:57

Hi Smiley,
I have two questions:
1) I would like to use label control with fixed width, which would wrap to another lines. Unfortunately the wrapping doesn't work properly. It's inside a inherited class from panel (this) Here is the code:
 Miyagi.UI.Controls.Label result = this.CreateChildControl<Miyagi.UI.Controls.Label>(Name + name, new Size(100, this.Size.Height - 30), new Point(0, 0)); result.AutoSize = true; result.TextStyle.Multiline = true; result.TextStyle.WordWrap = true; result.AutoSizeMode = Miyagi.AutoSizeMode.GrowAndShrink; result.Margin = new Thickness(5, 5, 5, 5); result.TextStyle.Alignment = Miyagi.Alignment.TopLeft; result.Text = text; 
Am I missing something?
2) I would like to hide one GUI and right after display another one. I tried both Gui.Hide and GUI.Visible = false, but unfortunately even I call MiagySystem.Update() (or GuiManager.Update()) before the second gui is displayed, both GUIs are visible. The first GUI (which should be hidden) is just a usual GUI, the second one is ModalGUI.
The code is following:
 CurrentGUI.Visible = false; MiyagiSystem.Update(); ModalGUI.Show(true); 

thank you

smiley80

02-03-2010 20:01:11

Hi, I am interested in using the graphical editor. What is its status? I've downloaded the b4 tag in the repo, but it seems to lack one dll (Scintilla). Is is still being developed?
I've scrapped that editor (wasn't finished anyway), I'll start working on the new one after the next release.

1) I would like to use label control with fixed width, which would wrap to another lines. Unfortunately the wrapping doesn't work properly. It's inside a inherited class from panel

Autosized labels try to have at least the size of their text. So you won't get any automatic wrapping.

2) I would like to hide one GUI and right after display another one. I tried both Gui.Hide and GUI.Visible = false, but unfortunately even I call MiagySystem.Update() (or GuiManager.Update())

Setting Visible to false and calling GUIManager.Update works for me.

nico008

02-03-2010 23:12:42

Hi.

I'm not able anymore to enter special chars in textbox (like space, dot, etc).
Do you also have that bug? Note that I'm using bluehigh.ttf font.

Where can I find all binary files needed for latest release's samples?
I especially need locales files (fr)

I would like to try Miyagi in linux. Has someone already made it work?
I was able to compile it, but it doesn't run.
What render system name should I write in the source file of the Axiom sample? "OpenGL"?
Are there any other changes to make?

smiley80

03-03-2010 01:25:15

I'm not able anymore to enter special chars in textbox (like space, dot, etc).
Do you also have that bug? Note that I'm using bluehigh.ttf font.

Fixed in r295.

I especially need locales files (fr)

You don't need them, just comment out the 3 lines with 'LocaleManager.AddLocaleFolder' in the sample.

I would like to try Miyagi in linux. Has someone already made it work?

Well, I'm able to run it with the Windows version of Mono.
You have to use the OpenGL render system and remove all dlls that have the slightest trace of C++/CLI (Mogre, MOIS, Lua).
Unfortunately, the window doesn't response anymore after the OpenGL renders the first frame (on Mono and .NET).

The textbox has two P/Invokes into WinAPI, in order to translate scancodes/virtualkeys to actual characters
(can be replaced with a lookup table or a separate platform-dependent native libary)
The SharpInputSystem version in the Libs folder uses DirectX.
(the SDL version should be crossplatform http://sharpinputsystem.codeplex.com/)
Miyagi.VideoControl uses DirectShow.

nico008

03-03-2010 15:34:57

Thanks for the fix

About locales files, what are them for?
If you need help for french translating, let me know.

Now I can see a black window when I run the app.
But even though I commented everything related to MOIS, it asks for that dll when I run the application
Can I find it somewhere?

No one here has ever tryed Axiom in linux?

smiley80

04-03-2010 16:48:26

Okay, I've managed to get the Axiom sample working under Linux (Ubuntu 9.10):
(core binaries + media, no plugins, no source code)

If it complains about missing png codecs, you'll have to install libdevil1c2.

nico008

04-03-2010 21:26:15

Good job one more time

Indeed it was complaining about missing png codecs. libdevil1c2 solved it.
It is now rendering in Linux!!!!
Just a strange thing : with Axiom in Linux, manually loaded skins applyed on button are in the wrong side.
See my screenshot

Those questions are not related to Miyagi but I ask them anyway if you don't mind :
Do you know how to set the window size when using Axiom?
Do you know how to use Axiom.Input to handle keyboard and mouse? I haven't found any sample for it on the web

smiley80

05-03-2010 01:15:50

Just a strange thing : with Axiom in Linux, manually loaded skins applyed on button are in the wrong side.

I can't recreate that. Please post the skin creation code and one of the textures.
Does that also happen on Windows?

Do you know how to set the window size when using Axiom?

The initial size:
root.RenderSystem.ConfigOptions["Video Mode"] = new Axiom.Configuration.ConfigOption("Video Mode", "640x480", false);
Otherwise:
RenderWindow.Resize

Do you know how to use Axiom.Input to handle keyboard and mouse? I haven't found any sample for it on the web

Never used it.
I'm looking into an input plugin which uses WndProc messages. Might be cross-platform if Mono translates X11 message also for native windows.

Btw.:
There is apparently a bug in Mono, which causes an exception when a TrueTypeFont gets finalized. So you should prefer ImageFonts.

nico008

05-03-2010 02:02:46

Thanks for Video Mode line

Axiom.Input looks nice even thought I don't know how to get it working ^^

I use the following code :

Skin msIcon = Skin.Create("Icon");
msIcon.Textures["Icon"] = "Icon.bmp";
Button item = new Button("item")
{
Text = "",
Size = new Size(27, 27),
Active = false,
TextureStyle =
{
Skin = guiRoot.ResourceManager.Skins["Icon"]
}
};

See Icon.bmp in attachements

smiley80

05-03-2010 14:26:53

Hmm, DevIL doesn't seem to like BMPs on Linux. Convert them to PNGs and they should be displayed correctly.

nico008

05-03-2010 15:17:25

Indeed there is no probleme with PNG
Now I just need the keyboard + mouse to get working for Axiom on linux and it will be perfect :p
I will have to ask in Axiom section of the forum I guess

kubatp

14-03-2010 19:58:56

Hi Smiley,
I have possibly found a bug. When I create PictureBox and assign an Image (by calling PictureBox.Image = ), everything works ok. When I try to assign another image (again by calling .Image=), the transparent pixels from the new image are not correctly displayed. When I dispose the existing PictureBox and create a new one with the same attributes like z-order, parent, etc...) it's ok
Thank you

smiley80

14-03-2010 21:15:59

Fixed in r316.

nico008

19-03-2010 09:34:43

Nice changes
Letter spacing is good now!

nico008

21-03-2010 23:17:53

Hi.
Today I tryed Myrddin Landscape Plugin.
I like it very well for terrain generation! (see http://www.ogre3d.org/forums/viewtopic.php?f=11&t=43750 for screen shots)

The problem : When I add Miyagi, the GUI is resized and I can't see the whole GUI screen (see attached screenshot)
Note : using a higher window size won't solve the problem

Do you know what I can do to solve that problem?

To run it, you also need :
- http://sourceforge.net/projects/myrddin ... r/download (extract Datas folder and put it in Game\bin\x86\Debug)
- MIYAGI media folder (put it in Game\bin\x86)
- MIYAGI required dlls (put them in Game\bin\x86\Debug)

If you miss a file, let me know!
If you need Myrddin's original source files or documentation : http://sourceforge.net/projects/myrddin ... r/download

Another strange thing : if I uncomment the line "loadingBar.Start(window, 0, 1, 0.0F);" from GameMain.cs, the MIYAGI GUI is not 2D anymore but drawn somewhere in the world in 3D, pretty strange (but I don't care a lot about that loadingBar actually)

Thanks in advance if you can solve my GUI Resized problem

nico008

22-03-2010 08:04:32

After spending some hours commenting a lot of lines, I finally found something!!!
If I remove <WaterPlane></WaterPlane> section from Datas\landsample.xml, it works perfectly (except there is no more water in the world )

Maybe the bug comes from Myrddin's pluggin but if you have time, could you check if there is nothing to do in Miyagi to fix the bug?

See ya!

smiley80

22-03-2010 08:46:21

MLP seems to require shader model 3.0, which my ancient graphics card doesn't support.
I'll look into the source, maybe I find something...

In the meantime, try moving Miyagi to a different camera; that should at least fix the loadingBar thingy. (requires a reference to "Miyagi.Backend.Mogre.dll")
this.guiCam = this.sceneMgr.CreateCamera("GuiCam"); this.guiViewport = this.window.AddViewport(this.guiCam, 10); this.guiViewport.SetClearEveryFrame(false); this.guiViewport.ShadowsEnabled = false; this.guiViewport.OverlaysEnabled = false; this.guiViewport.SetVisibilityMask(0); ((Miyagi.Rendering.RenderManager)this.miyagiSystem.Backend.RenderManager).Camera = this.guiCam;

nico008

22-03-2010 10:49:03

Thanks for the trick.

Edit:
(note that the Plugin_LandscapeSceneManager.dll is written in C++)
I have tryed what you said.
((Miyagi.Rendering.RenderManager)this.miyagiSystem.Backend.RenderManager).Camera = this.guiCam;
-> Miyagi.Rendering.RenderManager doesn't exists with the SVN MIYAGI version. Only RenderManagerBase exists, and there is no Camera property in it.
Anyway, even without that line, it solved my resized GUI problem. Now I have loading bar+water+MIYAGI working
The bad news is that now the sky is turning when I look to another direction.
So I see sun near west, then I look near south or east or whatever direction, I still see the sun, it looks not realistic anymore :p
Any Idea?

It's getting nice anyway!!

smiley80

22-03-2010 23:06:22

this.guiViewport.SkiesEnabled = false;
should hopefully fix the sky...

Miyagi.Rendering.RenderManager doesn't exists with the SVN MIYAGI version. Only RenderManagerBase exists, and there is no Camera property in it.
Miyagi.Rendering.RenderManager lives in Miyagi.Backend.Mogre.dll.
By default, it will pick up the first camera of the first SceneManager. You can check whether that's the right one, by looking at the Camera property of MiyagiSystem.Backend.RenderManager while debugging.

nico008

22-03-2010 23:14:04

Dude, you rox!

this.guiViewport.SkiesEnabled = false; -> solved my problem

Now everything is nice!
I just have to learn how to deal with skeletons/skins to add some life in my game ^^

See you later

kubatp

23-03-2010 16:12:38

Hi,
just a quick one. I have created ListBox and added few items. Everything works fine, but when I try to add offset for text (in every list box item) by using ListBox.TextStyle.Offset, it doesn't change anything. Is there a way to change "padding" from the top left corner of the list box item?
Thank you

nico008

23-03-2010 20:37:39

(see previous page for kubatp post's if not yet read)

Another question related to ListBox, is there a way to use the WordWrap feature like in TextBox?
(I use the ListBox as a console output, and I want big lines to be correctly splitted in several lines)

I just tryed myGUI.Hide(false), then when I do myGUI.Show(false), every children are now visible, but I don't want these children to appear. What can I do?

Thanks again

smiley80

24-03-2010 00:11:19

Is there a way to change "padding" from the top left corner of the list box item?
You can change that for all items with ListBox.ListBoxStyle.ItemOffset.

Another question related to ListBox, is there a way to use the WordWrap feature like in TextBox?
WordWrap is enabled by default for all text elements. However, the wrapped line won't be added as a new item, it will be wrapped inside the individual listbox item.

I just tryed myGUI.Hide(false), then when I do myGUI.Show(false), every children are now visible, but I don't want these children to appear. What can I do?

Use myGUI.Visible instead. Hide/Show will be removed soon anyway.

kubatp

24-03-2010 08:23:23

kubatp wrote:
Is there a way to change "padding" from the top left corner of the list box item?

You can change that for all items with ListBox.ListBoxStyle.ItemOffset.

Actually this is something like "margin" of the item. This will move the whole item. I need to move just text inside the item. I am experiencing more issues with listbox now:
1. I have found out, that I can change the text padding by setting ListBoxItem.Style.TextStyle.Offset (it doesn't work when I use ListBox.TextStyle.Offset), but I am still not able to set the padding properly. My ListBoxStyle.ItemSize has height 42 and the font I am using has size 23. I should be able to set ListBoxItem.Style.TextStyle.Offset on Y to 9 (to have vertical alignment), but when I set this, the text is not displayed (the maximum number I can set for Y offset is 3, but it's still not aligned). I have tried to use ListBoxItem.Style.TextStyle.Alignment = Alignment.BottomCenter, but it doesn't work at all. Why is that?[/*:m]
2. I created listbox with fixed size. I presumed, when there are more items and it's not possible to fit them to this fixed size, the scrollbar appears (i.e. if (ListBoxStyle.ItemSize.Height * ListBox.Items.Count > ListBox.Size.Height). Unfortunately it doesn't show scrollbar and throws the exception[/*:m]
3. The last but the biggest problem is this - I have a listbox. I have bound SelectedItemIndexChanged to my method. In this method I call ListBox.Dispose() but this always crashes. The problem is on line no. 639 in ListBox.cs where it tries to get reference to this.MiyagiSystem, but it's already null. [/*:m][/list:u]

Thank you

nico008

24-03-2010 09:44:19

Will you totally remove Hide/Show methods? Show() and Hide() + Show(int fadetime) and Hide(int fadetime) would be convenient for me.
When I use gui.Visible = false then gui.Visible = true, then children doesn't appears but their "Visible" property is set to true anyway so It doesn't solve my problem actualy

About ListBox, I have to set ListBoxStyle.ItemSize = new Size(79, 50); to have WordWrap working, but then if I add a short line, it takes like 3 lines. Is there a autosize thing? I just want the width to be fixed

Some little things :
if I don't specify
"ListBoxStyle.ItemSize = something" then "internal int MaxVisibleItems" from ListBox.cs throws Exception (div 0)
Also when I right click before moving the mouse, it throws NullRefExcpt from FireMouseGestureEvent() in InputManager.

Thx

smiley80

24-03-2010 10:35:46

• I have found out, that I can change the text padding by setting ListBoxItem.Style.TextStyle.Offset

TextStyle.Offset should work better in r324.

I have tried to use ListBoxItem.Style.TextStyle.Alignment = Alignment.BottomCenter, but it doesn't work at all. Why is that?

ListBoxItem.Style.TextStyle.Alignment gets overridden by ListBox.ListBoxStyle.ItemAlignment. I'll look into that.

• I created listbox with fixed size. I presumed, when there are more items and it's not possible to fit them to this fixed size, the scrollbar appears (i.e. if (ListBoxStyle.ItemSize.Height * ListBox.Items.Count > ListBox.Size.Height). Unfortunately it doesn't show scrollbar and throws the exception

That's what should happen...I mean the first part, not the exception. Speaking of which, what exception do you get?

• The last but the biggest problem is this - I have a listbox. I have bound SelectedItemIndexChanged to my method. In this method I call ListBox.Dispose() but this always crashes. The problem is on line no. 639 in ListBox.cs where it tries to get reference to this.MiyagiSystem, but it's already null.

Fixed.

Will you totally remove Hide/Show methods? Show() and Hide() + Show(int fadetime) and Hide(int fadetime) would be convenient for me.

Well, there will be a Fade method.

When I use gui.Visible = false then gui.Visible = true, then children doesn't appears but their "Visible" property is set to true anyway so It doesn't solve my problem actualy

Should only affect top level controls, I have to look into that.

About ListBox, I have to set ListBoxStyle.ItemSize = new Size(79, 50); to have WordWrap working, but then if I add a short line, it takes like 3 lines. Is there a autosize thing? I just want the width to be fixed

No, the best approach would be creating a custom control.

if I don't specify "ListBoxStyle.ItemSize = something" then "internal int MaxVisibleItems" from ListBox.cs throws Exception (div 0)
Also when I right click before moving the mouse, it throws NullRefExcpt from FireMouseGestureEvent() in InputManager.

Should be fixed.

smiley80

24-03-2010 14:46:33

Side node:
In the next few days (if everything goes well), Miyagi will complety move to Sourceforge, the VCS will change to Mercurial and the Google Code project will be deleted.

kubatp

24-03-2010 16:58:53

TextStyle.Offset should work better in r324.
This is much better now. I can change the offset exactly I need.

kubatp wrote:
• The last but the biggest problem is this - I have a listbox. I have bound SelectedItemIndexChanged to my method. In this method I call ListBox.Dispose() but this always crashes. The problem is on line no. 639 in ListBox.cs where it tries to get reference to this.MiyagiSystem, but it's already null.

Fixed.

Thank you. It works ok now.

kubatp wrote:
• I created listbox with fixed size. I presumed, when there are more items and it's not possible to fit them to this fixed size, the scrollbar appears (i.e. if (ListBoxStyle.ItemSize.Height * ListBox.Items.Count > ListBox.Size.Height). Unfortunately it doesn't show scrollbar and throws the exception

That's what should happen...I mean the first part, not the exception. Speaking of which, what exception do you get?

This is partially my problem. I have tried to debug Miyagi code and it seems like I don't have all the "skin" files. It tries to get thumb file, however I haven't specified in code, that I want to use thumb. Anyway, would you mind to tell me what files (skins) do I need to get the listbox working? In the pre-previous Miyagi version were example images attached (so I would have been able to see what files I need), but now I use Miyagi SVN branch and there are those files not anymore.

Thank you!

nico008

24-03-2010 18:22:40

Thanks for the new link and fixes!

"No, the best approach would be creating a custom control"
-> sorry but I don't understand what to do

about the gui.Visible = false, some children that never have been showed appears when I set back gui.Visible = true
see my attached screenshot : some items are visible (should not) while their bag are hidden (as it should be)

note that some of these components were created like this :

component = new Component();
component.Hide(false);

good luck man

smiley80

26-03-2010 05:19:26

Anyway, would you mind to tell me what files (skins) do I need to get the listbox working?

BaseName
BaseName.VScrollBar <- there might be the problem, cause it was previously just ScrollBar.
BaseName.VScrollBar.Thumb

-> sorry but I don't understand what to do

Derive a new control from ControlBase.

component = new Component();
component.Hide(false);

Can't recreate that, but try component.Visible = false instead.

Edit:
The Google Code project has bee deleted. Any further updates will be made to the Sourceforge hg repo.

nico008

26-03-2010 12:03:30

When I use gui.Visible = false then gui.Visible = true, then children doesn't appears but their "Visible" property is set to true anyway so It doesn't solve my problem actualy

Ok I will try ControlBase

nico008

28-03-2010 22:03:20

Hi smiley80.
How are you?

Still no idea about the gui.visible = false problem?
Is there a way to change keyboard locale? I have french keyboard, but in miyagi controls it write as if I had QWERTY keyboard.

smiley80

28-03-2010 23:48:48

r310 has some visibility related changes.

Is there a way to change keyboard locale? I have french keyboard, but in miyagi controls it write as if I had QWERTY keyboard.

It's actually a German QWERTZ keyboard. Will be fixed in the next few days (together with the removal of the 2 P/Invokes).

kubatp

29-03-2010 12:28:54

Hi Smiley,
I would like to ask you for one feature in the listbox control. When user hovers over the item, it should be possible to change the texture of this item. From quick review of MIYAGI code, I have found out, there probably isn't a way how to do it. There is a private variable hoveredItemIndex but not exposed, and no event to get the information about hovering. Is it possible to add this functionality?

I cannot find a URL where Miyagi is available (the source code) in SVN branch, would you mind to paste it here please?

BaseName.VScrollBar <- there might be the problem, cause it was previously just ScrollBar.
Yes, that was it!

Thank you

nico008

29-03-2010 13:36:13

I think that there is no more SVN, but there is the new one using mercurial : http://sourceforge.net/projects/miyagi/develop
I don't know how to deal with it on windows, but in Linux I use hg_mercurial
good luck

smiley80

29-03-2010 13:37:41

Is it possible to add this functionality?
Added in r313: HoveredIndex property and HoveredIndexChanged event.

I cannot find a URL where Miyagi is available (the source code) in SVN branch, would you mind to paste it here please?

http://miyagi.hg.sourceforge.net:8000/h ... agi/miyagi
You'll need Mercurial to do a checkout. If you don't want to use the commandline, there's also TortoiseHg

nico008

29-03-2010 14:29:36

Thanks for changes!
The gui.visible = false/true problem has been fixed

kubatp

29-03-2010 17:44:37

Hi Smiley,
I have downloaded the latest version and ModalGUI cannot be created, because it throws the exception. The reason is line. 50 in ModalGUI.cs where it sets visible to false, which fires event OnVisibleChanged and in PushPopModal it crashes, because guimanager hasn't been initialized yet.

Thank you for this new event. It works perfectly.

kubatp

29-03-2010 18:07:36

Hi Smiley,
I know Nico had problems with this GUi.visible. Now I do have problems:) I used it the way, that ModalGUI was visible only when I wanted it and when I wanted to use what was behind, i set ModalGUI.visible = false.
Unfortunately this doesn't work as it did before. Has the approach itself been changed? How should I use the ModalGUI now?
Thank you

smiley80

29-03-2010 19:29:30

ModalGUIs should work again.

smiley80

03-04-2010 17:20:54

Is there a way to change keyboard locale? I have french keyboard, but in miyagi controls it write as if I had QWERTY keyboard.
The following QWERTY-based keyboard layouts (no Dvorak, Colemak or others) should now be supported:
Brazilian, Dutch, French, German, Italian, Portuguese, Spanish, Swedish, UK and US (default)

nico008

03-04-2010 17:38:53

Great news!
I just tryed it.
Keyboard layout seems to be QWERTY at the moment.
How can I change it to French?

kubatp

03-04-2010 18:40:38

Hi Smiley,
ModalGUI is working fine now, thank you!

I have just tried the tooltip feature for the first time. It's really good and the auto sizing works perfectly. What I would suggest to add is a "Padding" feature of the text ToolTip. I know, there is offset, but this just sets the margin from top left. Is it possible to add padding feature, where all the four padding directions would be specified?

Thank you

smiley80

03-04-2010 21:48:10

Keyboard layout seems to be QWERTY at the moment.
How can I change it to French?

Did you rebuild the input plugin?
What's the value of System.Globalization.CultureInfo.CurrentCulture.KeyboardLayoutId?

What I would suggest to add is a "Padding" feature of the text ToolTip. I know, there is offset, but this just sets the margin from top left. Is it possible to add padding feature, where all the four padding directions would be specified?
Will be in the next rev.

nico008

04-04-2010 09:39:44

Hi smiley80

The id is 2060
Actually it is not a French keyboard but Belgian keyboard : http://en.wikipedia.org/wiki/Keyboard_layout#Belgian
Is there a lot of work to do to map every keys correctly? Mainly ! = + \ - _ are different from French keyboard

Note that French and Belgian keyboards are AZERTY not QWERTY

About GUI texture files, is it possible to have borders and center in the same file instead of Panel.Border + Panel?

smiley80

04-04-2010 11:49:43

Is there a lot of work to do to map every keys correctly? Mainly ! = + \ - _ are different from French keyboard

Windows only:
Compile the KeyboardLayoutMaker project and run it with the layout id as argument (e.g. "KeyboardLayoutMaker.exe 2060")
That'll produce a file named 2060.xml. Move it to a new folder and point the Keyboard.AdditionalLayoutsFolder property to that folder.

Edit:
2060 is now included in Miyagi.KeyboardLayouts.dll, which now stores all layouts. If you want to use a different layout than the US one, you'll have to put that dll in the same folder as Miyagi.dll.

About GUI texture files, is it possible to have borders and center in the same file instead of Panel.Border + Panel?

Skin skinPanel = Skin.Create("PanelSkin"); TextureFrame frame1 = new TextureFrame("Panel.png", RectangleF.FromLTRB(0.25f, 0.25f, 0.75f, 0.75f), 0); skinPanel.SubSkins["PanelSkin"] = new Miyagi.Resources.Texture(frame1); TextureFrame frame2 = new TextureFrame("Panel.png", RectangleF.FromLTRB(0, 0, 1f, 1f), 0); skinPanel.SubSkins["PanelSkin.Border"] = new Miyagi.Resources.Texture(frame2); resMgr.Skins.Add(skinPanel)
The uv-coordinates of frame1(the RectangleF) have to describe the center.

nico008

04-04-2010 20:20:08

It is working
Thanks a lot!
Only the key for ? and , is not working but it doesn't matter very much

Also thanks for the texture thing

Miyagi is the best GUI I have ever seen!

smiley80

04-04-2010 21:00:37

Looks like 'OemComma'(, and ?) and 'BrowserHome' share the same scancode. I'll add a filter for those kind of keys. Miyagi doesn't need to know if they're pressed anyway.

kubatp

11-04-2010 22:11:04

Hi Smiley,
is there a way how to actually use different cursors but main for custom purposes? When I change the activemode, it resets the cursor to main on frame started again. Is it possible to actually have like more "main" cursors and switch between them?
thank you

smiley80

12-04-2010 00:01:18

You have to set the active mode of the cursor before you call MiyagiSystem.Update.
Besides that, controls now have a 'Cursor' property which sets the active mode of the cursor to that mode, if the mouse is over that control.

kubatp

14-04-2010 22:25:22

Thanks Smiley,
I have rather decided to create new main cursor instead of changing it every time before Update. It works perfectly now.

I have one question, which I am not 100% sure is Miyagi related. I am creating "loading game" functionality, which creates many objects (entities) in one row. It takes ~10 seconds. I would like to display progress bar with updated progress indicator. The problem is, that GUI simply freezes during these new entities creation. These entities are created on the default Mogre GUI thread, which is used by MIyagi as well, isn't it?
Is there a way to update directly few controls to be displayed staight away, even the GUI thread is really busy?
I have tried to call MiyagiSystem.Update and GUI.Update as well, but it hasn't changed it.
Thank you

smiley80

15-04-2010 00:34:31

The rendering is done in SceneManager.RenderQueueStarted (or RenderQueueEnded), so it should work when you call Update + Root.RenderOneFrame.

kubatp

15-04-2010 07:32:15

Hi Smiley,
you are right, this should work, unfortunately it crashes most of the time. The exception is "OGRE EXCEPTION(3:RenderingAPIException): Error beginning frame :Invalid call in D3D9RenderSystem::_beginFrame at ..\\src\\OgreD3D9RenderSystem.cpp (line 2686)". I am sure I am missing something fundamental here. I read this http://www.ogre3d.org/forums/viewtopic.php?f=2&t=48691 and the advice is not to call RenderOneFrame when it already is in the rendering frame (which it is, because I render the new loaded stuff). This is probably wrong technique, so would you please mind to give me a short advice how to render GUI and the other scene parallely?
Thank you!

smiley80

15-04-2010 15:17:35

Okay, RenderManager has now a 'DoRender' method, but it's not safe to call it arbitrarily, instead you can do:
RenderTargetListener.PostRenderTargetUpdateHandler del = delegate { this.miyagiSystem.RenderManager.DoRender(); }; this.window.PostRenderTargetUpdate += del; this.window.Update(); this.window.PostRenderTargetUpdate -= del;

kubatp

15-04-2010 19:35:59

Hi Smiley,
thank you for your help, unfortunately it still doesn't work. On line this.window.Update(); it still throws exception - Ogre::RenderingAPIException (the same one as I stated in the previuos post)

Second thing is - I still try to display entity on top of the GUI. It works with mogre overlay and Add3D function, but the problem is, that it's on the top of everything. It's great, that it's above the Miagyi controls, unfortunately it's above the cursor as well. I have tried to play with RenderQueueGroup of this entity, but without luck. It's under the gui controls and cursor OR above both. Is there a solution?

Third thing is, that sometimes Miyagi throws the exception on line 372 in SpriteRenderer (Sprite batch = this.SpriteList[nextBatchIndex];) - System.ArgumentOutOfRangeException' occurred in mscorlib.dll (OgreException.LastThrown is null). Is this something you are aware of?

smiley80

15-04-2010 20:33:04

Hi Smiley,
thank you for your help, unfortunately it still doesn't work. On line this.window.Update(); it still throws exception - Ogre::RenderingAPIException (the same one as I stated in the previuos post)

Do you call it (indirectly) from a Mogre eventhandler (e.g.. FrameStarted)?

Second thing is - I still try to display entity on top of the GUI. It works with mogre overlay and Add3D function, but the problem is, that it's on the top of everything. It's great, that it's above the Miagyi controls, unfortunately it's above the cursor as well. I have tried to play with RenderQueueGroup of this entity, but without luck. It's under the gui controls and cursor OR above both. Is there a solution?

It might be work correctly when I move the cursor to RenderQueueEnded, I've to look into it.
Anyhow, did you try the RenderBox control?

Third thing is, that sometimes Miyagi throws the exception on line 372 in SpriteRenderer (Sprite batch = this.SpriteList[nextBatchIndex];) - System.ArgumentOutOfRangeException' occurred in mscorlib.dll (OgreException.LastThrown is null). Is this something you are aware of?

kubatp

15-04-2010 21:18:48

Do you call it (indirectly) from a Mogre eventhandler (e.g.. FrameStarted)?
This is little bit embarrassing, I have run this on backend thread. So I have swap it and it doesn't throw this exception anymore; but the problem is the same. It doesn't update the progress control and the rest of Miyagi controls - it's wierd, but it looks like the controls were "doubled" - those which are transparent have filling colours, it's more bright and contrasty.

Anyhow, did you try the RenderBox control?
No I haven't. I am sorry, it's hard to keep up with your quick development progress (which is great). But when I take a look on the code of RenderBox, it seems like for textures only. I need to add entity, which should rotate....Overlay works fine, the only problem is the cursor...

I guess this has been fixed when I changed the backend thread to GUI thread.

In general, is there some kind of common approach what to do, when many entities should be rendered at the same time? When you create scene, etc... it freezes, which is not really nice. It's a question to another thread, I know. I am just wondering if you (Because of I guess you have an experience with this) can answer this....

smiley80

15-04-2010 23:03:08

So I have swap it and it doesn't throw this exception anymore; but the problem is the same. It doesn't update the progress control and the rest of Miyagi controls - it's wierd, but it looks like the controls were "doubled" - those which are transparent have filling colours, it's more bright and contrasty.

Yeah, strange. Can't reproduce that. You do call MiyagiSystem.Update (I've forgot that in my post)?

No I haven't. I am sorry, it's hard to keep up with your quick development progress (which is great). But when I take a look on the code of RenderBox, it seems like for textures only. I need to add entity, which should rotate....

A RenderBox is pretty much just a render-to-texture wrapper.
You attach the entity to a scenenode as usual, set up an additional camera and point that camera at the entity.
But you have to make sure the main camera doesn't see this entity and additional camera doesn't see the other entities (e.g. through VisiblityFlags).

Overlay works fine, the only problem is the cursor...

That should work fine now.

In general, is there some kind of common approach what to do, when many entities should be rendered at the same time? When you create scene, etc... it freezes, which is not really nice. It's a question to another thread, I know. I am just wondering if you (Because of I guess you have an experience with this) can answer this...

Ogre supports background loading for resources, but I don't know if that works with Mogre (last thing I've heard is that it doesn't).
Anyway, it shouldn't freeze (except for the time it actually loads one resource) when you update the window.

kubatp

16-04-2010 12:49:12

Yeah, strange. Can't reproduce that. You do call MiyagiSystem.Update (I've forgot that in my post)?

I tried it and it's still the same. Controls are more bright and contrasty till the loading (entities creation) is actually finished when it gets normal again. The progress bar is not updating. I have even tried to call this directly (without the event binding) and the progress bar is not updated as well (but controls are not contrasty).

A RenderBox is pretty much just a render-to-texture wrapper.
You attach the entity to a scenenode as usual, set up an additional camera and point that camera at the entity.
But you have to make sure the main camera doesn't see this entity and additional camera doesn't see the other entities (e.g. through VisiblityFlags).

Ahh I understand it now. It's actually what I could use, but the overlay is ok, when the cursor is above.

That should work fine now.
I still cannot get it working. When I set RenderQueueGroup of the entity to 99 it's below, when to 100 it's above. How can I decide in what layer this will be displayed (above controls and below cursor)?

Anyway, it shouldn't freeze (except for the time it actually loads one resource) when you update the window.
If it shouldn't freeze, I do something wrong. I create big manual object on a Main thread (which means it should freeze). This creation is fired by another thread (returned from backend), so it's actually not really during update, it's when it returns from backend. Should this be changed?

smiley80

16-04-2010 15:49:13

I still cannot get it working. When I set RenderQueueGroup of the entity to 99 it's below, when to 100 it's above. How can I decide in what layer this will be displayed (above controls and below cursor)?

It works when both 3d overlay and Miyagi are on the same RenderQueueGroup (that's the case by default), and Miyagi doesn't use a different camera with disabled overlays.

If it shouldn't freeze, I do something wrong. I create big manual object on a Main thread (which means it should freeze). This creation is fired by another thread (returned from backend), so it's actually not really during update, it's when it returns from backend. Should this be changed?

To be on safe side, you should check whether all Miyagi or Mogre related stuff is called from the same (i.e. main) thread.

kubatp

19-04-2010 13:56:23

It works when both 3d overlay and Miyagi are on the same RenderQueueGroup (that's the case by default), and Miyagi doesn't use a different camera with disabled overlays.

What I do is this:
SceneNode sn = SceneManager.CreateSceneNode("selectedUnitElementSceneNode"); Overlay unitOverlay = OverlayManager.Singleton.Create("unitOverlay"); unitOverlay.Add3D(sn); unitOverlay.Show(); sn.Position = new Vector3(1.58f, -0.77f, -2); Entity selectedUnitElement = SceneManager.CreateEntity("testName", "unit.mesh"); selectedUnitElement.Visible = true; sn.AttachObject(selectedUnitElement); sn.SetVisible(true); sn._update(true, true);

and the overlay is correctly above the controls but above the cursor as well.

To be on safe side, you should check whether all Miyagi or Mogre related stuff is called from the same (i.e. main) thread.
What I am trying to do is get working the usage Debug version of Direct3D. But there is a wierd problem with Miyagi. This problem is not in Retail version, however in debug version it throws
OGRE EXCEPTION(3:RenderingAPIException): Failed to DrawPrimitive : Invalid call in D3D9RenderSystem::_render at ..\\src\\OgreD3D9RenderSystem.cpp (line 2915) on first RenderOneFrame call.
I have isolated the problem and the problem is in few parts. This is my Miaygi initialization:

ResourceGroupManager.Singleton.AddResourceLocation(currentApplicationPath, "FileSystem", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, true); ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; RenderWindow.GetCustomAttribute("WINDOW", out windowHnd); // window is your RenderWindow! pl.Insert("WINDOW", windowHnd.ToString()); MOIS.InputManager inputManager = MOIS.InputManager.CreateInputSystem(pl); mouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, true); MOIS.MouseState_NativePtr state = mouse.MouseState; state.width = (int)RenderWindow.Width; state.height = (int)RenderWindow.Height; keyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard,true); keyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(keyboard_KeyPressed); keyboard.KeyReleased += new MOIS.KeyListener.KeyReleasedHandler(keyboard_KeyReleased); mouse.MouseMoved += new MOIS.MouseListener.MouseMovedHandler(mouse_MouseMoved); mouse.MousePressed += new MOIS.MouseListener.MousePressedHandler(mouse_MousePressed); mouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(mouse_MouseReleased); Miyagi.Plugin.InputPlugin iptPlg = (Miyagi.Plugin.InputPlugin)MiyagiSystem.PluginManager.LoadPlugin(currentApplicationPath + @"GUI\lib\Miyagi.Plugin.Input.Mois.dll"); iptPlg.SetKeyboardCaptureDevice(keyboard); iptPlg.SetMouseCaptureDevice(mouse); gui = GUIManager.CreateGUI("gui"); modalGui = GUIManager.CreateGUI<Miyagi.UI.ModalGUI>("modalgui"); modalGui.Visible = false; CreateCursors(); CreateMaterialSchemes(); CreateTextSchemes(); AddGuiControls(gui); Root.FrameStarted += new FrameListener.FrameStartedHandler(this.Scene_FrameStarted);

When I comment two lines -CreateCursors(); and AddGuiControls(gui);, it works ok and doesn't throw the exception.
What these commented lines do in short:
CreateCursors - Create cursor skins and set of of them
AddGuiControls - Creates controls like buttons, etc... by gui.CreateControl and controlBase.CreateChildControl

Do you have any ideas?

Tubulii

19-04-2010 15:07:27

Hi

First of all: Great GUI - really!!

But I have two questions:

How can I change a texture at runtime, for example: I created a new image(for a button) and now want to update it.
And how can I limit the texture stretch without always using different images for all controls?

Thanks

smiley80

19-04-2010 18:48:55

and the overlay is correctly above the controls but above the cursor as well.

And it should look like this:

(that's the white legs of the ninja mesh)

What I am trying to do is get working the usage Debug version of Direct3D. But there is a wierd problem with Miyagi. This problem is not in Retail version, however in debug version it throws
OGRE EXCEPTION(3:RenderingAPIException): Failed to DrawPrimitive : Invalid call in D3D9RenderSystem::_render at ..\\src\\OgreD3D9RenderSystem.cpp (line 2915) on first RenderOneFrame call.

Debug DirectX is a bit anal at that point (the colour element of the vertex is declared as a FLOAT4 instead of COLOUR).
I'll try to fix it, if it's not too much of a performance hit.

How can I change a texture at runtime, for example: I created a new image(for a button) and now want to update it.

In the Mercurial version:
myButton.TextureStyle.Texture = new Miyagi.Resources.Texture("myNewTexture.png");
would change the current texture of the button.

And how can I limit the texture stretch without always using different images for all controls?

Make the source texture as large as the max possible size.

kubatp

19-04-2010 18:54:26

And it should look like this:
This is exactly what I have been trying to achieve, but it doesn't work for me. Have you used my code? What can I do wrong, that the cursor is still behind the overlay entity?

Debug DirectX is a bit anal at that point (the colour element of the vertex is declared as a FLOAT4 instead of COLOUR).
I'll try to fix it, if it's not too much of a performance hit.

I am not really sure I understand this. So you have found what is the problem already?

smiley80

19-04-2010 19:51:33

This is exactly what I have been trying to achieve, but it doesn't work for me. Have you used my code? What can I do wrong, that the cursor is still behind the overlay entity?

Just a different node scale and position (shouldn't make a difference) and, obviously, a different mesh.
I've seen that behaviour only when you use a separate camera for Miyagi.

I am not really sure I understand this. So you have found what is the problem already?

Yep, should be fixed now.

kubatp

19-04-2010 21:24:29

Just a different node scale and position (shouldn't make a difference) and, obviously, a different mesh.
I've seen that behaviour only when you use a separate camera for Miyagi.

Yep, should be fixed now.
This is fixed as well. Unfortunately there is another exception thrown. It's in MogreSpriteRenderer.cs line 171 (rs._render(this.renderOp);) which throws and in log is "Direct3D9: (ERROR) :Need to call BeginScene before rendering." and Direct3D9: (ERROR) : DrawPrimitive failed (OGRE EXCEPTION(3:RenderingAPIException): Failed to DrawPrimitive : Invalid call in D3D9RenderSystem::_render at ..\\src\\OgreD3D9RenderSystem.cpp (line 2915))

smiley80

19-04-2010 22:05:06

Only with debug D3D?

kubatp

20-04-2010 08:13:38

Hi Smiley,
yes this is happening only when I enable "Use Debug Version of Direct3D" in DirectX properties. I attach debugview log, where I enabled all the possible logging. However I don't see too many useful information. Because of it, I attach my VS output when I run it in debug.

VS output (I have removed initialized textures, resources, etc...)

'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\tutorial1.exe', No native symbols in symbol file. 'tutorial1.exe': Loaded 'C:\Windows\System32\ntdll.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\mscoree.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\kernel32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\advapi32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\rpcrt4.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\shlwapi.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\gdi32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\user32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\msvcrt.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\imm32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\msctf.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\lpk.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\usp10.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\avgrsstx.dll' 'tutorial1.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18005_none_5cb72f96088b0de0\comctl32.dll' 'tutorial1.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll' 'tutorial1.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4016_none_d0893820442e7fe4\msvcr80.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\shell32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\ole32.dll' 'tutorial1.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Culture.dll' 'tutorial1.exe': Unloaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Culture.dll' 'tutorial1.exe': Loaded 'C:\Windows\assembly\NativeImages_v2.0.50727_32\mscorlib\894183c0c47bd4772fbfad4c1a7e3b71\mscorlib.ni.dll' 'tutorial1.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'tutorial1.exe': Loaded 'C:\Windows\System32\uxtheme.dll' 'tutorial1.exe' (Managed): Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\tutorial1.exe', Symbols loaded. 'tutorial1.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll' 'tutorial1.exe': Loaded 'C:\Windows\assembly\NativeImages_v2.0.50727_32\System\13cce38e8de5fd54853390e4e98abd0e\System.ni.dll' 'tutorial1.exe': Loaded 'C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Drawing\57e722244d3b48cb92b340bc92d7a191\System.Drawing.ni.dll' 'tutorial1.exe': Loaded 'C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Windows.Forms\425e95df110b77abad261a46fca54e99\System.Windows.Forms.ni.dll' 'tutorial1.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'tutorial1.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'tutorial1.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Mogre.dll' 'tutorial1.exe': Unloaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Mogre.dll' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Mogre.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\rsaenh.dll' 'tutorial1.exe': Unloaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Mogre.dll' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Mogre.dll' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\OgreMain.dll' 'tutorial1.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_5090ab56bcba71c2\msvcr90.dll' 'tutorial1.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_5090ab56bcba71c2\msvcp90.dll' 'tutorial1.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_5090ab56bcba71c2\msvcm90.dll' 'tutorial1.exe' (Managed): Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Mogre.dll' 'tutorial1.exe': Loaded 'ImageAtBase0x71760000', No symbols loaded. 'tutorial1.exe': Loaded 'ImageAtBase0x52c0000', No symbols loaded. 'tutorial1.exe': Unloaded 'ImageAtBase0x71760000' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Kernel.dll', No native symbols in symbol file. 'tutorial1.exe' (Managed): Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Kernel.dll', Symbols loaded. 'tutorial1.exe': Loaded 'ImageAtBase0x601f0000' 'tutorial1.exe': Loaded 'ImageAtBase0x52f0000', No symbols loaded. 'tutorial1.exe': Unloaded 'ImageAtBase0x601f0000' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Miyagi.dll', No native symbols in symbol file. 'tutorial1.exe' (Managed): Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Miyagi.dll', Symbols loaded. 'tutorial1.exe': Loaded 'C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Configuration\78aac991cacbc9665c628f5466cec9c1\System.Configuration.ni.dll' 'tutorial1.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'tutorial1.exe': Loaded 'C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Xml\99e7927ccb9099e607035349814d4cf6\System.Xml.ni.dll' 'tutorial1.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'tutorial1.exe': Loaded 'ImageAtBase0x73a10000', No symbols loaded. 'tutorial1.exe': Loaded 'ImageAtBase0x5370000', No symbols loaded. 'tutorial1.exe': Unloaded 'ImageAtBase0x73a10000' 'tutorial1.exe': Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll' 'tutorial1.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll' 'tutorial1.exe': Loaded 'D:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\x86\Microsoft.VisualStudio.Debugger.Runtime.Impl.dll' 'tutorial1.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\diasymreader.dll' 'tutorial1.exe' (Managed): Loaded 'C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_5090ab56bcba71c2\msvcm90.dll' 'tutorial1.exe': Loaded 'ImageAtBase0x5850000', No symbols loaded. 'tutorial1.exe': Loaded 'ImageAtBase0x58d0000', No symbols loaded. 'tutorial1.exe': Unloaded 'ImageAtBase0x5850000' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\MOIS.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\dinput8.dll' 'tutorial1.exe' (Managed): Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\MOIS.dll' 'tutorial1.exe': Loaded 'ImageAtBase0x6b350000', No symbols loaded. 'tutorial1.exe': Loaded 'ImageAtBase0x5950000', No symbols loaded. 'tutorial1.exe': Unloaded 'ImageAtBase0x6b350000' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Resource.dll', No native symbols in symbol file. 'tutorial1.exe' (Managed): Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Resource.dll', Symbols loaded. 'tutorial1.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.0.6002.18005_none_9e50b396ca17ae07\GdiPlus.dll' Creating resource group General Creating resource group Internal Creating resource group Autodetect SceneManagerFactory for type 'DefaultSceneManager' registered. Registering ResourceManager for type Material Registering ResourceManager for type Mesh Registering ResourceManager for type Skeleton MovableObjectFactory for type 'ParticleSystem' registered. OverlayElementFactory for type Panel registered. OverlayElementFactory for type BorderPanel registered. OverlayElementFactory for type TextArea registered. Registering ResourceManager for type Font ArchiveFactory for archive type FileSystem registered. ArchiveFactory for archive type Zip registered. FreeImage version: 3.10.0 This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2 DDS codec registering Registering ResourceManager for type HighLevelGpuProgram Registering ResourceManager for type Compositor MovableObjectFactory for type 'Entity' registered. MovableObjectFactory for type 'Light' registered. MovableObjectFactory for type 'BillboardSet' registered. MovableObjectFactory for type 'ManualObject' registered. MovableObjectFactory for type 'BillboardChain' registered. MovableObjectFactory for type 'RibbonTrail' registered. Loading library .\RenderSystem_Direct3D9 Installing plugin: D3D9 RenderSystem D3D9 : Direct3D9 Rendering Subsystem created. 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\RenderSystem_Direct3D9.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\d3d9.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\version.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\d3d8thk.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\dwmapi.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\D3DX9_40.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\d3d9d.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\winmm.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\oleaut32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\oleacc.dll' Direct3D9: :====> ENTER: DLLMAIN(6d8da170): Process Attach: 00001064, tid=00000320 Direct3D9: :====> EXIT: DLLMAIN(6d8da170): Process Attach: 00001064 Direct3D9: (INFO) :Direct3D9 Debug Runtime selected. 'tutorial1.exe': Loaded 'C:\Windows\System32\atiumdag.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\atiumdva.dll' D3D9: Driver Detection Starts D3D9: Driver Detection Ends Plugin successfully installed Loading library .\RenderSystem_GL 'tutorial1.exe': Loaded 'C:\Windows\System32\atipdlxx.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\setupapi.dll' 'tutorial1.exe': Unloaded 'C:\Windows\System32\atipdlxx.dll' 'tutorial1.exe': Unloaded 'C:\Windows\System32\setupapi.dll' D3D9 Helper: Enhanced D3DDebugging disabled; Application was not compiled with D3D_DEBUG_INFO 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\RenderSystem_GL.dll', Binary was not built with debug information. 'tutorial1.exe': Loaded 'C:\Windows\System32\opengl32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\glu32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\ddraw.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\dciman32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\setupapi.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\atioglxx.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\ws2_32.dll' Installing plugin: GL RenderSystem OpenGL Rendering Subsystem created. 'tutorial1.exe': Loaded 'C:\Windows\System32\nsi.dll' Plugin successfully installed Loading library .\Plugin_ParticleFX Installing plugin: ParticleFX Particle Emitter Type 'Point' registered Particle Emitter Type 'Box' registered Particle Emitter Type 'Ellipsoid' registered Particle Emitter Type 'Cylinder' registered Particle Emitter Type 'Ring' registered Particle Emitter Type 'HollowEllipsoid' registered Particle Affector Type 'LinearForce' registered Particle Affector Type 'ColourFader' registered Particle Affector Type 'ColourFader2' registered Particle Affector Type 'ColourImage' registered Particle Affector Type 'ColourInterpolator' registered Particle Affector Type 'Scaler' registered Particle Affector Type 'Rotator' registered Particle Affector Type 'DirectionRandomiser' registered Particle Affector Type 'DeflectorPlane' registered Plugin successfully installed Loading library .\Plugin_BSPSceneManager 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Plugin_ParticleFX.dll', Binary was not built with debug information. 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Plugin_BSPSceneManager.dll' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Plugin_OctreeSceneManager.dll' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Plugin_CgProgramManager.dll' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\cg.dll', Binary was not built with debug information. Installing plugin: BSP Scene Manager Plugin successfully installed Loading library .\Plugin_OctreeSceneManager Installing plugin: Octree & Terrain Scene Manager Plugin successfully installed Loading library .\Plugin_CgProgramManager Installing plugin: Cg Program Manager Plugin successfully installed *-*-* OGRE Initialising *-*-* Version 1.6.4 (Shoggoth) Creating resource group D3D9 : RenderSystem Option: Full Screen = No D3D9 : RenderSystem Option: Video Mode = 1280 x 800 @ 32-bit colour CPU Identifier & Features ------------------------- * CPU ID: GenuineIntel: Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz * SSE: yes * SSE2: yes * SSE3: yes * MMX: yes * MMXEXT: yes * 3DNOW: no * 3DNOWEXT: no * CMOV: yes * TSC: yes * FPU: yes * PRO: yes * HT: no ------------------------- D3D9 : Subsystem Initialising *************************************** *** D3D9 : Subsystem Initialised OK *** *************************************** D3D9RenderSystem::_createRenderWindow "Main RenderWindow", 1280x800 windowed miscParams: externalWindowHandle=1312978 D3D9 : Created D3D9 Rendering Window 'Main RenderWindow' : 1264x764, 32bpp D3D9 : WARNING - disabling VSync in windowed mode can cause timing issues at lower frame rates, turn VSync on if you observe this problem. Direct3D9: (INFO) :======================= Hal HWVP device selected Registering ResourceManager for type Texture Registering ResourceManager for type GpuProgram D3D9: Vertex texture format supported - PF_L8 D3D9: Vertex texture format supported - PF_L16 D3D9: Vertex texture format supported - PF_A8 D3D9: Vertex texture format supported - PF_A4L4 D3D9: Vertex texture format supported - PF_BYTE_LA D3D9: Vertex texture format supported - PF_R5G6B5 D3D9: Vertex texture format supported - PF_B5G6R5 D3D9: Vertex texture format supported - PF_A4R4G4B4 D3D9: Vertex texture format supported - PF_A1R5G5B5 D3D9: Vertex texture format supported - PF_A8R8G8B8 D3D9: Vertex texture format supported - PF_B8G8R8A8 D3D9: Vertex texture format supported - PF_A2R10G10B10 D3D9: Vertex texture format supported - PF_A2B10G10R10 D3D9: Vertex texture format supported - PF_DXT1 D3D9: Vertex texture format supported - PF_DXT2 D3D9: Vertex texture format supported - PF_DXT3 D3D9: Vertex texture format supported - PF_DXT4 D3D9: Vertex texture format supported - PF_DXT5 D3D9: Vertex texture format supported - PF_FLOAT16_RGB D3D9: Vertex texture format supported - PF_FLOAT16_RGBA D3D9: Vertex texture format supported - PF_FLOAT32_RGB D3D9: Vertex texture format supported - PF_FLOAT32_RGBA D3D9: Vertex texture format supported - PF_X8R8G8B8 D3D9: Vertex texture format supported - PF_X8B8G8R8 D3D9: Vertex texture format supported - PF_R8G8B8A8 D3D9: Vertex texture format supported - PF_DEPTH D3D9: Vertex texture format supported - PF_SHORT_RGBA D3D9: Vertex texture format supported - PF_FLOAT16_R D3D9: Vertex texture format supported - PF_FLOAT32_R D3D9: Vertex texture format supported - PF_SHORT_GR D3D9: Vertex texture format supported - PF_FLOAT16_GR D3D9: Vertex texture format supported - PF_FLOAT32_GR D3D9: Vertex texture format supported - PF_SHORT_RGB RenderSystem capabilities ------------------------- RenderSystem Name: Direct3D9 Rendering Subsystem GPU Vendor: ati Device Name: ASUS EAH4850 series Driver Version: 7.14.10.597 * Fixed function pipeline: yes * Direct3D9: (INFO) :HalDevice Driver Style b Direct3D9: :DoneExclusiveMode Direct3D9: (INFO) :Using FF to VS converter Direct3D9: (INFO) :Using FF to PS converter Hardware generation of mipmaps: yes * Texture blending: yes * Anisotropic texture filtering: yes * Dot product texture operation: yes * Cube mapping: yes * Hardware stencil buffer: yes - Stencil depth: 8 - Two sided stencil support: yes - Wrap stencil values: yes * Hardware vertex / index buffers: yes * Vertex programs: yes * Fragment programs: yes * Geometry programs: no * Supported Shader Profiles: hlsl ps_1_1 ps_1_2 ps_1_3 ps_1_4 ps_2_0 ps_2_a ps_2_b ps_2_x ps_3_0 vs_1_1 vs_2_0 vs_2_a vs_2_x vs_3_0 * Texture Compression: yes - DXT: yes - VTC: no * Scissor Rectangle: yes * Hardware Occlusion Query: yes * User clip planes: yes * VET_UBYTE4 vertex element type: yes * Infinite far plane projection: yes * Hardware render-to-texture: yes * Floating point textures: yes * Non-power-of-two textures: yes * Volume textures: yes * Multiple Render Targets: 4 - With different bit depths: yes * Point Sprites: yes * Extended point parameters: yes * Max Point Size: 256 * Vertex texture fetch: yes - Max vertex textures: 4 - Vertex textures shared: no * Render to Vertex Buffer : no * DirectX per stage constants: yes ResourceBackgroundQueue - threading disabled Particle Renderer Type 'billboard' registered SceneManagerFactory for type 'BspSceneManager' registered. Registering ResourceManager for type BspLevel SceneManagerFactory for type 'OctreeSceneManager' registered. SceneManagerFactory for type 'TerrainSceneManager' registered. Parsing scripts for resource group Parsing script OgreCore.material Parsing script OgreProfiler.material Parsing script Ogre.fontdef Parsing script OgreDebugPanel.overlay Texture: New_Ogre_Border_Center.png: Loading 1 faces(PF_A8R8G8B8,256x128x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x128x1. Texture: New_Ogre_Border.png: Loading 1 faces(PF_A8R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1. Texture: New_Ogre_Border_Break.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1. Font BlueHighwayusing texture size 512x512 Info: Freetype returned null for character 127 in font BlueHighway Texture: BlueHighwayTexture: Loading 1 faces(PF_BYTE_LA,512x512x1) with 0 generated mipmaps from Image. Internal format is PF_BYTE_LA,512x512x1. Texture: ogretext.png: Loading 1 faces(PF_A8R8G8B8,256x128x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x128x1. Parsing script OgreLoadingPanel.overlay Finished parsing scripts for resource group Parsing scripts for resource group Autodetect Finished parsing scripts for resource group Autodetect Parsing scripts for resource group General Parsing script Tiles.material Compiler error: unknown error in Tiles.material(23): token "scene_blend" is not recognized Parsing script guifontsmall.fontdef Finished parsing scripts for resource group General Parsing scripts for resource group Internal Finished parsing scripts for resource group Internal Added resource location 'D:\Development\Aggressors\currentVersion\' of type 'FileSystem' to resource group 'General' with recursive option 'tutorial1.exe': Loaded 'C:\Windows\System32\hid.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\wintrust.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\crypt32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\msasn1.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\userenv.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\secur32.dll' 'tutorial1.exe': Loaded 'C:\Windows\System32\imagehlp.dll' 'tutorial1.exe': Loaded 'ImageAtBase0x71870000', No symbols loaded. 'tutorial1.exe': Loaded 'ImageAtBase0xb7c0000', No symbols loaded. 'tutorial1.exe': Unloaded 'ImageAtBase0x71870000' [9:13:57] Information: Logging started. [9:13:57] Information: Loading backend: Mogre 'tutorial1.exe': Loaded 'C:\Windows\assembly\GAC_MSIL\mscorlib.resources\2.0.0.0_cs_b77a5c561934e089\mscorlib.resources.dll', Binary was not built with debug information. 'tutorial1.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\mscorlib.resources\2.0.0.0_cs_b77a5c561934e089\mscorlib.resources.dll' 'tutorial1.exe': Loaded 'ImageAtBase0x694b0000', No symbols loaded. 'tutorial1.exe': Loaded 'ImageAtBase0xb810000', No symbols loaded. 'tutorial1.exe': Unloaded 'ImageAtBase0x694b0000' 'tutorial1.exe': Unloaded 'ImageAtBase0xb810000' 'tutorial1.exe': Loaded 'ImageAtBase0x69430000', No symbols loaded. 'tutorial1.exe': Loaded 'ImageAtBase0xb810000', No symbols loaded. 'tutorial1.exe': Unloaded 'ImageAtBase0x69430000' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Miyagi.Backend.Mogre.dll', No native symbols in symbol file. 'tutorial1.exe' (Managed): Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\Miyagi.Backend.Mogre.dll', Symbols loaded. [9:13:57] Information: Backend successfully loaded: Mogre [9:13:57] Information: Registered new manager of type: Plugin [9:13:57] Information: Loading plugin: D:\Development\Aggressors\currentVersion\GUI\lib\Miyagi.Plugin.Input.Mois.dll 'tutorial1.exe': Loaded 'ImageAtBase0x694b0000', No symbols loaded. 'tutorial1.exe': Loaded 'ImageAtBase0xb940000', No symbols loaded. 'tutorial1.exe': Unloaded 'ImageAtBase0x694b0000' 'tutorial1.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Culture.dll' 'tutorial1.exe': Unloaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Culture.dll' Managed Debugging Assistant 'LoadFromContext' has detected a problem in 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\tutorial1.exe'. Additional Information: Sestavení nazvané Miyagi.Plugin.Input.Mois bylo načteno z file:///D:/Development/Aggressors/currentVersion/GUI/lib/Miyagi.Plugin.Input.Mois.dll s využitím kontextu LoadFrom. Použití tohoto kontextu může způsobit neočekávané chování při serializaci, přetypování a řešení závislostí. V téměř všech případech se doporučuje nepoužívat kontext LoadFrom. To lze uskutečnit instalací sestavení v mezipaměti GAC (Global Assembly Cache) nebo v adresáři ApplicationBase a použitím funkce Assembly.Load k explicitnímu načítání sestavení. 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\lib\Miyagi.Plugin.Input.Mois.dll', No native symbols in symbol file. [9:13:59] Information: Registered new manager of type: Input [9:13:59] Information: Plugin successfully loaded: Miyagi.Plugin.Input.Mois [9:13:59] Information: Registered new manager of type: GUI [9:13:59] Information: Registered new manager of type: Render 'tutorial1.exe' (Managed): Loaded 'D:\Development\Aggressors\currentVersion\GUI\lib\Miyagi.Plugin.Input.Mois.dll', Symbols loaded. [9:13:59] Information: Registered new manager of type: Resource [9:14:00] Information: 10 files found for skin: Cursor.DEFAULT 'tutorial1.exe': Loaded 'C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Core\670d343c8b3213883fa70837195f7f81\System.Core.ni.dll' 'tutorial1.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'tutorial1.exe': Loaded 'ImageAtBase0x686b0000', No symbols loaded. 'tutorial1.exe': Loaded 'ImageAtBase0xba20000', No symbols loaded. 'tutorial1.exe': Unloaded 'ImageAtBase0x686b0000' 'tutorial1.exe': Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\cs-CZ\tutorial1.resources.dll', Binary was not built with debug information. 'tutorial1.exe' (Managed): Loaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\cs-CZ\tutorial1.resources.dll' [9:14:18] Information: ToolTipElement Unhandled change. Property name: Padding [9:14:18] Information: ToolTipElement Unhandled change. Property name: HoverDuration MiyagiGuiWindow UnnamedSelectorWindow_47 created. SelectorWindow UnnamedSelectorWindow_47 created. MiyagiGuiWindow mainMenu init. MiyagiGuiWindow UnnamedSelectorWindow_52 created. SelectorWindow UnnamedSelectorWindow_52 created. MiyagiGuiWindow loadMenu init. [9:14:22] Debug: Disposing control: mainMenu [9:14:22] Debug: Disposing control: mainMenuwindowButtonTitle [9:14:22] Debug: Disposing control: mainMenuwindowButtonTitleLabel [9:14:22] Debug: Disposing control: mainMenucloseWindowButton [9:14:22] Debug: Disposing control: mainMenuinnerList 'tutorial1.exe': Loaded 'C:\Windows\System32\apphelp.dll' 'tutorial1.exe' (Managed): Loaded '4k4utghd' 'tutorial1.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.6001.18000_none_886786f450a74a05\comctl32.dll' MiyagiGuiWindow UnnamedProgressWindow_57 created. SelectorWindow UnnamedProgressWindow_57 created. [9:14:26] Debug: Disposing control: loadMenu [9:14:26] Debug: Disposing control: loadMenuwindowButtonTitle [9:14:26] Debug: Disposing control: loadMenuwindowButtonTitleLabel [9:14:26] Debug: Disposing control: loadMenucloseWindowButton [9:14:26] Debug: Disposing control: loadMenuinnerList MiyagiGuiWindow progressWindow init. local sends message to serverLOAD_RESOURCE server accepts message LOAD_RESOURCE server sends message to clientLOAD_RESOURCE local accepts ok message LOAD_RESOURCE Direct3D9: (ERROR) :Need to call BeginScene before rendering. Windows has triggered a breakpoint in tutorial1.exe. This may be due to a corruption of the heap, which indicates a bug in tutorial1.exe or any of the DLLs it has loaded. This may also be due to the user pressing F12 while tutorial1.exe has focus. The output window may have more diagnostic information. First-chance exception at 0x7551fbae in tutorial1.exe: Microsoft C++ exception: long at memory location 0x0024db04.. Direct3D9: (ERROR) :DrawPrimitive failed. Windows has triggered a breakpoint in tutorial1.exe. This may be due to a corruption of the heap, which indicates a bug in tutorial1.exe or any of the DLLs it has loaded. This may also be due to the user pressing F12 while tutorial1.exe has focus. The output window may have more diagnostic information. First-chance exception at 0x7551fbae in tutorial1.exe: Microsoft C++ exception: Ogre::RenderingAPIException at memory location 0x0024dd10.. A first chance exception of type 'System.Runtime.InteropServices.SEHException' occurred in Mogre.dll Additional information: V externí součásti došlo k výjimce. A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Cíl vyvolání způsobil výjimku. Unregistering ResourceManager for type BspLevel Direct3D9: (WARN) :Device that was created without D3DCREATE_MULTITHREADED is being used by a thread other than the creation thread. Direct3D9: (WARN) :Device that was created without D3DCREATE_MULTITHREADED is being used by a thread other than the creation thread. *-*-* OGRE Shutdown Unregistering ResourceManager for type Compositor Unregistering ResourceManager for type Font Unregistering ResourceManager for type Skeleton Unregistering ResourceManager for type Mesh Unregistering ResourceManager for type HighLevelGpuProgram Uninstalling plugin: Cg Program Manager Plugin successfully uninstalled Unloading library .\Plugin_CgProgramManager Uninstalling plugin: Octree & Terrain Scene Manager Plugin successfully uninstalled Unloading library .\Plugin_OctreeSceneManager Uninstalling plugin: BSP Scene Manager Plugin successfully uninstalled Unloading library .\Plugin_BSPSceneManager Uninstalling plugin: ParticleFX Plugin successfully uninstalled Unloading library .\Plugin_ParticleFX Uninstalling plugin: GL RenderSystem *** Stopping Win32GL Subsystem *** Plugin successfully uninstalled Unloading library .\RenderSystem_GL Uninstalling plugin: D3D9 RenderSystem D3D9 : Shutting down cleanly. Unregistering ResourceManager for type Texture Unregistering ResourceManager for type GpuProgram D3D9 : Direct3D9 Rendering SubsysteDirect3D9: (WARN) :Device that was created without D3DCREATE_MULTITHREADED is being used by a thread other than the creation thread. Direct3D9: (WARN) :Device that was created without D3DCREATE_MULTITHREADED is being used by a thread other than the creation thread. Direct3D9: (WARN) :Device that was created without D3DCREATE_MULTITHREADED is being used by a thread other than the creation thread. 'tutorial1.exe': Unloaded 'D:\Development\Aggressors\currentVersion\GUI\bin\Debug\RenderSystem_Direct3D9.dll' 'tutorial1.exe': Unloaded 'C:\Windows\System32\D3DX9_40.dll' m destroyed. Plugin successfully uninstalled Unloading library .\RenderSystem_Direct3D9 Unregistering ResourceManager for type Material First-chance exception at 0x1005b1b3 in tutorial1.exe: 0xC0000005: Access violation reading location 0x01b28a3c. An unhandled exception of type 'System.AccessViolationException' occurred in Mogre.dll Additional information: Došlo k pokusu o čtení nebo zápis v chráněné paměti. Zpravidla se jedná o indikaci, že došlo k poškození další paměti. The thread 'Win32 Thread' (0x124c) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x204) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x3e0) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x1ac) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x97c) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x1ec) has exited with code 0 (0x0). The thread 'Win32 Thread' (0xbf8) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x1f8) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x83c) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x320) has exited with code 0 (0x0). The thread 'Win32 Thread' (0xf50) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x15b0) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x558) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x804) has exited with code 0 (0x0). The thread 'Win32 Thread' (0xdcc) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x16f0) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x1444) has exited with code 0 (0x0). The program '[4196] tutorial1.exe: Managed' has exited with code 0 (0x0). The program '[4196] tutorial1.exe: Native' has exited with code 0 (0x0). 

And here is the debug view log:
00000000 9:21:24.073 [3760] Current Time 3380151, Last Input Time 3380042, Idle Time 00000001 9:21:24.073 [3760] ~~~[CpuPowerMonitor] value:cb35 msb:fffffff9 lsb:335 power 6.414062 00000002 9:21:24.074 [3760] ~~~[EnergySaving] CurrentPower:6.414062, EPU Staus:3, Facotr 0.460000, CurrentSaving:0.004098, TotalSaving:3247.597586, CumulativeSaving:3247.473691 00000003 9:21:24.074 [3760] ~~~[EnergySaving] CurrentPower:0.000000, EPU Staus:3, Facotr 0.000000, CurrentSaving:0.000000, TotalSaving:0.000000, CumulativeSaving:0.000000 00000004 9:21:28.162 [4092] Direct3D9: :====> ENTER: DLLMAIN(6d8da170): Process Attach: 00000ffc, tid=00000ff4 00000005 9:21:28.162 [4092] 00000006 9:21:28.162 [4092] Direct3D9: :====> EXIT: DLLMAIN(6d8da170): Process Attach: 00000ffc 00000007 9:21:28.162 [4092] 00000008 9:21:28.162 [4092] Direct3D9: (INFO) :Direct3D9 Debug Runtime selected. 00000009 9:21:28.162 [4092] 00000010 9:21:28.180 [4092] D3D9 Helper: Enhanced D3DDebugging disabled; Application was not compiled with D3D_DEBUG_INFO 00000011 9:21:28.840 [4092] Direct3D9: (INFO) :======================= Hal HWVP device selected 00000012 9:21:28.840 [4092] 00000013 9:21:28.840 [4092] Direct3D9: (INFO) :HalDevice Driver Style b 00000014 9:21:28.840 [4092] 00000015 9:21:28.840 [4092] Direct3D9: :DoneExclusiveMode 00000016 9:21:28.840 [4092] 00000017 9:21:28.841 [4092] Direct3D9: (INFO) :Using FF to VS converter 00000018 9:21:28.841 [4092] 00000019 9:21:28.841 [4092] Direct3D9: (INFO) :Using FF to PS converter 00000020 9:21:28.841 [4092] 00000021 9:21:29.081 [3760] Current Time 3385159, Last Input Time 3381680, Idle Time 00000022 9:21:29.082 [3760] ~~~[CpuPowerMonitor] value:d296 msb:fffffffa lsb:296 power 10.343750 00000023 9:21:29.082 [3760] ~~~[EnergySaving] CurrentPower:10.343750, EPU Staus:3, Facotr 0.460000, CurrentSaving:0.006609, TotalSaving:3247.604194, CumulativeSaving:3247.480300 00000024 9:21:29.083 [3760] ~~~[EnergySaving] CurrentPower:0.000000, EPU Staus:3, Facotr 0.000000, CurrentSaving:0.000000, TotalSaving:0.000000, CumulativeSaving:0.000000 00000025 9:21:34.088 [3760] Current Time 3390166, Last Input Time 3381680, Idle Time 00000026 9:21:34.088 [3760] ~~~[CpuPowerMonitor] value:d296 msb:fffffffa lsb:296 power 10.343750 00000027 9:21:34.089 [3760] ~~~[EnergySaving] CurrentPower:10.343750, EPU Staus:3, Facotr 0.460000, CurrentSaving:0.006609, TotalSaving:3247.610803, CumulativeSaving:3247.486908 00000028 9:21:34.089 [3760] ~~~[EnergySaving] CurrentPower:0.000000, EPU Staus:3, Facotr 0.000000, CurrentSaving:0.000000, TotalSaving:0.000000, CumulativeSaving:0.000000 00000029 9:21:39.096 [3760] Current Time 3395174, Last Input Time 3395158, Idle Time 00000030 9:21:39.097 [3760] ~~~[CpuPowerMonitor] value:d2c1 msb:fffffffa lsb:2c1 power 11.015625 00000031 9:21:39.097 [3760] ~~~[EnergySaving] CurrentPower:11.015625, EPU Staus:3, Facotr 0.460000, CurrentSaving:0.007038, TotalSaving:3247.617840, CumulativeSaving:3247.493946 00000032 9:21:39.098 [3760] ~~~[EnergySaving] CurrentPower:0.000000, EPU Staus:3, Facotr 0.000000, CurrentSaving:0.000000, TotalSaving:0.000000, CumulativeSaving:0.000000 00000033 9:21:39.636 [4092] MiyagiGuiWindow UnnamedSelectorWindow_47 created. 00000034 9:21:39.636 [4092] SelectorWindow UnnamedSelectorWindow_47 created. 00000035 9:21:39.639 [4092] MiyagiGuiWindow mainMenu init. 00000036 9:21:40.290 [4092] MiyagiGuiWindow UnnamedSelectorWindow_52 created. 00000037 9:21:40.290 [4092] SelectorWindow UnnamedSelectorWindow_52 created. 00000038 9:21:40.290 [4092] MiyagiGuiWindow loadMenu init. 00000039 9:21:42.212 [4092] MiyagiGuiWindow UnnamedProgressWindow_57 created. 00000040 9:21:42.212 [4092] SelectorWindow UnnamedProgressWindow_57 created. 00000041 9:21:42.212 [4092] MiyagiGuiWindow progressWindow init. 00000042 9:21:42.222 [4092] local sends message to serverLOAD_RESOURCE 00000043 9:21:42.222 [4092] server accepts message LOAD_RESOURCE 00000044 9:21:42.412 [4092] server sends message to clientLOAD_RESOURCE 00000045 9:21:42.412 [4092] local accepts ok message LOAD_RESOURCE 00000046 9:21:42.565 [4092] Direct3D9: (ERROR) :Need to call BeginScene before rendering. 00000047 9:21:42.568 [4092] 00000048 9:21:44.103 [3760] Current Time 3400182, Last Input Time 3400104, Idle Time 00000049 9:21:44.104 [3760] ~~~[CpuPowerMonitor] value:cb1b msb:fffffff9 lsb:31b power 6.210938 00000050 9:21:44.104 [3760] ~~~[EnergySaving] CurrentPower:6.210938, EPU Staus:3, Facotr 0.460000, CurrentSaving:0.003968, TotalSaving:3247.621808, CumulativeSaving:3247.497914 00000051 9:21:44.104 [3760] ~~~[EnergySaving] CurrentPower:0.000000, EPU Staus:3, Facotr 0.000000, CurrentSaving:0.000000, TotalSaving:0.000000, CumulativeSaving:0.000000 

Thank you

kubatp

20-04-2010 16:44:40

Hi Smiley,
one more question - when I use Modal GUI and click somewhere, this click is not "forwarded" to layers behind (so Mogre scene), which is great. I have a problem when I use default GUI. I have some buttons in default gui and when user clicks on this button, it correctly fires the mousepressed event of the button, but this click "bubbles" to Mogre scene as well.
Is this possible to bypass somehow?

smiley80

20-04-2010 19:03:56

ATM you can only check whether GUIManager.GetTopControl is null (i.e. cursor is not over a control) in your mouse event handler.

kubatp

21-04-2010 08:18:27

ATM you can only check whether GUIManager.GetTopControl is null (i.e. cursor is not over a control) in your mouse event handler.
Yes! This is exactly what I wanted. Thank you.

Have you found anything interesting in there?

kubatp

21-04-2010 15:27:38

Just a quick question, is it possible to change color of label (color of text) without creating new font by MiyagiSystem.ResourceManager.CreateTrueTypeFont?

smiley80

21-04-2010 19:56:50

Have you found anything interesting in there?
Nope. And I'm not able to recreate it yet.

Just a quick question, is it possible to change color of label (color of text) without creating new font by MiyagiSystem.ResourceManager.CreateTrueTypeFont?
In the lastest commit, I've moved the colour stuff from fonts to styles, so now you can do:
myLabel.TextStyle.ForegroundColour = Color.PapayaWhip;

Tubulii

24-04-2010 17:32:07

Hi smiley80,

You wrote:

In the Mercurial version:
myButton.TextureStyle.Texture = new Miyagi.Resources.Texture("myNewTexture.png");
would change the current texture of the button.

In this version there are no TextureStyle (and Texture).
When I replace the Texture(element) completely, the sprites etc. are null(but I cannot acces it because it is friend...)
This works, but is there a way to simply reload the this single texture(element)?
 Dim t As New Miyagi.Controls.Elements.TextureElement t = TargetInfo.Texture
Thank you

smiley80

24-04-2010 18:59:20

beta 4c:
myButton.Texture.FileName = "myNewTexture.png";

Tubulii

25-04-2010 15:35:35

I downloaded the mercurial version but until now I have more problems than before:
The "old" code does not work anymore and there are big differences between beta 4c and mercurial...

smiley80

25-04-2010 16:45:43

Skins:
1) Automatically:
this.miyagiSystem.ResourceManager.CreateSkin("MyButtonSkin", typeof(Miyagi.UI.Controls.Button), "Button", true);
Looks for file whose names begin with 'Button'. The filenames have to follow the skin naming conventions (same as beta 4c)

2) Manually:
Skin msBackground = Skin.Create("Background"); msBackground.SubSkins["Background"] = new Miyagi.Resources.Texture("Background.png"); //... this.miyagiSystem.ResourceManager.Skins.Add(msBackground);

3) From an XML file:
this.miyagiSystem.ResourceManager.CreateSkinFromXml(@"path\to\xml");
The XML Schema file is \Miyagi\Internals\Resources\Skin.xsd

TTFs:
this.miyagiSystem.ResourceManager.CreateTrueTypeFont("BlueHighwaySmall", "bluehigh.ttf", 12, 72);
Creates a normal font, 12 points size and 72 dpi resolution.

this.miyagiSystem.ResourceManager.CreateTrueTypeFont("Arial", "arial.ttf", 16, 96, FontStyle.Bold);
Creates a bold font, 16 points size and 96 dpi resolution.

By default, the created font texture contains all UTF-8 characters, if you need another range:
List<Couple<int>> myAsciiCodePoints = new List<Couple<int>> { new Couple<int>(32, 127) }; this.miyagiSystem.ResourceManager.CreateTrueTypeFont("Arial", "arial.ttf", 16, 96, FontStyle.Regular, myAsciiCodePoints );

Image fonts:
this.miyagiSystem.ResourceManager.CreateImageFont("MyImageFont", "MyImageFontTexture.png", myGlyphsDict);
'myGlyphsDict' is an IDictionary<char, RectangleF>, the RectangleF describes the uv coordinates of the char.

Tubulii

25-04-2010 19:07:21

Thank you smiley80,
This solved most of my problems(for now).
One last question: Do you have a ready skin file ,not only schema file, with both it would be easier to understand.

smiley80

25-04-2010 19:35:51

<?xml version="1.0" encoding="UTF-8"?> <Skin Name="EventButtonSkin" Type="Miyagi.UI.Controls.Button"> <SubSkins> <SubSkin Name="EventButtonSkin"> <Frames> <Frame> <FileName>gui1.png</FileName> <Duration>0</Duration> <UV> <X>0.125</X> <Y>0.5</Y> <Width>0.125</Width> <Height>0.03125</Height> </UV> </Frame> </Frames> </SubSkin> <SubSkin Name="EventButtonSkin.MouseLeave"> <Frames> <Frame> <FileName>gui1.png</FileName> <Duration>0</Duration> <UV> <Left>0.125</Left> <Top>0.53125</Top> <Right>0.25</Right> <Bottom>0.5625</Bottom> </UV> </Frame> </Frames> </SubSkin> </SubSkins> </Skin>
UV can either be "X, Y, Width, Height" or "Left, Top, Right, Bottom".
'Duration' is only of importance if you have multiple frames.

kubatp

27-04-2010 07:31:06

Hi Smiley,
I have found a bug.
When Control doesn't have the TextureStyle.Skin set (is null) the HitTest returns if the mouse position is within its size even the control is not displayed (visible = false).
SkinnedControlBase line 370. Try to not set skin and undisplay the control. HitTest will still pass.
Thank you

smiley80

28-04-2010 01:56:45

That has been fixed in rev 366.

Tubulii

01-05-2010 17:20:09

Hi,

how to disable the compositor effect on Miyagi?
(I know, this question is old, but the answer is outdated)

Thanks

smiley80

02-05-2010 13:56:15

this.guiCam = this.sceneMgr.CreateCamera("GuiCam"); this.guiViewport = this.window.AddViewport(this.guiCam, 10); this.guiViewport.SetClearEveryFrame(false); this.guiViewport.ShadowsEnabled = false; this.guiViewport.OverlaysEnabled = false; this.guiViewport.SkiesEnabled = false; this.guiViewport.SetVisibilityMask(0); ((MogreRenderManager)this.miyagiSystem.Backend.RenderManager).Camera = this.guiCam;
And you have to add a reference to 'Miyagi.Backend.Mogre.dll'.

kubatp

04-05-2010 16:00:58

Hi Smiley,
I have two questions if you dont mind:
1) I have material in Mogre using file in texture unit (let's say file.png). I would like to use the same file in Miyagi as a background for Panels, where I want to display just a part of this (I have UV of these parts). I use it the way, that I create new skin with this file and create the panels this way:
 Miyagi.UI.Controls.Panel result = realresult.CreateChildControl<Miyagi.UI.Controls.Panel>(name, size, new Point(0, 0)); Skin skin = MiyagiSystem.ResourceManager.Skins[materialName]; result.TextureStyle.Texture = new Texture(skin.SubSkins[materialName].Frames[0].FileName, new RectangleF(fromU, fromV, toU - fromU, toV - fromV));
The question is - is this texture file.png loaded to memory only once, or it's loaded once for Mogre and once for every panel created this way?

2) I would like to use button as radiobutton - I have four buttons and when I click on one, it should stay "down" until I click on something else. I can handle all this on my own (in my code), the only question is, how to keep the button "pressed", even I hover over the button or move out the button?

thank you

smiley80

04-05-2010 18:21:05

1) The texture is loaded only once.

2) Try the ".Focused" subskin. If you don't specify ".Focused.MouseDown/MouseUp...", it should stay on ".Focused" after the control has been clicked till another control gets the focus.

kubatp

05-05-2010 18:45:14

1) The texture is loaded only once.
Great!

2) Try the ".Focused" subskin. If you don't specify ".Focused.MouseDown/MouseUp...", it should stay on ".Focused" after the control has been clicked till another control gets the focus.
Actually it has MouseDown and MouseUp defined. This Focus is not a bad idea, but I need to have two sets of controls actived, which cannot work with Focus right? When I click on one group, it blurs the other one.

What about define set of eventhandlers for each button, which return the "down" status after every skin change. Would this work? I have tried it, but it's not perfect. Which events should be bound?

Thank you

smiley80

05-05-2010 23:26:07

If you don't need the buttons to react to input after they have been clicked, use the ".Disabled" subskin. I.e. on click you disable the 'clicked' group and enable the other group.

But I'll add a method to SkinnedControlBase that will be responsible for texture changes, and which you can override if you want to block changes.

kubatp

10-05-2010 16:03:46

Hi Smiley,
yes .Disabled works great.

I have just downloaded the latest and I was surprised by all the changes done. I have no doubt, that you have very good reason to do this, but I am just curious why all these methods CreateChildControl, CreateSkin, CreateCursor, etc... have been removed? Should Miyagi consumer keep all the refences on his own since now?

smiley80

10-05-2010 19:57:57

CreateControl/CreateGUI had to have a 'new()' constraint, so they weren't usable for every possible Control/GUI.
You have to use the constructor and add it to the corresponding collection.

The Cursor constructor doesn't need the GUIManager reference anymore, so there's no need for the 'CreateCursor' method.
You have to assign an instance of Cursor to the GUIManager.Cursor property.

CreateSkin/Create*Font methods are now in 'MiyagiSystem.ResourceFactory', but they don't store a reference to the created resource anymore.
Meaning, you have to keep track of that resource till you assign it to a style property.

kubatp

11-05-2010 17:37:08

Hi Smiley,
that makes sense.
I saw in track, that you have added new component - combobox. Is it possible to actually see it working? I know there is this example Samplegui, but I am not sure how to get it working, moreover there are no images.

What exactly has to be defined to see combobox?
Thank you

smiley80

12-05-2010 08:51:04

Currently, the dropdown is only shown when mouse location is greater than the combobox width minus the scrollbar width, otherwise it's interpreted as a click on the textbox part. In the next push this will change and the new ComboBox.TextBoxRectangle property will control that.

kubatp

12-05-2010 14:10:47

Hi Smiley,
the HitTest problem again - shouldn't in ControlBase.cs line 1610 be if (!this.Visible || this.opacity < OpacityThreshold) instead of if (!this.Visible && this.opacity < OpacityThreshold)
Currently it finds the hidden control and performs this hit test on it, which is incorrect, right?

Another thing in ListBoxElement line 219. I guess there should be
if (value != -1) this.SelectItems(this.Owner.Items[value]);

smiley80

12-05-2010 20:58:10

Thanks, fixed.

andyhebear1

05-06-2010 02:40:00

Miyagi 1.0 beta 4c - GUI?
why i render use system.window.forms.panel,it cann't to show ui in this?

smiley80

05-06-2010 11:18:28

I'm not exactly sure what you're trying to say.

kubatp

08-06-2010 16:14:28

I guess andyhebear1 tries to render the GUI in windows.form.panel, right?

Tubulii

26-06-2010 18:06:46

Hi smiley80 ,

Could you please explain how to use the Winform plugin?

Thank you

smiley80

26-06-2010 19:33:43

this.miyagiSystem.PluginManager.LoadPlugin(@"path\to\Miyagi.Plugin.Input.WinForms.dll", ogrePanel);
Where ogrePanel is a System.Windows.Forms.Control that embeds the render window.

Kohedlo

27-06-2010 23:51:16

When i want change texture of Panel-control after panel created - is no work. Is texture assign only with material when i create the panel.

smiley80

28-06-2010 13:13:16

For 1.2 (the repo version):
panel.BackgroundStyle.Texture = new Texture("myNewTexture.png");
For 1.0:
panel.Texture.FileName = "myNewTexture.png";
will temporary change the current texture of the panel.

You can change the texture permanently through Panel.MaterialScheme.Textures (1.0) / Panel.BackgroundStyle.Skin.SubSkins (1.2).
Though this will affect all controls which use that MaterialScheme/Skin.

Both require a call to GuiManager.Update to take effect.

coco

02-07-2010 10:39:09

Hello,

I've just upgraded Miyagi from subversion (lol, after what... around halk a year, so many changes, very impressive...)
Do you mind explaining the RelativeRectangle setting of the ControlBase to me? I was trying to test it out, but kept on getting null exception from ControlBase.MiyagiSystem?

This was the code that I used, in case it's of any help:

 Panel pan1 = new Panel("panel1") { BackgroundStyle = bgStyle, RelativeRectangle = new RectangleD(0,0,0.5,0.5) }; 

smiley80

02-07-2010 16:00:43

Yeah,it'll only work when the control has been added to a GUI, which itself has been added to the GUIManager.
Use the 'Rectangle' property instead (e.g. Rectangle = new Rectangle(0,0,screenWidth/2,screenHeight/2)).
'RelativeRectangle' will be removed in the next push.

Beauty

03-07-2010 12:56:21

Is there a Miyagi exaple in the MogreSDK?
This would be great!

coco

05-07-2010 15:23:45

Thanks for the reply, using Rectangle for everything, and seems to be working great

I have a question concerning the ListBox scrollbar, I've tried renaming the images from base.ScrollBar to base.VScrollBar, and setting the thumb size and orientation, but haven't been able to get it to show, any pointers will be very appreciated.

Another issue I've encounterd is the font. This font was made using BlueHighway font, size 16 and resolution 72. There are extra dash underneath some characters, possible something to do with the glyph coordinate including the character below it?

[attachment=0]Untitled.jpg[/attachment]

smiley80

05-07-2010 19:58:57

I have a question concerning the ListBox scrollbar, I've tried renaming the images from base.ScrollBar to base.VScrollBar, and setting the thumb size and orientation, but haven't been able to get it to show, any pointers will be very appreciated.

You have to set the width through ScrollBarStyle.Extent; atm it's zero by default.
You don't have to set the thumb size or orientation.

Another issue I've encounterd is the font. This font was made using BlueHighway font, size 16 and resolution 72. There are extra dash underneath some characters, possible something to do with the glyph coordinate including the character below it?

Please check whether that still happens in the latest revision.

coco

06-07-2010 09:10:18

Please check whether that still happens in the latest revision.

Thank you so much smiley80 for the quick response, I've got the scrollbar working now. However, sorry to be a bother again, although the font is better now, some characters still have some issues (seems to be only with lower case b, e, y and z)

[attachment=0]Untitled.jpg[/attachment]

coco

07-07-2010 11:47:00

Hi again,

I'm trying to use GUIManager.ResetLocationAndSize() when resizing the window (after a call to update MiyagiSystem.ScreenResolution). The location and size of all controls do get placed in the correct place, however, the Skin still get distored by the screen size. Is there a way around this?

Thanks

smiley80

07-07-2010 18:30:10

However, sorry to be a bother again, although the font is better now, some characters still have some issues (seems to be only with lower case b, e, y and z)

Try setting the resolution to 96 and the size to 12.
Btw. it works on my machine™.

I'm trying to use GUIManager.ResetLocationAndSize() when resizing the window (after a call to update MiyagiSystem.ScreenResolution). The location and size of all controls do get placed in the correct place, however, the Skin still get distored by the screen size. Is there a way around this?

Currently you have to destroy and recreate the gui.
But correctly handling screen resolution changes is next on my to-do list.

coco

08-07-2010 08:28:29

Try setting the resolution to 96 and the size to 12.
Btw. it works on my machine™.

Thank you. Strangely enough, it does help when I changed the setting as you've said, even if the old setting still refuse to behave nicely for me.

Munku

12-07-2010 02:01:44

Hey all, I'm pretty new to Mogre and thus Miyagi. I have an interesting problem for you.

I am using Mogre and MOIS (obviously), with Miyagi. I have defined my MOIS input
before initializing Miyagi, and everything works but when I try to initialize Miyagi
I get this exception:

System.MissingMethodException was unhandled
Source=DawnEngine
StackTrace:
at DawnEngine.Heavy.Engine.Initialize() in F:\game\DawnEditor\DawnLite\Heavy\Engine.cs:line 248
at Dawn.Game.Initialize() in F:\game\Dawn\Dawn\Game.cs:line 32
at Dawn.Program.Main() in F:\game\Dawn\Dawn\Program.cs:line 22
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
InnerException:

Please note that I have basically copied and pasted the source code from the demo (as a test) into
its own class. THe code is simply this (both the mouse and the keyboard are MOIS.mouse/keyboard objects)

GuiManager.Singular.Initialize(Input._Mouse,Input._Keyboard,true);

kubatp

12-07-2010 17:44:16

Hi Smiley,
I am not sure if this was already solved or not, but is it possible to use atlas textures with Miyagi (i.e. use the same image for more different controls, where every uses just some UV parts of it)?
Thank you

smiley80

12-07-2010 18:50:30

@Munku:
The latest binary release has been compiled against an older version of Mogre(1.6.2).
You'll have to replace the included Mogre dll with the latest one and recompile from source.

@kubatp:
Yes, that's possible:
Manually:
 mySkin.SubSkins["mySkin"] = new Texture("atlas.png", RectangleF.FromLTRB(0, 0, 0.5f, 0.5f)); mySkin.SubSkins["mySkin.Focused"] = new Texture("atlas.png", RectangleF.FromLTRB(0.5f, 0.5f, 1, 1)); // and so on
The RectangleF represents the uv coordinates.

Or from an XML file:
<Skin Name="EventButtonSkin" Type="Miyagi.UI.Controls.Button"> <SubSkins> <SubSkin Name="EventButtonSkin"> <Frames> <Frame> <FileName>gui1.png</FileName> <Duration>0</Duration> <UV> <X>0.125</X> <Y>0.5</Y> <Width>0.125</Width> <Height>0.03125</Height> </UV> </Frame> </Frames> </SubSkin> </SubSkins> </Skin>
Instead of "X,Y,Width,Height" you can also use "Left,Top,Right,Bottom".

kubatp

14-07-2010 15:11:46

Hi Smiley,
thank you for the answer. I am trying to merge all the images to one image with all Miaygi controls and I am experiencing two issues:
1) When I set the subskins and their rectangles, I have to manually call something similar to Skin.FillUpEvents to correctly set all the existing events. This is ok, it is not difficult to create it on my own, however it would be handy to let MIYAGI framework handling this.
2) I cannot get BorderStyle.UV working with Atlas. Let's say I want to use texture, which is defined inside atlas texture and set its borders, how to do it? I am not sure I understand this UV correctly. When I used the texture just for borders (XXX.border), I defined the area in image, which is not used by borders, right? So for example
 +----------------------+ | | | +---------+ | | +---------+ | | | +----------------------+ 
I set UV to RectangleF(0.25f, 0.25f, 0.5f, 0.5f). So it is using everything except the middle area (which is actually content background). How to do something similar with Atlas?

smiley80

14-07-2010 18:41:37

1)
Yeah, i'll remove those method from Skin and just let the controls/cursor handle missing subskins.

2)
The border uv coords are independent from the texture uv coords, so it still would be 'RectangleF(0.25f, 0.25f, 0.5f, 0.5f)'.
But there was a bug in the offset calculation, should be fixed now.

nico008

14-07-2010 20:25:49

Hi guyz
Where can I find required binary files to run the latest Miyagi demo?
For example I can't find CursorSkin.xml

smiley80

14-07-2010 22:14:25

Unzip the attached file into the bin folder.
(Background.png has been replaced with a smaller image to reduce upload size.)

nico008

14-07-2010 23:17:15

Thanks man, but I still miss some files : sepia.cg, probably some other

Also, in my own project, I don't know what I could use to replace :
oldZOrder = itemIcon.ZOrder; gui.pickedItem.ZOrder = oldZOrder; itemIcon.ZOrder = 99999;

and :

private void ScrollToBottom() { if (ListBoxStyle.ItemSize.Height == 0) return; if (Items.Count <= TotalAvailableHeight / ListBoxStyle.ItemSize.Height) SelectedIndex = 0; else SelectedIndex = Items.Count - 1; if (SelectedIndex < TopItemIndex) TopItemIndex = SelectedIndex; else if (SelectedIndex > TopItemIndex + TotalAvailableHeight / ListBoxStyle.ItemSize.Height - 1) TopItemIndex = SelectedIndex - TotalAvailableHeight / ListBoxStyle.ItemSize.Height + 1; }

and : TextBox.TextStyle.AreaSize + TextBox.CaretStyle

Also, strange you removed ResourceManager, it was much easier to use than FactoryManager + List + ToDictionnary + Dictionnary + ...

In anycase, good job!!!!
You have done a big lot of things

smiley80

15-07-2010 00:40:56

Thanks man, but I still miss some files : sepia.cg, probably some other
Just remove the 'GpuPrograms' element from CursorSkin.xml.

Also, in my own project, I don't know what I could use to replace :
oldZOrder = itemIcon.ZOrder;
gui.pickedItem.ZOrder = oldZOrder;
itemIcon.ZOrder = 99999;

Something like:
oldZOrder = parentControlCollection.IndexOf(itemIcon); gui.Controls.ChangeIndex(oldZOrder, pickedItem); itemIcon.BringToFront();
But make sure you update to the latest revision.

private void ScrollToBottom()

listbox.TopItemIndex = listbox.Items.Count;
ListBox.ScrollBarStyle
TextBox.CaretStyle

ListBox.ListBoxStyle.ScrollBarStyle TextBox.TextBoxStyle.CaretStyle
TextBox.TextStyle.AreaSize

Also, strange you removed ResourceManager, it was much easier to use than FactoryManager + List + ToDictionnary + Dictionnary + ...

Holding references to the resources was unnecessary. But you can of course create your own helper class.

nico008

15-07-2010 13:05:56

Thank you for all these answers

1) A little bug I thing :

when I set myTextBox.Visible = false; -> the caret is not hidden and keeps on blinking

2) I want to move camera when I click and move mouse -> it's ok. But I don't want the camera to move when I click on a GUI window. You see what I mean?
How can I easily dectect that the mouse click was not on a GUI window?

3) "listbox.TopItemIndex = listbox.Items.Count;" -> it scroll too much.

 private void ScrollToBottom() { int maxVisibleLinesCount = TotalAvailableHeight / ListBoxStyle.ItemSize.Height; TopItemIndex = Items.Count - maxVisibleLinesCount; } 
how can I get maxVisibleLinesCount ?
Note : it is not the same as VisibleItemCount
edit : thanks for you latest change in MIYAGI
but you said "added ListBoxStyle.MaxVisibleItems", while it is "added ListBoxElement.MaxVisibleItems" and I had to set it public and not private then it works

smiley80

15-07-2010 18:12:05

when I set myTextBox.Visible = false; -> the caret is not hidden and keeps on blinking

fixed

2) I want to move camera when I click and move mouse -> it's ok. But I don't want the camera to move when I click on a GUI window. You see what I mean?
How can I easily dectect that the mouse click was not on a GUI window?

InputManager.FocusedControl (latest revision) or GUIManager.GetTopControl are null.
The former is faster and ignores disabled controls.

3) "listbox.TopItemIndex = listbox.Items.Count;" -> it scroll too much.
 private void ScrollToBottom() { int maxVisibleLinesCount = TotalAvailableHeight / ListBoxStyle.ItemSize.Height; TopItemIndex = Items.Count - maxVisibleLinesCount; } 

Shouldn't make any difference. Both should show the last item at the bottom.

nico008

16-07-2010 01:46:00

Ok Thanks.

I'm trying to use Miyagi with SharpInputSystem in linux, but doesn't work currently.

 Sdl.SDL_Init(Sdl.SDL_INIT_EVERYTHING); SIS.ParameterList pl = new SIS.ParameterList(); object windowHnd; windowHnd = window.GetCustomAttribute("WINDOW"); SIS.Parameter param = new SIS.Parameter("WINDOW", windowHnd.ToString()); pl.Add(param); SIS.Keyboard inputKeyboard; SIS.InputManager inputManager; SIS.Mouse inputMouse; inputManager = SIS.InputManager.CreateInputSystem(pl); inputKeyboard = inputManager.CreateInputObject<SIS.Keyboard>(true, ""); EventHandler e = new EventHandler(); inputKeyboard.EventListener = e; inputMouse = inputManager.CreateInputObject<SIS.Mouse>(true, ""); inputMouse.EventListener = e;

Is that correct? Note that I doesn't work either in Windows

edit : with
 Sdl.SDL_Init(Sdl.SDL_INIT_VIDEO); Sdl.SDL_SetVideoMode(100, 100, 32, Sdl.SDL_OPENGL | Sdl.SDL_HWPALETTE);
it detect keyboard inputs but then the main window doesn't render anymore

smiley80

16-07-2010 06:44:29

I haven't tried SDL, but with DirectX you have to do:
SIS.ParameterList pl = new SIS.ParameterList(); IntPtr windowHnd = (IntPtr)this.window["WINDOW"]; pl.Add(new SIS.Parameter("WINDOW", windowHnd)); inputManager = SIS.InputManager.CreateInputSystem(pl); inputKeyboard = inputManager.CreateInputObject<SIS.Keyboard>(true, string.Empty); inputMouse = inputManager.CreateInputObject<SIS.Mouse>(true, string.Empty); inputMouse.MouseState.Width = window.Width; inputMouse.MouseState.Height = window.Height; this.miyagiSystem.PluginManager.LoadPlugin("..\\..\\Plugins\\Miyagi.Plugin.Input.SharpInputSystem.dll", inputKeyboard, inputMouse);

nico008

16-07-2010 09:34:20

Hi.
Strange, in windows, at line "inputManager = SIS.InputManager.CreateInputSystem(pl);" it says SDL not initialized already. If I remove Tao.Sdl.dll and SDL.dll then it says Tao.Sdl is missing. Tought I don't ask for SDL :s
Anyway, I need SDL for linux, but I can't get it working with Axiom

nico008

16-07-2010 13:01:51

Well I give up after spending like 10 hours without any result in linux.
If you are able to use Miyagi with input in linux (ubuntu or whatever), please let me know, so my game will be playable on both Linux and windows

See you later

mikael

17-07-2010 12:06:14

Hi.

I cant download miyage from mercurial repo. I have tried "hg clone" several days now, it loads
it some time and then aborts.

F:\Mogre>hg clone http://miyagi.hg.sourceforge.net:8000/h ... agi/miyagi
destination directory: miyagi
requesting all changes
transaction abort!
rollback completed
abort: An existing connection was forcibly closed by the remote host

Btw, how do I update mogreaddons?

never used hg before

-mjt

smiley80

17-07-2010 13:37:13

@nico008
Input would be an easy thing if you could host the render window in a GTK widget or WinForm on Linux. But it seems the OpenTK renderer doesn't have that ability atm.

@mikael
That's strange. I don't have any problems cloning the repo. If you have a desktop firewall running, try deactivating it.
Updating: 'hg pull -u' from the dir that contains the '.hg' folder.

There's also a TortoiseSVN-like Explorer extension: http://tortoisehg.bitbucket.org/

mikael

17-07-2010 21:50:48

And thanks for the hg updating info.

-mjt

smiley80

20-07-2010 16:56:50

Input would be an easy thing if you could host the render window in a GTK widget or WinForm on Linux. But it seems the OpenTK renderer doesn't have that ability atm.
Okay, I stand corrected. You can use an external OpenTK IWindowInfo.

Using a GTK widget on Windows:
 [DllImport("user32.dll", EntryPoint="FindWindow", SetLastError = true)] static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName); //... this.root.Initialize(false); Gtk.Application.Init(); Gtk.Window w = new Gtk.Window("test"); w.SetSizeRequest(800, 600); w.AddEvents((int)Gdk.EventMask.AllEventsMask); w.Show(); var wi = OpenTK.Platform.Utilities.CreateWindowsWindowInfo(FindWindowByCaption(IntPtr.Zero, "test")); // CreateX11WindowInfo on Linux var npl = new NamedParameterList(); npl.Add("externalWindowInfo", wi); this.window = this.root.RenderSystem.CreateRenderWindow("test", 800, 600, false, npl); //... this.miyagiSystem.PluginManager.LoadPlugin("..\\..\\Plugins\\Miyagi.Plugin.Input.GTK.dll", w); //... Gtk.Application.Run();
I haven't tested it on Linux yet, there might be an issue with keyboard inputs.

kubatp

21-07-2010 18:08:26

Hi Smiley,
I have possibly found a bug in ProgressBar. When an atlas texture is used for the control (including .Bar texture) and the progressBar.Value is changed, it incorrectly sets the UV to [0,0] - [1,1] which is wrong when atlas is used.
I might be wrong, but I would say the problem is in this.Sprite.SetUV(uvRect); line 264 BarElement.cs. As I said, I might be wrong, but it seems like when the progress bar is initialized the first time, it is ok and when the Value is changed, it displays (on the bar place) the whole atlas texture.
Thank you.

kubatp

21-07-2010 18:22:08

And one more question - is there a way to have the tooltip texture in atlas as well? I haven't found a way to do it without actual Miyagi code change.

smiley80

21-07-2010 20:34:40

Hi Smiley,
I have possibly found a bug in ProgressBar. When an atlas texture is used for the control (including .Bar texture) and the progressBar.Value is changed, it incorrectly sets the UV to [0,0] - [1,1] which is wrong when atlas is used.

Fixed for 'BarMode.Continuous', 'BarMode.Blocks' will not behave correctly atm.

And one more question - is there a way to have the tooltip texture in atlas as well? I haven't found a way to do it without actual Miyagi code change.
You can now use the static ToolTipElement.DefaultSkin property.

Beauty

22-07-2010 10:55:34

Miyagi seems to be a great GUI system.
This (very long) thread contains many useful information.
It would be good when somebody adds such useful information to the Miyagi wiki page.
Especially code snippets are insteresting. We also could add information to a FAQ section.
This especially would help newcomers.

Also on the wiki page could be added one or more video links to demonstrate the functionality.

nico008

22-07-2010 21:49:59

Hi.
Thanks for GTK plugin.
Just I can't find any FindWindowByCaption equivalent for linux.
Any idea?

Note : Miyagi is just the best GUI system I have ever seen
smiley80 rox!

smiley80

23-07-2010 09:52:06

Something like this (untested):
public static IWindowInfo GetWindowInfo(Gtk.Widget widget) { IntPtr display = gdk_x11_drawable_get_xdisplay(widget.GdkWindow.Handle); int screen = widget.Screen.Number; IntPtr handle = gdk_x11_drawable_get_xid(widget.GdkWindow.Handle); IntPtr root = gdk_x11_drawable_get_xid(widget.RootWindow.Handle); IntPtr visual = gdk_x11_visual_get_xvisual(widget.GdkWindow.Visual.Handle); return OpenTK.Platform.Utilities.CreateX11WindowInfo(display, screen, handle, root, visual); } [DllImport("libgtk-x11-2.0")] private static extern IntPtr gdk_x11_visual_get_xvisual(IntPtr gdkVisual); [DllImport("libgtk-x11-2.0")] private static extern IntPtr gdk_x11_drawable_get_xid(IntPtr gdkWindow); [DllImport("libgtk-x11-2.0")] private static extern IntPtr gdk_x11_drawable_get_xdisplay(IntPtr gdkDrawable); 

nico008

23-07-2010 11:12:21

Thanks but it will not compile in my ubuntu 10.04
No overload for method 'CreateX11WindowInfo' takes 5 arguments

In the assembly browser, in OpenTK.Platform.Utilities, I can only see as similar :
 IWindowInfo CreateWindowInfo(GraphicsMode, Control) IWindowInfo CreateWindowInfo(GraphicsMode, IntPtr) 

I tryed CreateWindowInfo(new OpenTK.Graphis.GraphicsMode(), handle) or with display.
Both compile but crash when running that line.
Debug info is pretty crappy so I won't past it unless you ask me.
Maybe the OpenTk.dll I'm using is not the good one? Where can I find the good one?
Or maybe you could upload a whole project, with required libs included?

smiley80

23-07-2010 12:03:59

Oh right, CreateX11WindowInfo is new in version 1.0.
You have to recompile the svn truck of Axiom against the 1.0 branch of OpenTK.

kubatp

23-07-2010 16:23:39

Hi Smiley,
thank you for those fixes. All works as expected. I am wondering about one thing - is it possible to use different .Border UV for MouseEnter, MouseDown, Focused, etc...?

Currently I can define SkinName, SkinName.Border, SkinName.MouseEnter, etc... Is it possible to do something like SkinName.MouseEnter.Border ? I cannot get this working.
Thank you

smiley80

26-07-2010 08:02:36

You can override the appropriate event handler and set the BorderElement texture manually.
I'm thinking about allowing Mouse* skins for thumbs and scrollbars, not sure about borders, though.

kubatp

26-07-2010 08:13:37

If I can make my point, I would definitely go for borders (but not because I currently need it). Usually when mouse hovers over the control or user clicks on the control, borders are highlighted somehow. The middle part of control is sometimes changed as well, but borders are changed in most of the cases.

coco

26-07-2010 10:14:27

Hello smiley,

Just updated to the latest revision. Thank you so much for the screen resize fix

I've got some questions, firstly, with the removal of ItemSize from the ListBox.ListBoxStyle, is the number of items visible in the ListBox now depends entirely on MaxVisibleItems?
Secondly, for the screen resize, I've noticed that all controls are scaled in proportion to the screen size. Would it be helpful to add an option to keep the control size constant regardless of screen size?

smiley80

26-07-2010 12:12:28

I've got some questions, firstly, with the removal of ItemSize from the ListBox.ListBoxStyle, is the number of items visible in the ListBox now depends entirely on MaxVisibleItems?

Yes, but I'll probably add a 'concurrent' ItemsHeight property.

Secondly, for the screen resize, I've noticed that all controls are scaled in proportion to the screen size. Would it be helpful to add an option to keep the control size constant regardless of screen size?

In the latest revision, you can do the following:
 myGui.HandleScreenResolutionChanges = false; window.Resize(320, 240); miyagiSystem.ScreenResolution = new System.Drawing.Size(320, 240); myGui.ForceRedraw();

coco

27-07-2010 21:45:06

Thank you so much for the update Smiley! All of the screen resizing works brilliantly now

coco

29-07-2010 15:29:44

Sorry again, but for multiline text, is there any character/s that are used for line break? Like "\n"?

Furthermore, how exactly do you make a panel/textbox scrollable?

Thank you

smiley80

29-07-2010 16:03:05

Sorry again, but for multiline text, is there any character/s that are used for line break? Like "\n"?

Environment.NewLine

Furthermore, how exactly do you make a panel/textbox scrollable?

For panels, you have to define the following subskins:
SkinName.VScrollBar SkinName.VScrollBar.Thumb SkinName.HScrollBar SkinName.HScrollBar.Thumb SkinName.ScrollBarCorner
and set VScrollBarStyle.Extent and HScrollBarStyle.Extent to something larger than 0.

Textboxes should scroll when the text size exceeds the width (it's buggy for multiline text atm).

nico008

30-07-2010 10:02:41

Oh right, CreateX11WindowInfo is new in version 1.0.
You have to recompile the svn truck of Axiom against the 1.0 branch of OpenTK.

I'm not able to recompile Axiom Core with MonoDevelop 2.4 on linux.
Only the Axiom 2010 solution opens without error then when I compile, it says
The compiler appears to have crashed. Check the build output pad for details.
Unhandled Exception : System.NotSupportedException: Operation is not supported.
at System.Reflection.MonoGenericClass.GetCustomAttributes(System.Type.attributeType, Boolean inherit)
...
(+ 77 warnings)

Any idea?
Do you already have the right ones binaries?

Thanks

smiley80

30-07-2010 10:22:16

nico008

30-07-2010 11:16:20

Thanks.
It's better and better.
But not yet working

It crash when executing :
window = root.RenderSystem.CreateRenderWindow("test", 800, 600, false, npl);
it says :
** (./YAMORPAG.exe:4542): WARNING **: The class Axiom.Scripting.IPropertyCommand2 could not be loaded, used in Axiom, Version=0.8.0.0, Culture=neutral, PublicKeyToken=null

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
at Axiom.Graphics.Material.set_LodStrategy (Axiom.Core.LodStrategy value) [0x00000] in <filename unknown>:0
at Axiom.Graphics.Material.CopyTo (Axiom.Graphics.Material target, Boolean copyUniqueInfo) [0x00000] in <filename unknown>:0
at Axiom.Serialization.MaterialSerializer.ParseMaterial (System.String parameters, Axiom.Serialization.MaterialScriptContext context) [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
at Axiom.Serialization.MaterialSerializer.InvokeParser (System.String line, Axiom.Collections.AxiomCollection1 parsers) [0x00000] in <filename unknown>:0
at Axiom.Serialization.MaterialSerializer.ParseScriptLine (System.String line) [0x00000] in <filename unknown>:0
at Axiom.Serialization.MaterialSerializer.ParseScript (System.IO.Stream stream, System.String groupName, System.String fileName) [0x00000] in <filename unknown>:0
at Axiom.Graphics.MaterialManager.ParseScript (System.IO.Stream stream, System.String groupName, System.String fileName) [0x00000] in <filename unknown>:0
at Axiom.Core.ResourceGroupManager._parseResourceGroupScripts (Axiom.Core.ResourceGroup grp) [0x00000] in <filename unknown>:0
at Axiom.Core.ResourceGroupManager.InitializeAllResourceGroups () [0x00000] in <filename unknown>:0
at YAMORPAG.YGraphics.LoadResources () [0x00000] in <filename unknown>:0
at YAMORPAG.YGraphics.Setup () [0x00000] in <filename unknown>:0
at YAMORPAG.YGraphics..ctor (YAGM.YClientPreferences prefs, YAGM.YObjectsManager objectsManager, YAGM.YClient client) [0x00000] in <filename unknown>:0
at YAMORPAG.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

Maybe I'm doing something wrong.
If you have time, making a working Miyagi demo with GTKInput for linux would be great!

See you later

coco

02-08-2010 09:51:06

Thank you for your reply. For the panel scroll bar, I've tried defining the subskins as you've said and set VScrollBarStyle.Extent to be more than zero:

 var panel = new Panel("VScrollPanel") { BackgroundStyle = {Skin = panelSkin}, Size = new Size(560, 200), Location = new Point(20, 40), TextStyle = { Multiline = true, Alignment = Alignment.TopLeft, ForegroundColour = lightGreen, Offset = new Point(8, 0), }, VScrollBarStyle = {Extent = 10}, }; 

If I set VScrollBarStyle.AlwaysVisible to true, then I can see the scroll bar, however, I couldn't get the scrolling to work even if the text or the child control goes over the height of the panel.
I've also tried to use the horizontal scroll bar with long line of text, but also couldn't get that to work either.

Any suggestion for this? Thanks again for any reply

smiley80

02-08-2010 10:46:01

That should work for child controls.
But it won't work for the panel's text. For that, you'll need to add a label, that resizes itself when the text changes, to the panel.

coco

02-08-2010 12:59:22

That should work for child controls.
But it won't work for the panel's text. For that, you'll need to add a label, that resizes itself when the text changes, to the panel.

Thank you, finally got it to work.

Is there a way to force the scroll bar to update? Since everytime I update the text, the panel must get focused (?) before the scroll bar is updated (I've tried using Update and ForceRedraw, but have been unsuccessful so far...)

smiley80

02-08-2010 13:36:33

Should be fixed in the latest revision. Now, it updates the scrollbars automatically when the size of a child changes.

kubatp

26-08-2010 17:08:49

Hi Smiley,
I am experiencing small issue with tooltip. When I have a panel and on this panel is another panel and inside this is button, I cannot make the tooltip works neither for the inner panel or button. It seems like the updateCore of the tooltip element is called only for the parent panel, not for the nested one (or button).
Thank you

smiley80

27-08-2010 14:21:32

Sorry, but I can't reproduce that. It works as expected for me.
Edit:
Okay, I stumbled upon that issue today; should be fixed now.

coco

31-08-2010 10:35:00

Hello smiley,

Not sure if this was intended or not, but for the DropDownList, if the drop down area is beyond the bounds of the parent (i.e beyond parent height), the drop down area is still shown. However, it seems that the items are not selectable?

smiley80

31-08-2010 11:30:07

The former is intended, the latter has been fixed.

coco

31-08-2010 14:41:25

Thank you for the fast reply and update. I've noticed that GUI.HandleScreenResolutionChanges has been removed. Are there any replacement for this?

smiley80

31-08-2010 15:38:51

Yeah, for now you have to resize it manually after you changed the size of a window/viewport.

If you want to resize all GUI controls proportional to a resized window:
Gui.Resize((double)newSize.Width / oldSize.Width, (double)newSize.Height / oldSize.Height);
If they should keep their dimensions:
Gui.ForceRedraw();

kubatp

31-08-2010 16:32:38

Hi Smiley,

A first chance exception of type 'System.InvalidCastException' occurred in Miyagi.Backend.Mogre.dll
Additional information: Object type Miyagi.Common.Rendering.MogreViewport cannot be cast to Mogre.Viewport.

smiley80

31-08-2010 16:44:09

fixed

kubatp

01-09-2010 08:34:22

Hi Smiley,
the exception is not thrown anymore, however I am still experiencing the problem with tooltip. I know it would be the best to provide an example, when is this happening, but I am not sure if it will change anything. It is as simple as I said. If you want, I can try to extract the code which is related to these controls.

coco

01-09-2010 08:35:55

Hi smiley

Sorry to bother you again, about the resizing, but I've tried using Gui.ForceRedraw() as you've said, but all controls still seem to be resized to the same proportional as the new size of the window? Even though I have not called Gui/GuiManager.Resize anywhere.

smiley80

01-09-2010 10:26:10

ForceRedraw didn't update the viewport size, that's fixed in the latest revision.

WarehouseJim

08-09-2010 12:34:49

Hi Smiley80,

When I replace a very long string in a TextBox, longer than can be viewed on screen, with a short one (as part of select all-> paste), I then set TextBox.CaretLocation=0 to try to move to the start of the text, but the text doesn't become visible (it's off to the left). Would it be possible to make TextBoxElement.TextScrollOffset a public property of TextBox, or is there a better way of doing it?

thanks

smiley80

08-09-2010 14:03:15

Fixed in the latest revision. TextScrollOffset is set back to 0 if you change the text through the Text property.

Tubulii

11-09-2010 20:35:39

Hi,

In the lastest version loadtexture and unloadtexture are removed. Are there any anternatives?

Thanks

smiley80

11-09-2010 21:33:42

foreach (var subskin in mySkin.SubSkins) { foreach (var frame in subskin.Value.Frames) { TextureManager.Singleton.Load(frame.FileName, ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME).Dispose(); } }
foreach (var subskin in mySkin.SubSkins) { foreach (var frame in subskin.Value.Frames) { TextureManager.Singleton.Unload(frame.FileName); } }

Beauty

13-09-2010 13:50:52

smiley80

13-09-2010 14:11:19

It only disposes the pointer to the resource.

Beauty

13-09-2010 14:50:30

Oh, right ... now I remember. It's similar to the materials.

What would happen when somebody forget to dispose?
Will it be disposed by the garbage collector automatically or will the pointer stay in the memory until the applications close?

smiley80

13-09-2010 16:43:09

What would happen when somebody forget to dispose?
You might get random InvalidCastExceptions if you try to cast the ResourcePtr to its actual type.

kubatp

17-09-2010 15:36:46

Hi Smiley,
I am just wondering... I am trying to do fading out effect http://www.ogre3d.org/forums/viewtopic.php?f=5&t=60368 and I have realized there already is some kind of fading functionality in Miyagi.
Is it possible to do what I am trying?
Thank you

smiley80

17-09-2010 16:21:08

The built-in fading only changes the opacity. For a "fade to white" effect you have to use a shader.

 float4 main(float2 vIn : TEXCOORD0, sampler2D tex0 : TEXUNIT0, uniform float brightness ) : COLOR { float4 color = tex2D(tex0, vIn); color.rgb += brightness; return color; } 

texture.GpuPrograms.Add( this.gpu = Miyagi.Common.Resources.GpuProgram.Create( this.miyagiSystem, "FadeToWhite", "cg", "FadeToWhite.cg", Miyagi.Common.Resources.GpuProgramType.Fragment, new Dictionary<string, string> { { "entry_point", "main" }, { "profiles", "ps_2_0 arbfp1" } })); this.gpu.NamedConstants["brightness"] = 0f;

And then increase 'this.gpu.NamedConstants["brightness"]' gradually to 1.

Tubulii

20-09-2010 18:26:09

Hi,

I have a problem with the cursor: The cursor is not visible(= no texture but working) but its skin is created.
... MOGRE_Base.GUI.UIManager.Singelton.Skins.Add(.CreateSkin("CursorSkin", "Cursor", True)) ... GUIManager.Cursor = New Cursor(MOGRE_Base.GUI.UIManager.Singelton.Skins.Item("CursorSkin"), New Size(16, 16), New Point(0, 0), True) GUIManager.Cursor.Skin = MOGRE_Base.GUI.UIManager.Singelton.Skins.Item("CursorSkin") GUIManager.Cursor.Hotspots.Add(CursorMode.Main, New Point(8, 8)) GUIManager.Cursor.Hotspots.Add(CursorMode.ResizeLeft, New Point(8, 8)) GUIManager.Cursor.Hotspots.Add(CursorMode.ResizeTop, New Point(8, 8)) GUIManager.Cursor.Hotspots.Add(CursorMode.ResizeTopLeft, New Point(8, 8)) GUIManager.Cursor.Hotspots.Add(CursorMode.ResizeTopRight, New Point(8, 8)) GUIManager.Cursor.SetActiveMode(CursorMode.Main) ... 

UiManager is a simple storage for skins

Any Idea?

Thanks

smiley80

20-09-2010 22:57:01

Please check whether the skin is created correctly.
E.g. this should return true: GUIManager.Cursor.Skin.IsSubSkinDefined("CursorSkin")
Miyagi.log should contain something like:
Information: 5 files found for skin: CursorSkin
Texture: Cursor.png: Loading 1 faces [...]

Tubulii

21-09-2010 18:53:10

E.g. this should return true:
GUIManager.Cursor.Skin.IsSubSkinDefined("CursorSkin")

It returns TRUE.

Miyagi.log should contain something like:
Information: 5 files found for skin: CursorSkin

It (the debug window) contains this line .

19:46:24: Texture: Cursor.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1. 19:46:24: Texture: Cursor.ResizeBottomLeft.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1. 19:46:24: Texture: Cursor.ResizeBottomRight.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1. 19:46:24: Texture: Cursor.ResizeLeft.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1. 19:46:24: Texture: Cursor.ResizeTop.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1.

So, I guess now I have a problem?

smiley80

21-09-2010 22:36:09

Do you have more than one camera?
Do you use a Form as RenderWindow?

Tubulii

22-09-2010 16:46:33

Do you have more than one camera?
Yes, I am using a second camera.
I integrated this code:
this.guiCam = this.sceneMgr.CreateCamera("GuiCam"); this.guiViewport = this.window.AddViewport(this.guiCam, 10); this.guiViewport.SetClearEveryFrame(false); this.guiViewport.ShadowsEnabled = false; this.guiViewport.OverlaysEnabled = false; this.guiViewport.SkiesEnabled = false; this.guiViewport.SetVisibilityMask(0); ((MogreRenderManager)this.miyagiSystem.Backend.RenderManager).Camera = this.guiCam;
And you have to add a reference to 'Miyagi.Backend.Mogre.dll'.

Do you use a Form as RenderWindow?
I am using the standart render window created by OGRE.

smiley80

23-09-2010 08:26:45

Any differences if you exchange the cursor texture for another texture that does render?
Also, try updating to the latest revision, if you haven't already.

----
Edit:
I've uploaded a video demonstrating the current sprite transformation capabilities, so if anyone wants to waste 53s of his life:

Tubulii

23-09-2010 18:14:39

Any differences if you exchange the cursor texture for another texture that does render?
No differences.

Also, try updating to the latest revision, if you haven't already.
My version is quite uptodate but I am using VS 2008 and you upgraded to 2010. After I tried to downgrade the solution there were some code errors like the Net. 4 feature optional parameters which do not work in Net. 3.5.

smiley80

23-09-2010 22:51:40

Set a breakpoint at 'Miyagi.Common.Rendering.MogreRenderManager.FireMainRenderer'.
Step into 'this.MainRenderer.RenderSprites'.
Check whether 'this.SpriteList.Count' isn't zero and 'this.GetRenderChunks()' doesn't return an empty list.

My version is quite uptodate but I am using VS 2008 and you upgraded to 2010. After I tried to downgrade the solution there were some code errors like the Net. 4 feature optional parameters which do not work in Net. 3.5.
If you have .NET 4.0 installed, you can run 'Rebuild.cmd' in the Tools folder.

Tubulii

25-09-2010 18:22:42

Hi, Smiley80

I have a question: 'this' is the firemainrenderer, isn't it?
Nevertheless i took a deeper look at the cursor class. Somehow the cursor seems to get the right texture but somewhere it gets 'lost'.
I have a few suggestens: the cursor needs some events: Cursor moved, clicked, visiblechanged, hotspotchanged and activemodechanged.
And the texture property should become public. This should make it more 'user-friendly' . This evening I will take a second look at the cursorclass and my own classes to find this damn bug!

smiley80

26-09-2010 07:09:34

I have a question: 'this' is the firemainrenderer, isn't it?
When you step into RenderSprites, 'this' is MogreRenderManager.MainRenderer.

Nevertheless i took a deeper look at the cursor class. Somehow the cursor seems to get the right texture but somewhere it gets 'lost'.

Is the 'texture' field set to null (Nothing) at some point? That would mean there's something wrong with the cursor skin.

I have a few suggestens: the cursor needs some events: Cursor moved, clicked,

There is already 'InputManager.MouseLocationChanged'. I'll probably add other input related events to that class.

visiblechanged, hotspotchanged and activemodechanged.

I'll add those in one of the next revisions.

And the texture property should become public. This should make it more 'user-friendly' .

You can change the texture with the 'ActiveMode' property. E.g. 'cursor.ActiveMode = "FooBar";' would try to set the texture to the 'CursorSkin.FooBar' subskin.
However, the texture is set back to the main subskin after the cursor has been updated. So you have to set it everytime before you call 'MiyagiSystem.Update'.
If you want to change the texture when the cursor is over a control, you can use the 'Control.Cursor' property.

WarehouseJim

22-11-2010 14:10:17

I updated from Hg last week, and then compiled to .NET 4.0 and at the same time updated to the latest Mogre binary.

Generally it's been fairly pain free update since my last version, although I'm taking some time to refactor my code this time as constructors for the controls seem to change every time I update, which is a pain the way I create things at the moment.

I have found a few bugs:

1) Crash when setting a Bitmap / background image

In BitmapControl.cs:
 public Bitmap Bitmap { get { return this.bitmap; } set { this.ThrowIfDisposed(); if (this.bitmap != value) { if (this.bitmap != null) { this.bitmap.Dispose(); } if (value.Width != this.Width || value.Height != this.Height) { this.bitmap = new Bitmap(this.Width, this.Height); using (var g = Graphics.FromImage(this.bitmap)) { g.DrawImage(value, 0, 0, this.Width, this.Height); } } else { this.bitmap = value; } this.NeedsUpdate = true; } } } 

Fails if this.Width and this.Height =0 (sorry, I can't actually remember the exact situation where it crashed). Also looking at it, I couldn't see why you were creating a new bitmap object, then drawing to it etc if the image was a different size, but were just using the value if value is the same size etc....

My solution is:
 public Bitmap Bitmap { get { return this.bitmap; } set { this.ThrowIfDisposed(); if (this.bitmap != value) { this.bitmap = value; this.NeedsUpdate = true; } } } 

Change
 public void Add(object item) { this.Add(new ListItem(item.ToString())); } 
to
 public void Add(object item) { base.Add(new ListItem(item.ToString())); } 
otherwise you get a StackOverflowException as it calls itself an infinite number of times.

If you try to add your own ListItem, fooListItem, then it will create a ListItem based on fooListItem.ToString().

2c) ListItem Constructor Inconsistent With Other Constructors
The ListItem(string text) constructor is inconsistent with most other control constructors which appear to be Control(string name). I know it sets the name as well, but that isn't clear without reading the source code -> I suggest:

 /// <summary> /// Initializes a new instance of the <see cref="ListItem"/> class with both its text and name set to the name parameter. /// </summary> /// <param name="text">The name (and text) of the ListBoxItem.</param> public ListItem(string name) { this.Name = this.Text = name; } 

I have one other bug that I haven't worked out the solution to yet:

1) Problem With Button Skinning
I use buttonSkin = Skin.CreateFromFiles("Button", path, "Button", miyagiSystem); to load skins for the Button. It finds all the files e.g. Button.Focused.png, but then crashes if you click on the button as TextureManager can't find the texture. 11:22:44: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Button.Focused.png in resource group General or any other group. in ResourceGroupManager::openResource at ..\..\ogre\OgreMain\src\OgreResourceGroupManager.cpp (line 753)

The texture is in the same folder as Button.png (which works) and if I change Button.Focused.png's name, it isn't picked up in the SubSkins, so the program doesn't crash. If I rename Button.png, then the buttons become transparent, so I know I'm working with the right folder.

I don't experience the same issues with checkbox etc.

Overall
I don't want to criticise overly, as you're obviously providing me with free and generally good code which I appreciate a lot, but maybe some simple tests would have identified some of these issues. I don't consider them particularly obscure - AFAIK you couldn't have created a ListBox with any items without it crashing.

smiley80

22-11-2010 16:59:39

1)
Oops, I think that was some test code I've forgot to remove.

2)
fixed in changeset 534 (4 days ago)

2b)
will be fixed in the next revision

2c)
Well, ListItem is not a control. It's more in the spirit of TreeNode, ListViewItem, etc (yes I know, those don't set the Name property in the constructor). I'll update the documentation to reflect the current behaviour.

Other 1)
Does 'TextureManager.Singleton.ResourceExists("Button.Focused.png")' return true directly after you initialize the resource groups?

WarehouseJim

23-11-2010 12:20:30

Does 'TextureManager.Singleton.ResourceExists("Button.Focused.png")' return true directly after you initialize the resource groups?

Immediately after I initialise the resource groups, it actually throws a null value exception as the TextureManager.Singleton doesn't exits.... but a little bit later, after I have created the sceneManager, the answer is no.

However, just after I create the skins, it's also false for all the skin frames. They appear to only exist when they have been used -> e.g. CheckBox.Focused.png only exists when I have clicked on a CheckBox.

smiley80

23-11-2010 14:24:35

Right, that should have been: ResourceGroupManager.Singleton.ResourceExists(ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, "Button.Focused.png")

WarehouseJim

23-11-2010 16:18:02

Right, that should have been: ResourceGroupManager.Singleton.ResourceExists(ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, "Button.Focused.png")

It's false. Also, after creating the skins, most other things shows true for it:

Just After Creating The Skins
ButtonDepressed.png is in my attempt at creating a second Button skin, which also fails.

NB: I have also had troubles with the ScrollBars on ListBoxes... maybe it's having the same issue?

 __Button__ Button Button.png In TextureManager: False In ResourceManager: True Button Button.Focused.png In TextureManager: False In ResourceManager: False __Button__ Button ButtonDepressed.png In TextureManager: False In ResourceManager: False __Checkbox__ Checkbox Checkbox.png In TextureManager: False In ResourceManager: True Checkbox Checkbox.Checked.png In TextureManager: False In ResourceManager: True Checkbox Checkbox.Focused.png In TextureManager: False In ResourceManager: True Checkbox Checkbox.Focused.Checked.png In TextureManager: False In ResourceManager: True __Radiobutton__ Radiobutton Radiobutton.png In TextureManager: False In ResourceManager: True Radiobutton Radiobutton.Checked.png In TextureManager: False In ResourceManager: True __Textbox__ Textbox Textbox.png In TextureManager: False In ResourceManager: True Textbox Textbox.Focused.png In TextureManager: False In ResourceManager: True __Listbox__ Listbox Listbox.png In TextureManager: False In ResourceManager: True Listbox Listbox.ScrollBar.png In TextureManager: False In ResourceManager: False Listbox Listbox.ScrollBar.Thumb.png In TextureManager: False In ResourceManager: False Listbox Listbox.ScrollBar.Thumb.Border.png In TextureManager: False In ResourceManager: False __DropDownList__ DropDownList DropDownList.png In TextureManager: False In ResourceManager: True DropDownList DropDownList.List.png In TextureManager: False In ResourceManager: True DropDownList DropDownList.ScrollBar.png In TextureManager: False In ResourceManager: True DropDownList DropDownList.ScrollBar.Thumb.png In TextureManager: False In ResourceManager: True DropDownList DropDownList.ScrollBar.Thumb.Border.png In TextureManager: False In ResourceManager: True __SliderH__ SliderH SliderH.png In TextureManager: False In ResourceManager: True SliderH SliderH.Border.png In TextureManager: False In ResourceManager: True SliderH SliderH.Thumb.png In TextureManager: False In ResourceManager: True SliderH SliderH.Thumb.Border.png In TextureManager: False In ResourceManager: True __Cursor__ Cursor Cursor.png In TextureManager: False In ResourceManager: True Cursor Cursor.ResizeBottomLeft.png In TextureManager: False In ResourceManager: True Cursor Cursor.ResizeBottomRight.png In TextureManager: False In ResourceManager: True Cursor Cursor.ResizeLeft.png In TextureManager: False In ResourceManager: True Cursor Cursor.ResizeTop.png In TextureManager: False In ResourceManager: True __Panel__ Panel Panel.png In TextureManager: False In ResourceManager: True Panel Panel.Border.png In TextureManager: False In ResourceManager: True 

smiley80

23-11-2010 17:16:18

ResourceGroupManager.ResourceExists has to return true, otherwise there's something going wrong while Ogre initializes the resource groups.
Try whether ResourceExistsInAnyGroup returns true.

NB: I have also had troubles with the ScrollBars on ListBoxes... maybe it's having the same issue?
You have to replace 'ScrollBar' with 'VScrollBar'.

WarehouseJim

24-11-2010 13:43:15

I've got the scroll bars working

The missing textures return false for ResourceExistsInAnyGroup.
>>skins = [mogreForm.buttonSkin, mogreForm.buttonDownSkin, mogreForm.checkBoxSkin, mogreForm.radioButtonSkin, mogreForm.textBoxSkin, mogreForm.listBoxSkin, mogreForm.dropDownListSkin, mogreForm.sliderHSkin, mogreForm.cursorSkin, mogreForm.panelSkin,] >> >>for skin in skins: >> print skin.Name >> for subskin in skin.SubSkins: >> #print "\t"+subskin.Value.Name >> for frame in subskin.Value.Frames: >> print "\t\t" + frame.FileName >> print 3*"\t"+" in TextureManager " +str(TextureManager.Singleton.ResourceExists(frame.FileName)) >> print 3*"\t"+" in ResourceGroupManager (default group) "+ str(ResourceGroupManager.Singleton.ResourceExists(ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, frame.FileName)) >> print 3*"\t"+" in any ResourceGroup "+str(ResourceGroupManager.Singleton.ResourceExistsInAnyGroup(frame.FileName)) >> >> Button Button.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True Button.Focused.png in TextureManager False in ResourceGroupManager (default group) False in any ResourceGroup False Button ButtonDepressed.png in TextureManager False in ResourceGroupManager (default group) False in any ResourceGroup False Checkbox Checkbox.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True Checkbox.Checked.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True Checkbox.Focused.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True Checkbox.Focused.Checked.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True Radiobutton Radiobutton.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True Radiobutton.Checked.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True Textbox Textbox.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True Textbox.Focused.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True Listbox Listbox.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True Listbox.VScrollBar.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True Listbox.VScrollBar.Thumb.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True Listbox.VScrollBar.Thumb.Border.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True DropDownList DropDownList.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True DropDownList.List.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True DropDownList.ScrollBar.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True DropDownList.ScrollBar.Thumb.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True DropDownList.ScrollBar.Thumb.Border.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True SliderH SliderH.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True SliderH.Border.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True SliderH.Thumb.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True SliderH.Thumb.Border.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True Cursor Cursor.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True Cursor.ResizeBottomLeft.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True Cursor.ResizeBottomRight.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True Cursor.ResizeLeft.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True Cursor.ResizeTop.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True Panel Panel.png in TextureManager True in ResourceGroupManager (default group) True in any ResourceGroup True Panel.Border.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True Panel.Listbox.VScrollBar.png in TextureManager False in ResourceGroupManager (default group) False in any ResourceGroup False Panel.VScrollBar.Thumb.png in TextureManager False in ResourceGroupManager (default group) True in any ResourceGroup True Panel.VScrollBar.Thumb.Border.png in TextureManager False in ResourceGroupManager (default group) False in any ResourceGroup False 

smiley80

24-11-2010 18:18:18

Try to move all textures (and only the textures) to a separate folder, add the folder to a new ResourceGroup and set MiyagiSystem.Backend.ResourceGroupName to the name of that group.

WarehouseJim

25-11-2010 16:42:20

Still exactly the same

WarehouseJim

25-11-2010 17:45:37

Sorry, I take that back. It does work with your suggestion. It doesn't work if I do
 ResourceGroupManager.Singleton.AddResourceLocation(parentFolderPath, "FileSystem", MiyagiMediaResourceGroupName, true); 
but it does work if I do
ResourceGroupManager.Singleton.AddResourceLocation(Path.Combine(parentFolderPath, folderName), "FileSystem", MiyagiMediaResourceGroupName); 

WarehouseJim

25-11-2010 17:50:50

It also works with that hack if you set
 MiyagiMediaResourceGroupName = ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME; 

smiley80

26-11-2010 12:29:28

If you add the resource locations recursively, the resource names will be relative to the specified folder (e.g. 'Textures/Button.Focused.png'). But Skin.CreateFromFiles sets the texture names to the simple filenames.

In other news:
A new video demonstrating the GUI3D feature:

WarehouseJim

01-12-2010 13:03:08

I like the GUI3D stuff. Not sure I've got a use for it yet, but still cool.

I've found another bug in InputManager.TabMovement():

change
 this.FocusedControl = newNode.Value; 
to
 if(newNode!=null) { this.FocusedControl = newNode.Value; } else { this.FocusedControl = null; } 

smiley80

01-12-2010 15:23:36

Not sure I've got a use for it yet, but still cool.

Use cases I had in mind:
1) 2D <-> 3D transition effect
2) interactive 3D touchscreen
3) 'floating' context menu if you click on a 3D object

I've found another bug in InputManager.TabMovement():

Will be fixed in the next revision.

Pyritie

08-12-2010 17:54:26

The sample won't work for me, it builds okay but if I try to run it I get this:
Could not load file or assembly 'Mogre, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

then I poked around with the Mogre.dll

then when I tried to recompile I got this
Error 1 Property or indexer 'Mogre.SubEntity.MaterialName' cannot be assigned to -- it is read only C:\Users\___\Desktop\Miyagi1.0beta4c\Miyagi\Controls\Elements\MeshElement.cs 122 17 Miyagi
on this line in MeshElement.csthis.entity.GetSubEntity(x).MaterialName = materiallnstanceName;

EDIT: oh and I'm using the stuff in the 4c download thing

smiley80

08-12-2010 19:19:29

1.0 doesn't work with Mogre 1.7.1.

To obtain the lastest (semi-stable) dev version which works with Mogre 1.7:
1) Clone the hg repo from SourceForge:
http://miyagi.hg.sourceforge.net:8000/h ... agi/miyagi
and compile the code.
Miyagi 1.2 targets .NET 3.5, but compiling requires .NET 4.0.

Media files for the examples:

Pyritie

08-12-2010 19:57:24

1.0 doesn't work with Mogre 1.7.1.
Well damn, my game needs some of the 1.7.1 functions

will there be a 1.7.1-compatible version at some point?

smiley80

08-12-2010 20:09:03

1.0 will not be updated.
You have to use 1.2 (see above post).

Pyritie

08-12-2010 20:11:35

oh right, duh, completely missed that part of your post D:

Pyritie

13-12-2010 23:21:29

Alright I think I have everything working right but nothing's showing up

Miyagi.log shows no problems
Ogre.log shows the textures being loaded and everything

if it means anything, when I was on an older version of MOIS (with ogre 1.6.whatever), the regular windows cursor was there and I was able to have some overlay thing work, but when I upgraded to the MOIS that would work with ogre 1.7.whatever, the cursor disappeared and so did the overlay. Could this be connected?

My renderwindow is a windows form if that makes any difference

smiley80

14-12-2010 01:59:42

When Miyagi's RenderManager is initialized, it takes the first Viewport of the first SceneManager as the default for future SpriteRenderer.
You can set the Viewports manually through RenderMananger.MainViewport or GUI.SpriteRenderer.Viewport.

Or you can initialize Miyagi after you create your viewport (in Main.cs):
splash.Increment("Loading first level..."); Kernel.Get<ILevelManager>().LoadLevel(0, false); splash.Increment("Initialising UI..."); Kernel.Get<UIMain>();

Pyritie

14-12-2010 11:14:16

When Miyagi's RenderManager is initialized, it takes the first Viewport of the first SceneManager as the default for future SpriteRenderer.
You can set the Viewports manually through RenderMananger.MainViewport or GUI.SpriteRenderer.Viewport.

How do I go from a mogre viewport to a miyagi viewport? Or am I misunderstanding you?

Or you can initialize Miyagi after you create your viewport (in Main.cs):
splash.Increment("Loading first level..."); Kernel.Get<ILevelManager>().LoadLevel(0, false); splash.Increment("Initialising UI..."); Kernel.Get<UIMain>();

Nope, didn't do anything different :/

kubatp

14-12-2010 15:19:51

Hi Smiley,
I havent worked on my project for a while. I have updated Miyagi to the latest version (which differs in many things), however the most significant this is this weird file locking. In principle, Mogre backend and Miyagi use the same texture file. When I create the Miyagi control first and after it, Mogre uses this texture, it seems to be ok. But backwards - first Mogre uses this texture and after this, the texture is used by Miyagi - it throws the exception, that the file is locked and it cannot be accessed.
Is this something you would know why is this happening?
Thank you

kubatp

14-12-2010 15:30:17

Actually one more thing - this GUI3D, is it now possible to attach controls to actual 3D SceneNode?

smiley80

14-12-2010 19:13:14

How do I go from a mogre viewport to a miyagi viewport? Or am I misunderstanding you?
You have to update to the latest revision (RenderManager.MainViewport setter was wrongly set to 'protected' before that) and add a reference to Miyagi.Backend.Mogre:
 miyagiSystem.RenderManager.MainViewport = new MogreViewport(this.viewport); gui.SpriteRenderer.Viewport = new MogreViewport(this.viewport);

Nope, didn't do anything different :/
Works for me with the latest trunk version:

But backwards - first Mogre uses this texture and after this, the texture is used by Miyagi - it throws the exception, that the file is locked and it cannot be accessed.
Where does it throw the exception?

Actually one more thing - this GUI3D, is it now possible to attach controls to actual 3D SceneNode?
You have to update GUI3D.Offset each time you move the node. You can do that automatically with MovableObjects and MovableObject.Listener.

Pyritie

14-12-2010 19:44:43

How do I go from a mogre viewport to a miyagi viewport? Or am I misunderstanding you?
You have to update to the latest revision (RenderManager.MainViewport setter was wrongly set to 'protected' before that) and add a reference to Miyagi.Backend.Mogre:
 miyagiSystem.RenderManager.MainViewport = new MogreViewport(this.viewport); gui.SpriteRenderer.Viewport = new MogreViewport(this.viewport);

Nope, didn't do anything different :/
Works for me with the latest trunk version:

Ohh I had it in the wrong order then

thanks :D

EDIT: there's no FreeImageNET assembly apparently

kubatp

14-12-2010 20:51:55

But backwards - first Mogre uses this texture and after this, the texture is used by Miyagi - it throws the exception, that the file is locked and it cannot be accessed.
Where does it throw the exception?

using (var fs = new FileStream(fileName, FileMode.Open))
line 93 PictureBox.cs

smiley80

14-12-2010 21:07:15

Should be fixed now.

Pyritie

14-12-2010 21:59:02

Do you do anything with the scene manager because I recreate the scene manager every time I change levels, and when I do that then the GUI disappears

EDIT: since you seem to be looking at my code, hit 0, 1, 3, 4, or 5 to change levels (2 loads a really big mesh for stress testing - Newton could cope with it fine (after about 40 seconds of loading it) but physx just crashes. Not too important though)

smiley80

14-12-2010 22:38:14

When you create a new SceneManager:
((MogreRenderManager)miyagiSystem.RenderManager).SceneManager = newSceneManager;

but physx just crashes.
in PhysXMain.GetMeshInformation change:
ulong* pLong = (ulong*)ibuf.Lock(HardwareBuffer.LockOptions.HBL_READ_ONLY);
to
uint* pLong = (uint*)ibuf.Lock(HardwareBuffer.LockOptions.HBL_READ_ONLY);

Pyritie

14-12-2010 23:17:04

When you create a new SceneManager:
((MogreRenderManager)miyagiSystem.RenderManager).SceneManager = newSceneManager;
Now I'm getting some sort of null exception from the scene manager but that's probably related to my own dependency injection mess

it crashes right here (in GUIMain.cs):
((MogreRenderManager)MiyagiSys.RenderManager).SceneManager = Kernel.Get<SceneManager>();
stack trace:
 at Mogre.SceneManager.remove_RenderQueueStarted(RenderQueueStartedHandler hnd) at Miyagi.Backend.Mogre.MogreRenderManager.set_SceneManager(SceneManager value) at Lymph.UI.UIMain.OnLevelLoad(LevelChangedEventArgs eventArgs) in A:\Pyritie\Documents\Computer Science\MOgre\Lymph\Lymph\GUI\GUIMain.cs:line 86 at Lymph.Levels.LevelManager.LoadLevel(Level newLevel, Boolean showSplashScreen) in A:\Pyritie\Documents\Computer Science\MOgre\Lymph\Lymph\Levels\LevelManager.cs:line 143 at Lymph.Levels.LevelManager.LoadLevel(Int32 newLevelID) in A:\Pyritie\Documents\Computer Science\MOgre\Lymph\Lymph\Levels\LevelManager.cs:line 83 at Lymph.Levels.LevelChangerHandler.input_OnKeyboardPress_Anything(KeyEvent ke) in A:\Pyritie\Documents\Computer Science\MOgre\Lymph\Lymph\Levels\LevelChangerHandler.cs:line 27 at Lymph.LymphInputEventHandler1.Invoke(T eventArgs) at Lymph.InputMain.FireEvent[T](LymphInputEventHandler1 handler, T eventArgs) in A:\Pyritie\Documents\Computer Science\MOgre\Lymph\Lymph\InputMain.cs:line 92 at Lymph.InputMain.KeyPressed(KeyEvent ke) in A:\Pyritie\Documents\Computer Science\MOgre\Lymph\Lymph\InputMain.cs:line 130 at MOIS.KeyListener.KeyPressedHandler.Invoke(KeyEvent arg) at MOIS.Keyboard.raise_KeyPressed(KeyEvent arg) at MOIS.Keyboard.OnKeyPressed(KeyEvent arg) at MOIS.KeyListener_Director.keyPressed(KeyListener_Director* , KeyEvent* arg) at MOIS.OISObject.Capture() at Miyagi.Plugin.Input.Mois.MoisInputManager.Capture() at Miyagi.Common.InputManager.Update() at Miyagi.MiyagiSystem.Update() at Lymph.UI.UIMain.root_FrameEnded(FrameEvent evt) in A:\Pyritie\Documents\Computer Science\MOgre\Lymph\Lymph\GUI\GUIMain.cs:line 108 at Mogre.Root.raise_FrameEnded(FrameEvent evt) at Mogre.Root.OnFrameEnded(FrameEvent evt) at Mogre.FrameListener_Director.frameEnded(FrameListener_Director* , FrameEvent* evt) at Ogre.Root.renderOneFrame(Root* ) at Mogre.Root.RenderOneFrame() at Lymph.Main.StartRendering() in A:\Pyritie\Documents\Computer Science\MOgre\Lymph\Lymph\Main.cs:line 133 at Lymph.Main.Go() in A:\Pyritie\Documents\Computer Science\MOgre\Lymph\Lymph\Main.cs:line 23 at Lymph.Launch.Main() in A:\Pyritie\Documents\Computer Science\MOgre\Lymph\Lymph\Launch.cs:line 21 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

but physx just crashes.
in PhysXMain.GetMeshInformation change:
ulong* pLong = (ulong*)ibuf.Lock(HardwareBuffer.LockOptions.HBL_READ_ONLY);
to
uint* pLong = (uint*)ibuf.Lock(HardwareBuffer.LockOptions.HBL_READ_ONLY);

DAMN YOU'RE GOOD

no seriously how did you know this :0

smiley80

15-12-2010 03:15:37

Now I'm getting some sort of null exception from the scene manager but that's probably related to my own dependency injection mess
Try setting RenderManager.SceneManager to null before you destroy the old SceneManager.

no seriously how did you know this :0
I made the same mistake too.

kubatp

15-12-2010 11:40:56

Hi Smiley,
the fix really solved the problem I was experiencing, however there is another exception -
line no. 372 MogreSpriteRenderer2D (this.hardwareBuffer.Dispose();)

HEAP[tutorial1.exe]: Heap block at 08D020B8 modified at 08D101C0 past requested size of e100
Windows has triggered a breakpoint in gui.exe.
This may be due to a corruption of the heap, which indicates a bug in gui.exe or any of the DLLs it has loaded.
ion.

I have noticed another thing -
when I try to load a game (set the scene and gui), I had panel above all controls, which hides the scene created. It worked since beginning.
Now this panel doesn't appear above it anymore.
Maybe it is related.

Pyritie

15-12-2010 15:04:42

Now I'm getting some sort of null exception from the scene manager but that's probably related to my own dependency injection mess
Try setting RenderManager.SceneManager to null before you destroy the old SceneManager.
god damn you did it again <3

how did you figure that out? did you have the same problem at one point too?

no seriously how did you know this :0
I made the same mistake too.
ahh. Well I got that part from the wiki so I updated that page with your fix too. :D

smiley80

15-12-2010 19:51:57

Hi Smiley,
the fix really solved the problem I was experiencing, however there is another exception -
line no. 372 MogreSpriteRenderer2D (this.hardwareBuffer.Dispose();)

Under which circumstances does that happen?

how did you figure that out? did you have the same problem at one point too?
No, but the setter unsubscribes from the old SceneManager, which isn't a good idea if it has already been disposed.

kubatp

16-12-2010 08:32:12

Hi Smiley,
the fix really solved the problem I was experiencing, however there is another exception -
line no. 372 MogreSpriteRenderer2D (this.hardwareBuffer.Dispose();)

Under which circumstances does that happen?

It happens when I call Gui.Update() for one of the controls. Here is the call stack

Miyagi.Backend.Mogre.dll!Miyagi.Backend.Mogre.MogreSpriteRenderer2D.DestroyHardwareBuffer() Line 372 + 0xd bytes Miyagi.Backend.Mogre.dll!Miyagi.Backend.Mogre.MogreSpriteRenderer2D.CheckBufferSize() Line 319 + 0x8 bytes Miyagi.Backend.Mogre.dll!Miyagi.Backend.Mogre.MogreSpriteRenderer2D.AddSprite(Miyagi.Common.Rendering.Sprite sprite = {Miyagi.UI.UISprite}) Line 145 + 0x8 bytes Miyagi.dll!Miyagi.Common.Rendering.Sprite.Sprite(Miyagi.Common.Rendering.ISpriteRenderer spriteRenderer = {Miyagi.Backend.Mogre.MogreSpriteRenderer2D}, Miyagi.Common.Rendering.Primitives.IPrimitive[] primitives = {Miyagi.Common.Rendering.Primitives.Quad[4]}) Line 73 + 0xc bytes Miyagi.dll!Miyagi.UI.UISprite.UISprite(Miyagi.UI.Controls.Elements.IElement owner = {Miyagi.UI.Controls.Elements.TextElement}, Miyagi.Common.Rendering.Primitives.IPrimitive[] primitives = {Miyagi.Common.Rendering.Primitives.Quad[4]}) Line 50 + 0x20 bytes Miyagi.dll!Miyagi.UI.Controls.Elements.TextElement.CreateSprite() Line 453 + 0x63 bytes Miyagi.dll!Miyagi.UI.Controls.Elements.TextElement.UpdateCore() Line 331 + 0x8 bytes Miyagi.dll!Miyagi.UI.Controls.Elements.Element<Miyagi.UI.Controls.Elements.Owner.ITextElementOwner,Miyagi.UI.Controls.Elements.Styles.TextStyle>.Update(Miyagi.Common.Data.Point deltaLocation = {Miyagi.Common.Data.Point}, Miyagi.Common.Data.Point deltaSize = {Miyagi.Common.Data.Point}) Line 755 + 0xb bytes Miyagi.dll!Miyagi.UI.Controls.Label.UpdateCore() Line 350 + 0x49 bytes Miyagi.dll!Miyagi.UI.Controls.SkinnedControl.UpdateCore() Line 538 + 0x8 bytes Miyagi.dll!Miyagi.UI.Controls.ScrollableControl.UpdateCore() Line 424 + 0x8 bytes Miyagi.dll!Miyagi.UI.Controls.Panel.UpdateCore() Line 465 + 0x8 bytes Miyagi.dll!Miyagi.UI.Controls.Control.Update() Line 1893 + 0xb bytes Miyagi.dll!Miyagi.UI.Controls.Control.Update() Line 1901 + 0x23 bytes Miyagi.dll!Miyagi.UI.Controls.Control.Update() Line 1901 + 0x23 bytes Miyagi.dll!Miyagi.UI.Controls.Control.Update() Line 1901 + 0x23 bytes Miyagi.dll!Miyagi.UI.GUI.UpdateCore() Line 633 + 0x23 bytes Miyagi.dll!Miyagi.UI.GUI.Update() Line 447 + 0xb bytes

smiley80

16-12-2010 08:58:06

I couldn't recreate the exception, but there was a typo that causes a too small hardwarebuffer.

kubatp

16-12-2010 13:55:08

Hi Smiley,
yes that was it thank you. We are getting further. Unfortunately there is another exception:)
line 367 Quad.cs RectangleF oldUVRect = RectangleF.FromLTRB(this.VertexUV[0].X, this.VertexUV[0].Y, this.VertexUV[2].X, this.VertexUV[2].Y);
VertexUV is null.
Call stack:

Miyagi.dll!Miyagi.Common.Rendering.Primitives.Quad.SetCroppedValues(Miyagi.Common.Data.RectangleF cropArea = {RectangleF(-2.893196,-5.202879,0.2373416,-0.08638763)}) Line 367 + 0x14 bytes Miyagi.dll!Miyagi.UI.UISprite.UpdateCrop() Line 208 + 0x24 bytes Miyagi.dll!Miyagi.UI.Controls.Elements.Element<Miyagi.UI.Controls.Elements.Owner.ITextElementOwner,Miyagi.UI.Controls.Elements.Styles.TextStyle>.UpdateSpriteCrop() Line 769 + 0x15 bytes Miyagi.dll!Miyagi.UI.Controls.Elements.TextElement.UpdateSpriteCrop() Line 208 + 0x8 bytes Miyagi.dll!Miyagi.UI.Controls.Elements.Element<Miyagi.UI.Controls.Elements.Owner.ITextElementOwner,Miyagi.UI.Controls.Elements.Styles.TextStyle>.Update(Miyagi.Common.Data.Point deltaLocation = {Point(-11196,2370)}, Miyagi.Common.Data.Point deltaSize = {Point(0,0)}) Line 713 + 0xb bytes Miyagi.dll!Miyagi.UI.Controls.Label.UpdateCore() Line 350 + 0x49 bytes Miyagi.dll!Miyagi.UI.Controls.Control.Update() Line 1893 + 0xb bytes Miyagi.dll!Miyagi.UI.Controls.Control.Update() Line 1901 + 0x23 bytes Miyagi.dll!Miyagi.UI.GUI.UpdateCore() Line 633 + 0x23 bytes Miyagi.dll!Miyagi.UI.GUI.Update() Line 447 + 0xb bytes Miyagi.dll!Miyagi.UI.GUIManager.Update() Line 670 + 0x2f bytes Miyagi.dll!Miyagi.MiyagiSystem.Update() Line 617 + 0x1c bytes gui.exe!Aggressors.UI.SecondForm.Scene_FrameStarted(Mogre.FrameEvent evt = {Mogre.FrameEvent}) Line 5638 + 0x1b bytes

smiley80

16-12-2010 20:12:52

Thanks for the report. That's fixed in the latest revision.

kubatp

17-12-2010 13:01:26

Hi Smiley,
it works! Thank you.
I have actually one more problem. It is there already for a while, however initially (four months ago) it worked.

It happens when Root.RenderOneFrame(), but only when one Miyagi control is created. In output window is this

MiyagiGuiWindow UnnamedMaterialCroppingWindow_357 created. MaterialCroppingWindow UnnamedMaterialCroppingWindow_357 created. MiyagiGuiWindow terrainSelector init. [12:55:52] Information: ToolTipElement Unhandled change. Property name: Padding [12:55:52] Information: ToolTipElement Unhandled change. Property name: HoverDuration [12:55:52] Information: ToolTipElement Unhandled change. Property name: Padding [12:55:52] Information: ToolTipElement Unhandled change. Property name: HoverDuration [12:55:52] Information: ToolTipElement Unhandled change. Property name: Padding [12:55:52] Information: ToolTipElement Unhandled change. Property name: HoverDuration [12:55:52] Information: ToolTipElement Unhandled change. Property name: Padding [12:55:52] Information: ToolTipElement Unhandled change. Property name: HoverDuration Texture: newtiles4.png: Loading 1 faces(PF_A8R8G8B8,8192x8192x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,8192x8192x1. -- THIS IS IN CYCLE - START -- D3D9 Device 0x[0A51CF80] entered lost state D3D9 Device 0x[0A51CF80] entered lost state D3D9 : WARNING - disabling VSync in windowed mode can cause timing issues at lower frame rates, turn VSync on if you observe this problem. The thread 'Win32 Thread' (0xe8c) has exited with code 0 (0x0). !!! Direct3D Device successfully restored. D3D9 device: 0x[0A51CF80] was reset -- THIS IS IN CYCLE - END --

Those message in cycle simply keep occured in output in a loop.
Any ideas?

smiley80

19-12-2010 15:44:53

Please check whether it also happens when you set RenderManager.SceneManager to null:
((MogreRenderManager)miyagiSystem.RenderManager).SceneManager = null;

kubatp

19-12-2010 17:30:14

When I set it to null, nothing wrong happens. All the Miyagi controls dissapear, but no exceptions and no records in output. Of course, the control which probably causes the exception is not displayed that time.

smiley80

20-12-2010 05:20:54

Any additional information when you use the debug D3D runtime?
Do the examples work?

kubatp

20-12-2010 15:12:48

Hi Smiley,
when I run debug D3D, I am not able to get to the place, where I call this control creation. It fails earlier here
MogreSpriteRendere2D line no. 196 - this.rs._render(this.renderOp);

with following output
Direct3D9: (ERROR) :Need to call BeginScene before rendering.

there is another error in log, which has probably nothing to do with Miyagi, however I paste it here to be sure it is not related
Direct3D9: (ERROR) :Invalid sample type specified. CheckDeviceMultiSampleType fails.

smiley80

20-12-2010 16:17:11

Direct3D9: (ERROR) :Need to call BeginScene before rendering.
That error might be caused by Ogre trying to call render functions on a lost device.
Normally, they would fail silently, but I'm not sure how they behave with the debug runtime.

IIRC, you've had the same error in the past. Did it disappear at some point?
I still think it's some kind of multithreading issue.

kubatp

21-12-2010 14:33:19

I still think it's some kind of multithreading issue.
I hope it is not multithreading issue. I do all the GUI operation on the same thread. It calls my backend, which is processed on another thread, but when it goes back to GUI, it invokes the call (this.Invoke).
How can I find out more to be sure the threading is ok?

This is all I get from log (which seems to be important from my point of view)

Direct3D9: (ERROR) :Invalid sample type specified. CheckDeviceMultiSampleType fails. Compiler error: unknown error in Tiles.material(23): token "scene_blend" is not recognized Direct3D9: (ERROR) :Need to call BeginScene before rendering. gui.exe has triggered a breakpoint The thread 'Win32 Thread' (0x1c70) has exited with code 0 (0x0). First-chance exception at 0x758ffbae in gui.exe: Microsoft C++ exception: long at memory location 0x0025d260.. The thread 0x5cc has exited with code 0 (0x0). Direct3D9: (ERROR) :DrawPrimitive failed. First-chance exception at 0x758ffbae in gui.exe: Microsoft C++ exception: Ogre::RenderingAPIException at memory location 0x0025d454.. A first chance exception of type 'System.Runtime.InteropServices.SEHException' occurred in Mogre.dll Direct3D9: (WARN) :Device that was created without D3DCREATE_MULTITHREADED is being used by a thread other than the creation thread. Direct3D9: (ERROR) :Final Release for a device can only be called from the thread that the device was created from. Windows has triggered a breakpoint in gui.exe. This may be due to a corruption of the heap, which indicates a bug in gui.exe or any of the DLLs it has loaded. This may also be due to the user pressing F12 while gui.exe has focus. The output window may have more diagnostic information. Direct3D9: :====> ENTER: DLLMAIN(5981a170): Process Detach 00001d70, tid=00000698 Direct3D9: (INFO) :MemFini! Direct3D9: :====> EXIT: DLLMAIN(5981a170): Process Detach 00001d70 

anyway maybe I have found the reason why was the initial problem happening:

I have a mogre material, which uses tiles.dds. In earlier version of Miyagi, Miyagi used this mogre material without problems. Then it started failing, I have created tiles.png for Miyagi... For new skin creation, I have to specify the path now. When I used the same file (same path to file which was used by Mogre), it was failing, so I changed the path, however the name remained the same. Now I see, that if I use "tiles.dds" for Mogre and "tiles.png" for Miyagi (even located in different folders), it is failing (line 185 MogreBackend). I tried to remane "tiles.png" yersterday to something else, and it is working. I dont want to go into much details here, because I am not sure, why was Miyagi working with material from Mogre, I was happy, that it did, so I left it as it was.
Any ideas why?

smiley80

23-12-2010 07:56:48

I hope it is not multithreading issue. I do all the GUI operation on the same thread.

All calls to Mogre and Miyagi must be on the the same thread.
However, you can use MiyagiSystem.Invoke(blocking) or MiyagiSystem.BeginInvoke/EndInvoke(async, EndInvoke can be omitted) from another thread. That enqueues the specified delegates, and executes them on the next call of MiyagiSystem.Update.

kubatp

23-12-2010 10:58:24

Is it the same thread as the Form thread, where is it displayed?

Any ideas regard to those Direct3D9 errors?

nico008

27-12-2010 00:57:34

Hi there
Smiley80 you remember me?

Finaly I got some free time to upgrade to your latest Miyagi version.
After some hours of changes in my code, Finally I can compile
But I still have some issues :

1)
I had written this for a Button sub class:
this.TextureElement.DoNotCrop = true; this.TextElement.DoNotCrop = true; this.BorderElement.DoNotCrop = true;

But there is no more TextureElement. How can I avoid my button to be cropped if I set Location = new Point(-1, -1)? (I want the button to be out of the center area of my form)

2)
Resources.Fonts.Add("BlueHighwaySmall", TrueTypeFont.Create(guiSystem, "BlueHighwaySmall", path + "bluehigh.ttf", 14, 72, System.Drawing.FontStyle.Regular, null));
-> is it ok if I use "null" as last parameter?

3)
Skin.CreateFromFiles(name, @"blabla\folder", fileName, system);
-> why is it deprecated? Do we really need to use xml? I don't understand why we can't keep this method

smiley80

27-12-2010 09:17:24

Is it the same thread as the Form thread, where is it displayed?
I don't think it has to be the main thread, just the one the device has been created on.
Any ideas regard to those Direct3D9 errors?
No exactly. Can you find out what is executed before "Direct3D9: (ERROR) Need to call BeginScene before rendering" happens?

But there is no more TextureElement.

It's now called 'SkinElement'.

-> is it ok if I use "null" as last parameter?

Yes, it'll then create glyphs for characters 32 - 255. I'll add an overload without that parameter.

-> why is it deprecated? Do we really need to use xml? I don't understand why we can't keep this method

'CreateFromFiles' is from a time where skins didn't support texture atlases, multiple textures or shaders. It's okay for basic skins, but useless for anything advanced.
But you can of course copy the method (plus Miyagi.Internals.ExtensionMethods.ReplaceFirst) and use it in your program.

nico008

27-12-2010 16:23:01

Great work smiley80 once more
Miyagi is now really clean and full of features!

I still have a little question thought :

I have written this
itemIcon = new Button(name) { CenterOnGrab = true, Movable = true }; 

So when I drag the itemIcon, this itemIcon follow my mouse cursor. That's what I want.
See [attachment=0]Bag.png[/attachment]

The problem is that when Movable = true, then MouseEnter/MouseLeave events for other Button are not called anymore (I'm always inside the grabbed Button until I release the mouse click)
How can I avoid this?

smiley80

27-12-2010 18:27:47

Atm, you have to extent the Button class like this:
class MyButton : Button { public bool IgnoreHitTest { get; set; } protected override bool HitTestCore(int x, int y) { return !this.IgnoreHitTest && base.HitTestCore(x, y); } protected override void OnMouseDown(MouseButtonEventArgs e) { this.IgnoreHitTest = true; base.OnMouseDown(e); } protected override void OnMouseUp(MouseButtonEventArgs e) { this.IgnoreHitTest = false; base.OnMouseUp(e); } }

Edit:
In the latest revision you can also do:
itemIcon.SuccessfulHitTest += (s, e) => e.Cancel = s == this.MiyagiSystem.GUIManager.GrabbedControl;

kubatp

27-12-2010 20:58:23

kubatp wrote:
Is it the same thread as the Form thread, where is it displayed?

I don't think it has to be the main thread, just the one the device has been created on.

I actually mean one thing - when I receive the message from my backend (which runs on another thread), I should use MiyagiSystem.Invoke? What should I use for Mogre update?

I have one more question - In previous versions this works ok (I mean for example two months ago), but it doesnt work anymore

countryEmblem.Bitmap = myBitmap; countryEmblem.Size = new Size(countryEmblem.Bitmap.Size.Width, countryEmblem.Bitmap.Size.Height);

None of these lines work - it doesnt change the bitmap, and it doesnt change the size as well. I know I can use Load() function, however in this case I create bitmap in memory.
Thank you

nico008

27-12-2010 23:02:41

Edit:
In the latest revision you can also do:
itemIcon.SuccessfulHitTest += (s, e) => e.Cancel = s == this.MiyagiSystem.GUIManager.GrabbedControl;

I don't understand that syntax but this magic line does exactly what I want
Good job once more!!!

smiley80

28-12-2010 10:22:38

I actually mean one thing - when I receive the message from my backend (which runs on another thread), I should use MiyagiSystem.Invoke? What should I use for Mogre update?

You can check whether you have to use MiyagiSystem.Invoke with MiyagiSystem.InvokeRequired. The important thing is that the MiyagiSystem has been created on the same thread as Mogre, and that MiyagiSystem.Update is also called on the same thread.

None of these lines work - it doesnt change the bitmap, and it doesnt change the size as well.

Fixed in the latest revision.

I don't understand that syntax but this magic line does exactly what I want
That's a lambda expression (basically C# 3.0 syntax sugar for delegates).

kubatp

28-12-2010 12:33:44

Fixed in the latest revision.
The resizing seems to work, however the bitmap change doesnt. It works the first time when you set bitmap, but next times, it doesnt update the bitmap anymore.

You can check whether you have to use MiyagiSystem.Invoke with MiyagiSystem.InvokeRequired. The important thing is that the MiyagiSystem has been created on the same thread as Mogre, and that MiyagiSystem.Update is also called on the same thread.
Thank you for this, I will take a look and if I find any news, I will post it here.

Pyritie

28-12-2010 16:26:31

Is it just me or is the skin editor tool thingy not working? It builds okay but when I try to run it I don't see anything, and if I import a texture and then double-click on it on the left side, I get an exception about "unable to find FreeImage" or something.

smiley80

28-12-2010 17:29:58

The resizing seems to work, however the bitmap change doesnt. It works the first time when you set bitmap, but next times, it doesnt update the bitmap anymore.

Should work again now.
I get an exception about "unable to find FreeImage" or something.
You'll need the native FreeImage.dll from here.

nico008

28-12-2010 23:00:58

It's me again :p

I see there is GTK plugin for Miyagi now
But currently I can't run my project in Linux (Ubuntu)
Could you please upload a working Miyagi application for linux if you have? (with all required dll included please)

smiley80

29-12-2010 09:02:12

Sorry, I currently don't have Linux installed anywhere, and I don't plan to change that in the near future.

kubatp

29-12-2010 09:45:33

Should work again now.
Thank you Smiley, it works now!

nico008

29-12-2010 15:10:58

Actually I'm not able to compile Miyagi with MonoDevelop 2.4, even on windows
I think you are using too recent features. This wasn't the case some monthes ago so I was able to compile Miyagi under linux.

smiley80

29-12-2010 16:15:39

Looks like you have to set the runtime version (somewhere in project properties) to 'Mono / .NET 4.0' and re-add the reference to 'System.Core'.

nico008

29-12-2010 16:39:15

It seems like Mono for .NET 4.0 is not available for linux yet
So I will have to wait some monthes/years...

Thanks anyway!

Have a nice evening

Nico

smiley80

30-12-2010 14:41:38

.NET 4.0 support is new in MonoDevelop 2.4.1:

WarehouseJim

30-12-2010 17:14:44

Happy Christmas & New Year.

I've found a possible bug with creating the font textures:

I create fonts using (paraphrased a bit)
 var g = this.CreateGraphics(); this.Dpi = new Vector2(g.DpiX, g.DpiY); string fontFileName = "bluehigh.ttf"; int pointSize = 32; var fontStyle = FontStyle.Regular; string miyagiFontName = "BlueHigh32"; TrueTypeFont.Create(miyagiSystem, miyagiFontName, fontFileName, pointSize * 96 / (int)Mogre.Math.Ceil(Dpi.y), (int)Mogre.Math.Ceil(Dpi.y), fontStyle, null); 

When you do this, parts of the characters from the row below in the bitmap enter the row above, typically where there are accents (see attached, and look at "j"). I assume I can get around this by skipping characters with accents, but obviously a proper solution would be better.

From what I can tell,
leading = (int)Math.Ceiling(font.GetHeight());
returns the right maximum height of the characters if you measure from the top of any one character to its bottom, but some characters seem vertically offset. It looks as if the characters are correctly being drawn vertically with (Leading+1) between the tops of each row.

Debug.WriteLine("Size " + c + " = " + size+ " location = ("+x+", "+y+")");
just after
g.DrawString(c, font, brush, x, y, sf);
in CreateFontBitmap(), I get
 Creating [FontFamily: Name=Blue Highway] size 32 Size = SizeF(0,37.54666) location = (0, 0) Size ! = SizeF(7.594666,37.54666) location = (1, 0) Size " = SizeF(9.983998,37.54666) location = (9.594666, 0) Size # = SizeF(21.07733,37.54666) location = (20.57866, 0) Size \$ = SizeF(17.32266,37.54666) location = (42.65599, 0) Size % = SizeF(20.65066,37.54666) location = (60.97866, 0) Size & = SizeF(24.02133,37.54666) location = (82.62932, 0) Size ' = SizeF(4.778666,37.54666) location = (107.6507, 0) Size ( = SizeF(9.941332,37.54666) location = (113.4293, 0) Size ) = SizeF(9.898665,37.54666) location = (124.3706, 0) Size * = SizeF(19.62666,37.54666) location = (135.2693, 0) Size + = SizeF(11.264,37.54666) location = (155.896, 0) Size , = SizeF(6.741332,37.54666) location = (168.16, 0) Size - = SizeF(10.24,37.54666) location = (175.9013, 0) Size . = SizeF(7.082666,37.54666) location = (187.1413, 0) Size / = SizeF(13.26933,37.54666) location = (195.224, 0) Size 0 = SizeF(20.56533,37.54666) location = (209.4933, 0) Size 1 = SizeF(8.746666,37.54666) location = (231.0586, 0) Size 2 = SizeF(17.36533,37.54666) location = (240.8053, 0) Size 3 = SizeF(16.512,37.54666) location = (259.1706, 0) Size 4 = SizeF(17.96266,37.54666) location = (276.6826, 0) Size 5 = SizeF(17.92,37.54666) location = (295.6453, 0) Size 6 = SizeF(16.93866,37.54666) location = (314.5653, 0) Size 7 = SizeF(16.59733,37.54666) location = (332.5039, 0) Size 8 = SizeF(17.36533,37.54666) location = (350.1013, 0) Size 9 = SizeF(17.024,37.54666) location = (368.4666, 0) Size : = SizeF(7.466666,37.54666) location = (386.4906, 0) Size ; = SizeF(6.869332,37.54666) location = (394.9572, 0) Size < = SizeF(18.98666,37.54666) location = (402.8266, 0) Size = = SizeF(12.33066,37.54666) location = (422.8132, 0) Size > = SizeF(18.98666,37.54666) location = (436.1439, 0) Size ? = SizeF(14.93333,37.54666) location = (456.1306, 0) Size @ = SizeF(20.56533,37.54666) location = (472.0639, 0) Size A = SizeF(19.24266,37.54666) location = (0, 40) Size B = SizeF(19.072,37.54666) location = (20.24266, 40) Size C = SizeF(20.56533,37.54666) location = (40.31466, 40) Size D = SizeF(21.20533,37.54666) location = (61.87999, 40) Size E = SizeF(16.42666,37.54666) location = (84.08532, 40) Size F = SizeF(15.40266,37.54666) location = (101.512, 40) Size G = SizeF(21.76,37.54666) location = (117.9146, 40) Size H = SizeF(20.13866,37.54666) location = (140.6746, 40) Size I = SizeF(7.637332,37.54666) location = (161.8133, 40) Size J = SizeF(12.88533,37.54666) location = (170.4506, 40) Size K = SizeF(20.26666,37.54666) location = (184.336, 40) Size L = SizeF(16.128,37.54666) location = (205.6026, 40) Size M = SizeF(23.63733,37.54666) location = (222.7306, 40) Size N = SizeF(20.224,37.54666) location = (247.368, 40) Size O = SizeF(22.22933,37.54666) location = (268.5919, 40) Size P = SizeF(18.60266,37.54666) location = (291.8213, 40) Size Q = SizeF(22.18666,37.54666) location = (311.424, 40) Size R = SizeF(19.49866,37.54666) location = (334.6106, 40) Size S = SizeF(17.74933,37.54666) location = (355.1093, 40) Size T = SizeF(18.64533,37.54666) location = (373.8586, 40) Size U = SizeF(19.88266,37.54666) location = (393.5039, 40) Size V = SizeF(20.52266,37.54666) location = (414.3866, 40) Size W = SizeF(31.06133,37.54666) location = (435.9093, 40) Size X = SizeF(21.58933,37.54666) location = (467.9706, 40) Size Y = SizeF(20.13866,37.54666) location = (490.5599, 40) Size Z = SizeF(18.688,37.54666) location = (0, 80) Size [ = SizeF(9.642666,37.54666) location = (19.688, 80) Size \ = SizeF(14.08,37.54666) location = (30.33066, 80) Size ] = SizeF(9.727999,37.54666) location = (45.41066, 80) Size ^ = SizeF(16.64,37.54666) location = (56.13866, 80) Size _ = SizeF(18.816,37.54666) location = (73.77866, 80) Size  = SizeF(6.655999,37.54666) location = (93.59466, 80) Size a = SizeF(16.68266,37.54666) location = (101.2507, 80) Size b = SizeF(17.152,37.54666) location = (118.9333, 80) Size c = SizeF(15.27466,37.54666) location = (137.0853, 80) Size d = SizeF(17.45066,37.54666) location = (153.36, 80) Size e = SizeF(17.28,37.54666) location = (171.8107, 80) Size f = SizeF(10.79467,37.54666) location = (190.0907, 80) Size g = SizeF(17.024,37.54666) location = (201.8853, 80) Size h = SizeF(16.68266,37.54666) location = (219.9093, 80) Size i = SizeF(7.551999,37.54666) location = (237.592, 80) Size j = SizeF(7.210666,37.54666) location = (246.144, 80) Size k = SizeF(16.42666,37.54666) location = (254.3546, 80) Size l = SizeF(7.551999,37.54666) location = (271.7813, 80) Size m = SizeF(27.34933,37.54666) location = (280.3333, 80) Size n = SizeF(17.36533,37.54666) location = (308.6826, 80) Size o = SizeF(17.28,37.54666) location = (327.048, 80) Size p = SizeF(17.152,37.54666) location = (345.328, 80) Size q = SizeF(17.23733,37.54666) location = (363.48, 80) Size r = SizeF(11.47733,37.54666) location = (381.7173, 80) Size s = SizeF(14.80533,37.54666) location = (394.1946, 80) Size t = SizeF(11.69066,37.54666) location = (410, 80) Size u = SizeF(17.45066,37.54666) location = (422.6906, 80) Size v = SizeF(16.29866,37.54666) location = (441.1413, 80) Size w = SizeF(26.79466,37.54666) location = (458.44, 80) Size x = SizeF(15.01866,37.54666) location = (486.2346, 80) Size y = SizeF(16.768,37.54666) location = (0, 120) Size z = SizeF(15.744,37.54666) location = (17.768, 120) Size { = SizeF(15.44533,37.54666) location = (34.512, 120) Size | = SizeF(5.503999,37.54666) location = (50.95733, 120) Size } = SizeF(15.488,37.54666) location = (57.46133, 120) Size ~ = SizeF(60.33066,37.54666) location = (73.94933, 120) Size  = SizeF(0,38.35416) location = (135.28, 120) Size  = SizeF(0,38.35416) location = (136.28, 120) Size  = SizeF(0,38.35416) location = (137.28, 120) Size  = SizeF(21.33333,38.35416) location = (138.28, 120) Size  = SizeF(21.33333,38.35416) location = (160.6133, 120) Size  = SizeF(0,38.35416) location = (182.9466, 120) Size = SizeF(0,38.35416) location = (183.9466, 120) Size  = SizeF(21.33333,38.35416) location = (184.9466, 120) Size  = SizeF(21.33333,38.35416) location = (207.28, 120) Size  = SizeF(15.54167,38.35416) location = (229.6133, 120) Size  = SizeF(33.375,38.35416) location = (246.155, 120) Size  = SizeF(20.625,38.35416) location = (280.53, 120) Size  = SizeF(21.33333,38.35416) location = (302.155, 120) Size  = SizeF(42.58333,38.35416) location = (324.4883, 120) Size  = SizeF(0,38.35416) location = (368.0717, 120) Size  = SizeF(0,38.35416) location = (369.0717, 120) Size  = SizeF(0,38.35416) location = (370.0717, 120) Size  = SizeF(0,38.35416) location = (371.0717, 120) Size  = SizeF(8.541666,38.35416) location = (372.0717, 120) Size  = SizeF(8.541666,38.35416) location = (381.6133, 120) Size  = SizeF(17.91667,38.35416) location = (391.155, 120) Size  = SizeF(17.91667,38.35416) location = (410.0716, 120) Size  = SizeF(0,38.35416) location = (428.9883, 120) Size  = SizeF(22.66667,38.35416) location = (429.9883, 120) Size  = SizeF(42.41666,38.35416) location = (453.6549, 120) Size  = SizeF(14.41667,38.35416) location = (497.0716, 120) Size  = SizeF(39.70833,38.35416) location = (0, 160) Size  = SizeF(15.54167,38.35416) location = (40.70833, 160) Size  = SizeF(10.66667,38.35416) location = (57.25, 160) Size  = SizeF(23.70833,38.35416) location = (68.91666, 160) Size  = SizeF(0,38.35416) location = (93.625, 160) Size  = SizeF(0,38.35416) location = (94.625, 160) Size  = SizeF(29.83333,38.35416) location = (95.625, 160) Size   = SizeF(11.33333,38.35416) location = (126.4583, 160) Size ¡ = SizeF(7.125332,37.54666) location = (138.7917, 160) Size ¢ = SizeF(16.64,37.54666) location = (146.917, 160) Size £ = SizeF(18.688,37.54666) location = (164.557, 160) Size ¤ = SizeF(16.59733,37.54666) location = (184.245, 160) Size ¥ = SizeF(20.13866,37.54666) location = (201.8423, 160) Size ¦ = SizeF(18.98666,37.54666) location = (222.981, 160) Size § = SizeF(16.64,37.54666) location = (242.9677, 160) Size ¨ = SizeF(14.336,37.54666) location = (260.6076, 160) Size © = SizeF(27.09333,37.54666) location = (275.9436, 160) Size ª = SizeF(15.79167,38.35416) location = (304.037, 160) Size « = SizeF(15.95733,37.54666) location = (320.8286, 160) Size ¬ = SizeF(24.91667,38.35416) location = (337.7859, 160) Size ­ = SizeF(0,38.35416) location = (363.7026, 160) Size ® = SizeF(23.04,37.54666) location = (364.7026, 160) Size ¯ = SizeF(12.58666,37.54666) location = (388.7426, 160) Size ° = SizeF(13.696,37.54666) location = (402.3293, 160) Size ± = SizeF(24.91667,38.35416) location = (417.0253, 160) Size ² = SizeF(14.20833,38.35416) location = (442.9419, 160) Size ³ = SizeF(14.20833,38.35416) location = (458.1503, 160) Size ´ = SizeF(6.613332,37.54666) location = (473.3586, 160) Size µ = SizeF(17.74933,37.54666) location = (480.972, 160) Size ¶ = SizeF(22.91667,38.35416) location = (0, 200) Size · = SizeF(11.85417,38.35416) location = (23.91667, 200) Size ¸ = SizeF(7.722666,37.54666) location = (36.77083, 200) Size ¹ = SizeF(14.20833,38.35416) location = (45.4935, 200) Size º = SizeF(15.58333,38.35416) location = (60.70183, 200) Size » = SizeF(16.46933,37.54666) location = (77.28516, 200) Size ¼ = SizeF(23.552,37.54666) location = (94.75449, 200) Size ½ = SizeF(25.51466,37.54666) location = (119.3065, 200) Size ¾ = SizeF(23.46666,37.54666) location = (145.8212, 200) Size ¿ = SizeF(14.976,37.54666) location = (170.2878, 200) Size À = SizeF(19.24266,37.54666) location = (186.2638, 200) Size Á = SizeF(19.24266,37.54666) location = (206.5065, 200) Size Â = SizeF(19.24266,37.54666) location = (226.7491, 200) Size Ã = SizeF(19.24266,37.54666) location = (246.9918, 200) Size Ä = SizeF(19.24266,37.54666) location = (267.2345, 200) Size Å = SizeF(19.24266,37.54666) location = (287.4771, 200) Size Æ = SizeF(27.22133,37.54666) location = (307.7198, 200) Size Ç = SizeF(20.56533,37.54666) location = (335.9412, 200) Size È = SizeF(16.42666,37.54666) location = (357.5065, 200) Size É = SizeF(16.42666,37.54666) location = (374.9332, 200) Size Ê = SizeF(16.42666,37.54666) location = (392.3598, 200) Size Ë = SizeF(16.42666,37.54666) location = (409.7865, 200) Size Ì = SizeF(7.637332,37.54666) location = (427.2132, 200) Size Í = SizeF(7.637332,37.54666) location = (435.8505, 200) Size Î = SizeF(7.637332,37.54666) location = (444.4878, 200) Size Ï = SizeF(7.637332,37.54666) location = (453.1252, 200) Size Ð = SizeF(21.20533,37.54666) location = (461.7625, 200) Size Ñ = SizeF(20.224,37.54666) location = (483.9678, 200) Size Ò = SizeF(22.22933,37.54666) location = (0, 240) Size Ó = SizeF(22.22933,37.54666) location = (23.22933, 240) Size Ô = SizeF(22.22933,37.54666) location = (46.45866, 240) Size Õ = SizeF(22.22933,37.54666) location = (69.68799, 240) Size Ö = SizeF(22.22933,37.54666) location = (92.91732, 240) Size × = SizeF(24.91667,38.35416) location = (116.1467, 240) Size Ø = SizeF(22.22933,37.54666) location = (142.0633, 240) Size Ù = SizeF(19.88266,37.54666) location = (165.2926, 240) Size Ú = SizeF(19.88266,37.54666) location = (186.1753, 240) Size Û = SizeF(19.88266,37.54666) location = (207.058, 240) Size Ü = SizeF(19.88266,37.54666) location = (227.9406, 240) Size Ý = SizeF(20.13866,37.54666) location = (248.8233, 240) Size Þ = SizeF(17.536,37.54666) location = (269.9619, 240) Size ß = SizeF(18.816,37.54666) location = (288.498, 240) Size à = SizeF(16.68266,37.54666) location = (308.314, 240) Size á = SizeF(16.68266,37.54666) location = (325.9966, 240) Size â = SizeF(16.68266,37.54666) location = (343.6793, 240) Size ã = SizeF(16.68266,37.54666) location = (361.362, 240) Size ä = SizeF(16.68266,37.54666) location = (379.0447, 240) Size å = SizeF(16.68266,37.54666) location = (396.7274, 240) Size æ = SizeF(23.85066,37.54666) location = (414.41, 240) Size ç = SizeF(15.27466,37.54666) location = (439.2607, 240) Size è = SizeF(17.28,37.54666) location = (455.5353, 240) Size é = SizeF(17.28,37.54666) location = (473.8153, 240) Size ê = SizeF(17.28,37.54666) location = (492.0953, 240) Size ë = SizeF(17.28,37.54666) location = (0, 280) Size ì = SizeF(7.637332,37.54666) location = (18.28, 280) Size í = SizeF(7.637332,37.54666) location = (26.91733, 280) Size î = SizeF(7.637332,37.54666) location = (35.55466, 280) Size ï = SizeF(7.637332,37.54666) location = (44.192, 280) Size ð = SizeF(16.93866,37.54666) location = (52.82933, 280) Size ñ = SizeF(17.36533,37.54666) location = (70.76799, 280) Size ò = SizeF(17.28,37.54666) location = (89.13332, 280) Size ó = SizeF(17.28,37.54666) location = (107.4133, 280) Size ô = SizeF(17.28,37.54666) location = (125.6933, 280) Size õ = SizeF(17.28,37.54666) location = (143.9733, 280) Size ö = SizeF(17.28,37.54666) location = (162.2533, 280) Size ÷ = SizeF(24.91667,38.35416) location = (180.5333, 280) Size ø = SizeF(17.28,37.54666) location = (206.45, 280) Size ù = SizeF(17.45066,37.54666) location = (224.73, 280) Size ú = SizeF(17.45066,37.54666) location = (243.1806, 280) Size û = SizeF(17.45066,37.54666) location = (261.6313, 280) Size ü = SizeF(17.45066,37.54666) location = (280.082, 280) Size ý = SizeF(16.768,37.54666) location = (298.5326, 280) Size þ = SizeF(17.152,37.54666) location = (316.3006, 280) Size ÿ = SizeF(16.768,37.54666) location = (334.4526, 280) 

This effect happens with smaller font sizes, but is barely noticeable as the font has blurred edges.

WarehouseJim

30-12-2010 17:49:25

For anyone else with this problem, my hack is to do:
 List<Range> validRanges = new List<Range>(); validRanges.Add(new Range(32, 0x7E)); //see http://www.fileformat.info/info/charset/UTF-32/list.htm TrueTypeFont.Create(....., validRanges); 
YMMV

Pyritie

30-12-2010 18:13:29

Are you sure that isn't just a problem with the font itself? I know each glyph has a specified height and width, and accents and the dangly bit of the "j" are generally outside of those "bounds".

smiley80

30-12-2010 19:39:50

The problem is that 'Graphics.DrawString' draws the 'diacritic area' (can't remember the proper term) for some glyphs above the specified coordinates:

I'm not sure if that's a glitch in the bluehigh font, or if there's a setting in 'StringFormat' which fixes that.

However, it works better with other fonts (e.g. DejaVu Sans):

nico008

31-12-2010 01:10:54

Hi

I have this :
fHealth = new ProgressBar("Health") { Size = new Size(140, 18), Location = new Point(90, 35), ProgressBarStyle = { Mode = ProgressBarMode.Continuous, }, TextStyle = { Alignment = Alignment.MiddleCenter, Font = Resources.Fonts["BlueHighwayWhite"], ForegroundColour = Colours.White }, Skin = Resources.Skins["HealthSkin"] }; ... fHealth.Text = "blabla"; fHealth.Value = 100; 

The problem : the text "blabla" is hidden when progressbar is full. How can I avoid this behaviour?

smiley80

01-01-2011 11:40:58

Fixed in the latest revision.

nico008

01-01-2011 14:24:39

Thanks
It works fine now!
Happy new year to you

nico008

01-01-2011 17:17:41

When I click on a Panel, it brings it to front.
In some case I don't want this behaviour
How can I avoid this please? (it would be a sort of AlwaysOnBack)
Also, have you ever tried putting some "\n\r" in ToolTipText property?
It doesn't display the second line for me.

smiley80

01-01-2011 18:32:08

When I click on a Panel, it brings it to front.

Added in latest revision as Control.AlwaysOnBottom.

Also, have you ever tried putting some "\n\r" in ToolTipText property?

You have to set 'ToolTipStyle.TextStyle.Multiline' to 'true', and it's "\r\n" or (better) Environment.NewLine.

nico008

01-01-2011 22:59:05

Both work perfectly thank you

nico008

03-01-2011 23:12:11

Hey you!

I still can't get multiline working in listbox
My code :

 fCurrentLine = new ListItem(""); fCurrentLine.Style.TextStyle.WordWrap = true; fCurrentLine.Style.TextStyle.Multiline = true; fCurrentLine.Text += "blabla" + Environment.NewLine + "not displayed :("; //or a long string without newline Items.Add(fCurrentLine); 

But multiline is working fine for some other components (like ToolTip, Label, etc)

What should I do?

smiley80

04-01-2011 11:04:28

It should display the second line if the height of the listbox item is large enough.
Btw TextStyle.Multiline & TextStyle.WordWrap are now true by default.

WarehouseJim

04-01-2011 11:11:26

Going back to the font rendering issues....

I changed to DejaVuSans.ttf and the "I" character has a little bit of "J" in it from the left hand side.

I'm not saying it would be a perfect solution, but a better way of creating the font texture may be to render each character to a bitmap with size of Graphics.MeasureString and paste into the main bitmap so that one character can't overlap any other character (as any writing beyond the bounds of the mini bitmap would be ignored).

nico008

04-01-2011 11:54:24

Is it possible to set autoSize = true?
Because I don't know the required size. Number of line can vary
Note that I'm not able to specify listbox item height at all
Can you give me a peace of code with multiline in listbox working?

smiley80

04-01-2011 14:12:16

Going back to the font rendering issues....
I've found the reason why it didn't clip the glyphs. Should work now with the latest revision.

Is it possible to set autoSize = true?
Because I don't know the required size. Number of line can vary
Note that I'm not able to specify listbox item height at all
Can you give me a peace of code with multiline in listbox working?

If you try to do something like a console, there's now an example showing how to achieve that.

nico008

04-01-2011 16:38:19

But for me it's a bit strange to use a panel.
Why not use a ListBox?
So I could use ScrollToBottom();

smiley80

04-01-2011 18:15:38

Why not use a ListBox?
Because ListBox doesn't support variable-sized items, atm.
So I could use ScrollToBottom();
Done.

nico008

04-01-2011 22:37:01

Thanks for the ScrollToBottom()
But for some strange reason multiline is still now working.
Eventhought I tryed this :
Label label = new Label { ... AutoSize = true, MaxSize = new Miyagi.Common.Data.Size(300, 1024), ... } 

Forcing Size makes multiline work but I can't gess the correct size:
MinSize = new Size(300, 20),

Edit:
Actually, when I add some Environment.NewLine + Environment.NewLine + Environment.NewLine then Multiline works better. But then of course a single line has some free space under it...
So I guess there is a bug in multiline

Two other little problems :
How to make some free space near border of my console? (it was ok with ListBox)
I tried setting Margin and BorderStyle.Tickness but it doesn't change anything

My console has Movable = true. But now if I clic on the text of my console, I can't move it anymore (it was also ok with ListBox).
I tried setting label.Enabled = false but it's not working (and it is not the right way I think)

Thank again & again :p

smiley80

05-01-2011 00:03:20

How to make some free space near border of my console? (it was ok with ListBox)

My console has Movable = true. But now if I clic on the text of my console, I can't move it anymore (it was also ok with ListBox).
I tried setting label.Enabled = false but it's not working (and it is not the right way I think)

Should work that way (ie. Panel.Movable=true, Label.Enabled=false).
Please check what's return by GUIManager.GetTopControl when you try to click on the panel.

nico008

05-01-2011 00:21:03

Control.Padding is what I was looking for

Should work that way (ie. Panel.Movable=true, Label.Enabled=false).
-> this is exactly what I was doing but Enabled=false has no effect.
GetTopControl says UnnamedLabel25 and display false when I display Enabled.ToString().

Good luck for solving multiline and enabled bugs!

Actually, when I add some Environment.NewLine + Environment.NewLine + Environment.NewLine then Multiline works better. But then of course a single line has some free space under it...
So you should try adding a long line like "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwEND" and see if "END" is written next line or not.

Also I remember a lot of time ago Miyagi had fading/fadout animation for some Controls. Is it still possible to use them?

smiley80

05-01-2011 10:15:00

-> this is exactly what I was doing but Enabled=false has no effect.

I'm sorry, Enabled=false doesn't cause the hit test to fail, you have to do:
label.SuccessfulHitTest += (s, e) => e.Cancel = true;

So you should try adding a long line like "wwww[snip]wwwEND" and see if "END" is written next line or not.

There's a problem with AutoSize and MaxSize, I'll look into it.
Edit: Should be fixed now.

Also I remember a lot of time ago Miyagi had fading/fadout animation for some Controls. Is it still possible to use them?

WarehouseJim

05-01-2011 12:05:37

I've just updated from Mercurial. Thanks for the changes.

One suggestion: InteractiveElements.GetDefaultTexture() - it may be worth having a null check on this.Owner.Skin, and returning null if it's null. In my case I don't specify a skin for panels, so I added this. You can tell me I'm lazy and should fix my panels though!

smiley80

05-01-2011 13:34:28

Already fixed in the latest revision.

nico008

05-01-2011 13:40:19

Everything works fine now

Just a little thing I would maybe change :
Visible property should return false when Opacity is 0 and setting Opacity to > 0 should change Visible to true (in my opinion)

smiley80

05-01-2011 16:55:19

I'd like to keep those two separate.

kubatp

09-01-2011 17:03:48

Hi Smiley,
from time to time it throws unexpectely an exception "System.ArgumentOutOfRangeException" on line number 120 file FastSmartWeatEvent. Do you any ideas why is this happening? It is just from time to time.

I would like to ask you for one thing - would it be possible to implement tooltip for each listItem in listbox?

I have a listbox with number of options to select and I would like to use tooltip for better description.

smiley80

09-01-2011 19:59:27

from time to time it throws unexpectely an exception "System.ArgumentOutOfRangeException" on line number 120 file FastSmartWeatEvent. Do you any ideas why is this happening?

Race condition. Try adding "lock (this)" at the beginning of the method (line #113). You still call Miyagi from different threads.

I would like to ask you for one thing - would it be possible to implement tooltip for each listItem in listbox?

I'll look into it.
Edit: Done

kubatp

10-01-2011 10:48:27

Hi Smiley,
I have downloaded the latest and thank you for the tooltip. I probably found a small bug, it throws the exception "null reference" on line no. 343 of ListItem.cs - when Owner is null. It is called from GUIManager line 674.
Could you please take a look?

I still think about this threading issue and I couldnt find a line where could this happen till now. I know we came across this long time ago, but once again - when I am creating terrain (it is a big chunk of work for Mogre), GUI freezes for this period. Because I wanted to update at least progress bar, I have created this function:

private void UpdateGUI() { CurrentGUI.Update(); ModalGUI.Update(); RenderWindow.Update(); MiyagiSystem.RenderManager.DoRender(); }

Is this function correct? How should I call this?

smiley80

10-01-2011 15:12:40

Could you please take a look?

Fixed.

I still think about this threading issue and I couldnt find a line where could this happen till now. I know we came across this long time ago, but once again - when I am creating terrain (it is a big chunk of work for Mogre), GUI freezes for this period. Because I wanted to update at least progress bar, I have created this function:

This works for me:
private void UpdateGUI() { Root.Singleton.RenderOneFrame(); Root.Singleton._updateAllRenderTargets(); WindowEventUtilities.MessagePump(); }
If you don't call MiyagiSystem.Update in the FrameStarted eventhandler you have to add that after RenderOneFrame, and it has to be called from the main thread.

WarehouseJim

10-01-2011 15:55:29

With copy and paste into TextBoxes (TextBoxElement.HandleClipboard):

1) You need a null check on Clipboard.Text before trying insert (it is null upon startup)

2) I would like to use the System.Windows.Forms.Clipboard so that I can copy and paste between applications. Is there a neat way to do this? I assume I could do it by adding an event to capture (from MOIS in my case) CTRL+C after Miyagi has been started (so that it can access the Miyagi clipboard once TextBoxElement.HandleClipboard has been called), and adding an event to CTRL+V that is set before Miyagi is started that sets Miyagi's clipboard before Miyagi attempts to paste. All round, it seems a bit messy and liable to events firing in the wrong order etc.

smiley80

10-01-2011 17:22:26

The clipboard now uses System.Windows.Forms.Clipboard when possible, i.e. when the thread apartment state is STA.

WarehouseJim

13-01-2011 12:56:41

In TextElement.SetSelectedText() I got an exception as it tried to run
 var quads = new Quad[count]; 
with count =-1; as selectedQuadOffset=0; min=1; max = 1; Sprite.PrimitiveCount = 1;

I was doing various clicking around the textbox so I couldn't tell you exactly what lead to it, but the frozen on-screen frame shows nothing sleected and me clicking near the right hand edge of the textbox. The actual exception was an OverFlowException, but I assume it is just due to trying to construct an array with -1 elements.

WarehouseJim

13-01-2011 17:19:48

I have another problem (not sure if it's a bug or me):

I use a multi-line label to display some text, which varies in length. It is set to AutoSize = true and contained in a scrollable panel. When I increase the amount of text, the scroll bar appears as, I assume, the label has increased in size. However, when I reduce the amount of text, the scroll bar remains, so I assume the label isn't shrinking down.

smiley80

13-01-2011 19:30:24

In TextElement.SetSelectedText() I got an exception as it tried to run

Fixed.
I use a multi-line label to display some text, which varies in length. It is set to AutoSize = true and contained in a scrollable panel. When I increase the amount of text, the scroll bar appears as, I assume, the label has increased in size. However, when I reduce the amount of text, the scroll bar remains, so I assume the label isn't shrinking down.
myLabel.AutoSizeMode = AutoSizeMode.GrowAndShrink;

kubatp

19-01-2011 11:53:06

Hi Smiley,
I would suggest another improvement.
Could every ListItem have property name "ObjectData" (with type object) where the actual data object for every listItem can be stored? It could simplify things.

smiley80

19-01-2011 14:58:43

Done. But it's called ListItem.UserData since there's already Control.UserData.

kubatp

19-01-2011 16:29:30

Thank you Smiley.
I presume the Control.UserData is there for the same purpose, correct?

kubatp

19-01-2011 16:50:30

I have just downloaded latest version and found out, that Skin.CreateFromFiles has been removed. Can I ask you why was it removed? Do you want to force users to create skins just from XML files?
Is there a way to create Skin as before?

I don't plan to change GUI of my application (co the config file is not necessary) and I have all in code already. Do I really need to put all in XML file?

smiley80

19-01-2011 17:24:30

Thank you Smiley.
I presume the Control.UserData is there for the same purpose, correct?

Yes.
Is there a way to create Skin as before?
private static Skin CreateFromFiles(string name, string path, string fileName) { var files = Directory.GetFiles(path, fileName + ".*"); var retValue = new Skin(name); foreach (string textureFile in files) { string skinName = Path.GetFileNameWithoutExtension(textureFile); if (skinName == null) { continue; } skinName = skinName.Contains('.') ? ReplaceFirst(skinName, skinName.Substring(0, skinName.IndexOf('.')), name) : name; retValue.SubSkins[skinName] = new Texture(textureFile); } return retValue; } private static string ReplaceFirst(string self, string oldValue, string newValue) { int pos = self.IndexOf(oldValue); if (pos < 0) { return self; } return self.Substring(0, pos) + newValue + self.Substring(pos + oldValue.Length); }

cabritito

20-01-2011 17:26:02

I'm using Miyagi 1.2.
I can't use the resolution-agnostic feature. I don't need to change the resolution in runtime. The Location property is a Point constructed with two integers, not floats. Size has the same problem.

Thx

the guis are now resolution-agnostic. If you pass a float between 0 and 1 in the position and size constructor, it is interpretated as a percentage of the screen resolution.

smiley80

20-01-2011 18:17:04

You can use 'GUIManager.Resize' for that:
MiyagiSystem.GUIManager.Resize((double)newSize.Width / oldSize.Width, (double)newSize.Height / oldSize.Height);
Where 'oldSize' is the arbitrary reference size you've used while creating the controls.

CodeKrash

20-01-2011 19:25:44

nm

smiley80

22-01-2011 19:41:56

It'll work if the apartment state of that thread is STA.

kubatp

25-01-2011 09:13:27

Hi Smiley,
I am thinking about a cool feature, which can improve the user experience for my application. I would like to add "image" to beginning of every list item in listbox. Is there a workaround how can this be done?

Just for imagination, I attach first image I have found on google, similar to the approach I try to achieve
Thank you

smiley80

25-01-2011 18:07:07

ListItem has a constuctor that takes a filename of a texture as the second parameter:
new ListItem("Item1", "myListBoxTexture.png")
But for the texture you have to take into account, that it's currently stretched to the ListItem size.
And you have to adjust the text offset with 'ListItem.Style.TextStyle.Offset'.

kubatp

26-01-2011 00:51:19

Hi Smiley,
yes, that is what I thought. The stretching is a problem, because I dont have constant height for all ListBoxes. I will leave this for now.
Thank you

kubatp

27-01-2011 00:03:37

Hi Smiley,
just a quick question. I have a mouse click event handler on panel. On this panel, I add another panel with scrollbar. When I scroll the inner panel with mouse and fire "mouse up" event, it automatically fires onclick of parent panel. Is this expecting behavior?If so, how can I avoid to bubble this event to outer panel?
THank you

Pyritie

28-01-2011 13:40:52

I dunno if I should start a new thread for this or not but since I noticed you have plugins for both lua and python and I've heard those are both two good scripting languages for non-coders to learn (i.e. artists), which would be better to use with mogre? In particular which is better for hooking into c# events?

smiley80

28-01-2011 18:00:09

@kubatp:
No, that shouldn't happen. Unfortunately, I'm not able to reproduce this behaviour. MouseUp and MouseClick should both go to the currently focused control.

@Pyritie:
I prefer Boo. It's a statically/duck typed language with a very Python-like syntax.

Pyritie

29-01-2011 13:51:11

@Pyritie:
I prefer Boo. It's a statically/duck typed language with a very Python-like syntax.

Does it work well with events?

kubatp

29-01-2011 15:19:39

@kubatp:
No, that shouldn't happen. Unfortunately, I'm not able to reproduce this behaviour. MouseUp and MouseClick should both go to the currently focused control.

ok, maybe I should clarify it. It actually doesnt fire onclick of parent panel, but the scroll panel. I.e. - I scroll the scrollable panel and when I release the mouse button it fires the onclick handler of the panel.

smiley80

29-01-2011 22:43:37

@Pyritie:
Subscribing to events inside a script would work the same way as in C#.

@kubatp:
You could add a check in the eventhandler like this:
 var control = (Control)sender; bool hit = control.DisplayRectangle.Contains(e.MouseLocation - control.GetLocationInViewport());
'hit' is false when the click was over the scrollbar or the border.

kubatp

29-01-2011 23:02:24

Thank you Smiley. This really works and I am happy for this. But if I can suggest an improvement, it shouldn't fire onclick even I move mouse cursor during scrolling outside the scrollbar. When I do the same in win forms, it doesnt fire the onclick event on the specified top control, when I have just finished the scrolling.

smiley80

01-02-2011 10:54:23

Done. MouseUp, MouseDown, MouseClick, and MouseDoubleClick are no longer raised when the mouse is over a scrollbar.

kubatp

01-02-2011 11:35:38

Hi Smiley,

Done. MouseUp, MouseDown, MouseClick, and MouseDoubleClick are no longer raised when the mouse is over a scrollbar.
thank you! This works perfectly.

I have possibly found a new bug (new since the the changes from 29th). When I use picturebox.Bitmap to set a new bitmap, the picturebox doesnt display a new picture. I did just a quick debug of Miyagi and it seems like, the new picture gets lost in SetBitmap in pictureBox line 155. It is called from BitmapControl.UpdateCore to PictureBox.UpdateBitmap where it calls this SetBitmap. the new picture (correct one) is already set in "bitmap" variable, which this call deletes.

Acnirak

02-02-2011 15:23:41

Hi i am new with Miyagi, i have ran it,but some samples code with miyagi 1.2 would be great because although i have ran it, i have some troubles to show some controls.

smiley80

03-02-2011 03:52:18

@kubatp:
Should work again.

@Acnirak:
Examples:
http://miyagi.hg.sourceforge.net/hgweb/ ... n/Examples
Mogre-specific examples:
http://miyagi.hg.sourceforge.net/hgweb/ ... ples/Mogre
Resource creation (mainly loading from xml files, I'll extent it in the next few days):
http://miyagi.hg.sourceforge.net/hgweb/ ... sources.cs

Acnirak

04-02-2011 12:05:23

Now i am using miyagi too , in our project because of having more than one render window i found Miyagi very useful (I had some problems with singleton GUI's which takes renderwindow in its singleton constructor), Miyagi design is very useful for different situations, good work and tnx for help.

Acnirak

08-02-2011 12:58:37

Hi again, i wanted to ask about inputmanager, i am not using mois and i am just giving my mouse coordinates to miyagi by mousemove event by this way:
void ClassMogrePanel_MouseMove(object sender, MouseEventArgs e)
{
_MogrePanelGUI.MiyagiSystem.InputManager.MouseLocation = new Miyagi.Common.Data.Point(e.X, e.Y);
}

it works and whenever i listen this event from a control they capture mouse location, but although i update the current mouse Location of input Manager, the native events of these controls ( like mouseenter) is not been triggered, maybe i have overlooked something and wanted to ask.

smiley80

08-02-2011 14:16:54

The mouse events aren't raised when GUIManager.Cursor is null or when it's invisible.
The latest revision introduced 'GUIManager.CheckCursorVisibility', which overrides this behaviour when set to false.

Acnirak

08-02-2011 15:33:58

Yes, i have used this new property, but whenever i set it to false;
in
Miyagi.UI.GUIManager
private void InputManagerMouseLocationChanged(object sender, ChangedValueEventArgs<Point> e) { if (this.IsCursorVisible) { this.Cursor.Location = e.NewValue - this.Cursor.ActiveHotspot;`

gives null exception (cursor was null when i was using this part).
I went around this problem by creating Cursor and setting its visibility to false but just wanted to say this because you may want to put some control mechanism.

Thanks for help and quick response.