Miyagi?

Pyritie

23-02-2012 15:06:31

Where'd the Miyagi thread go?

I needed to look up how to do something and it looks like it was deleted

Zonder

24-02-2012 15:32:27

I have to agree looks like it's vanished :o

tafkag

24-02-2012 17:02:02

Did somebody push the wrong button? :?

zarfius

02-03-2012 22:16:31

Maybe you'll have some luck with the Google cached version?
http://webcache.googleusercontent.com/s ... clnk&gl=au

It is very troubling though, if you do find something useful it should probably be extracted before it's lost forever.

Aralox

15-03-2012 10:29:18

Hey guys, Im trying my best to get miyagi working but am at a standstill, as I cannot seem to get Labels working.

I think I get the basics of how to set Miyagi up, and managed to get a PictureBox working. However when I create a label as follows:

var label = new Label
{
Text = "hello miyagi",
Size = new Size(256, 32),
Location = new Point(256, 340),
};


And add it to my Gui object, upon Update(), I get a NullReferenceException, which occurs at
Miyagi.UI.Controls.Elements.TextElement.UpdateCore() in the stack trace.

I suspect that the null reference involves the Font, as Font.Default is set to null. Ive spent alot of time trying to convert a Mogre or Winforms font to a Miyagi one,
but to no avail.

Could anybody help? It doesnt need to be an elaborate answer, anything pointing me in the right direction will be appreciated!

Thanks :)

tafkag

15-03-2012 11:09:42

I'm a Miyagi beginner myself, but this is how I set up a font:


string fontPath = path + @"Miyagi\Gfx\Fonts\TrueTypeFonts.xml";
try
{
foreach (Font font in TrueTypeFont.CreateFromXml(fontPath, _miyagiSystem))
_fonts.Add(font.Name, font);
}
catch (Exception ex)
{
// log error
}


The TrueTypeFonts.xml looks like this and you need the *.ttf file at the stated location.


<?xml version="1.0" encoding="utf-8"?>
<TrueTypeFonts>
<TrueTypeFont Name="ArialBig">
<FileName>Content\General\Fonts\Arial.ttf</FileName>
<FontStyle>Regular</FontStyle>
<Resolution>96</Resolution>
<Size>16</Size>
</TrueTypeFont>
</TrueTypeFonts>


And now you should be able to set the label font.


var label = new Label
{
Font = _fonts["ArialBig"],
Text = "hello miyagi",
Size = new Size(256, 32),
Location = new Point(256, 340),
};


I don't use labels myself, but this is how I've done it with my button and panel...

Pyritie

15-03-2012 11:11:13

Hey guys, Im trying my best to get miyagi working but am at a standstill, as I cannot seem to get Labels working.

I think I get the basics of how to set Miyagi up, and managed to get a PictureBox working. However when I create a label as follows:

var label = new Label
{
Text = "hello miyagi",
Size = new Size(256, 32),
Location = new Point(256, 340),
};


And add it to my Gui object, upon Update(), I get a NullReferenceException, which occurs at
Miyagi.UI.Controls.Elements.TextElement.UpdateCore() in the stack trace.

I suspect that the null reference involves the Font, as Font.Default is set to null. Ive spent alot of time trying to convert a Mogre or Winforms font to a Miyagi one,
but to no avail.

Could anybody help? It doesnt need to be an elaborate answer, anything pointing me in the right direction will be appreciated!

Thanks :)

Yeah, the font (or lack thereof) is probably the problem

Here's how I create my fonts

private static void CreateFonts(MiyagiSystem system) {
var files = Directory.EnumerateFiles(_resourcesFileLocation + "Fonts", "*" + _miyagiXMLExtension, SearchOption.AllDirectories);

var fonts = new List<Font>();

foreach (string file in files) {
fonts.AddRange(ImageFont.CreateFromXml(file, system));
}

Fonts = fonts.ToDictionary(f => f.Name);

// set BlueHighway as default font
Font.Default = Fonts["BlueHighway"];
}


But this requires you've got them set up as images already, which you can do with

public void ExportImageFont(string ttfName, FontStyle style = FontStyle.Regular, int size = 12, int resolution = 96) {
TrueTypeFont.TrueTypeToImageFont("media/gui/Fonts/", "media/gui/Fonts/" + ttfName, style, size, resolution);
}


There's probably something similar for creating them straight from TTF fonts instead of going through the image process.

Aralox

15-03-2012 11:27:03

Thanks so much for the replies guys! Its great to know there are such helpful people here <3
I've got it working now, and can finally keep building my game :)

Aralox

23-03-2012 08:59:21

Hey guys, I have another question:
How would one go about generating an xml like this - http://pastebin.com/X5uCA6z8, which is used in the miyagi demo to reference this image:
http://i.imgur.com/PRrsi.png

I had a look at the slice and image map features in gimp, but they seem to only generate html.

Thanks!

Pyritie

23-03-2012 10:31:38

you can either write it yourself by hand or use a tool miyagi comes with, called the Skin Editor

Aralox

23-03-2012 11:25:56

Oh sweet- where can i find it? I cant find it in the sourceforge download, and did a quick google search but turned up with this http://miyagi.hg.sourceforge.net/hgweb/miyagi/miyagi/diff/5f9801e27bf0/Tools/SkinEditor/Gui/CreateSkinFromTemplateForm.Designer.cs which isnt very helpful. I dont know enough about navigating files on sourceforge to find it :P

Pyritie

23-03-2012 11:30:49

I forgot where I got it from

http://www.mediafire.com/?28hwh8my44j4chv

it's a bit buggy though

Aralox

27-03-2012 00:48:30

Thanks for that pyritie :)
Ive got the hang of it now that Ive experimented with it a little. I have another question: Is there a reliable way of finding out which parts of controls map to which subskin names?
I've sort of figured out that if a subskin is named <something>.<event> that skin is mapped to that event, eg. mySkin.MouseMove. But then you also have 'Bar' for progress bars, which doesnt seem to be documented anywhere, I just found it in the example skin.

I actually want to write a class derived from SkinnedControl, but need to figure out how to map different subskin names to different parts of my control.

EDIT: I just realised that i can look through the SubSkins property of the Skin that is assigned to my control to customise my mapping, so dont worry about the last statement :P

EDIT 2: Never mind! I just found out about creating skins from the template. its all there :oops:

Thanks! :D

zarfius

27-03-2012 02:38:46

I forgot where I got it from
http://www.mediafire.com/?28hwh8my44j4chv
it's a bit buggy though

Just in case this download link goes dead I've uploaded it to my web server too.
http://www.craftworkgames.com/downloads ... editor.zip

Aralox

29-03-2012 13:36:53

Hey guys, I wrote an exporter for Sprite Sheet Packer - Its tons easier to create skins using that instead of the skin editor.
see here: http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=29387