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
I needed to look up how to do something and it looks like it was deleted
Pyritie
23-02-2012 15:06:31
Zonder
24-02-2012 15:32:27
tafkag
24-02-2012 17:02:02
zarfius
02-03-2012 22:16:31
Aralox
15-03-2012 10:29:18
var label = new Label
{
Text = "hello miyagi",
Size = new Size(256, 32),
Location = new Point(256, 340),
};
tafkag
15-03-2012 11:09:42
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
}
<?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>
var label = new Label
{
Font = _fonts["ArialBig"],
Text = "hello miyagi",
Size = new Size(256, 32),
Location = new Point(256, 340),
};
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
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"];
}
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);
}
Aralox
15-03-2012 11:27:03
Aralox
23-03-2012 08:59:21
Pyritie
23-03-2012 10:31:38
Aralox
23-03-2012 11:25:56
Pyritie
23-03-2012 11:30:49
Aralox
27-03-2012 00:48:30
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
Aralox
29-03-2012 13:36:53