Skip to content

Commit 1dc49fa

Browse files
committed
Adding gdx skin importer
1 parent be9d45e commit 1dc49fa

File tree

14 files changed

+3023
-1
lines changed

14 files changed

+3023
-1
lines changed

build/Myra.MonoGame.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Myra.Samples.TextRendering.
3535
EndProject
3636
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Myra.Samples.Notepad.MonoGame", "..\samples\Myra.Samples.Notepad\Myra.Samples.Notepad.MonoGame.csproj", "{2388B303-FE21-45CC-80D2-3007E959EBCD}"
3737
EndProject
38+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GdxSkinImport", "..\src\GdxSkinImport\GdxSkinImport.csproj", "{4C116BE6-EB40-4C87-BC43-6666D7925C70}"
39+
EndProject
3840
Global
3941
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4042
Debug|Any CPU = Debug|Any CPU
@@ -101,6 +103,10 @@ Global
101103
{2388B303-FE21-45CC-80D2-3007E959EBCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
102104
{2388B303-FE21-45CC-80D2-3007E959EBCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
103105
{2388B303-FE21-45CC-80D2-3007E959EBCD}.Release|Any CPU.Build.0 = Release|Any CPU
106+
{4C116BE6-EB40-4C87-BC43-6666D7925C70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
107+
{4C116BE6-EB40-4C87-BC43-6666D7925C70}.Debug|Any CPU.Build.0 = Debug|Any CPU
108+
{4C116BE6-EB40-4C87-BC43-6666D7925C70}.Release|Any CPU.ActiveCfg = Release|Any CPU
109+
{4C116BE6-EB40-4C87-BC43-6666D7925C70}.Release|Any CPU.Build.0 = Release|Any CPU
104110
EndGlobalSection
105111
GlobalSection(SolutionProperties) = preSolution
106112
HideSolutionNode = FALSE

samples/Myra.Samples.DebugConsole/DebugPanel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public DebugPanel()
1414
_buttonHideDebug.Click += _buttonHideDebug_Click;
1515
}
1616

17-
private void _buttonHideDebug_Click(object sender, System.EventArgs e)
17+
private void _buttonHideDebug_Click(object sender, EventArgs e)
1818
{
1919
RemoveFromDesktop();
2020

src/Myra.GdxSkinImport/Game1.cs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using GdxSkinImport.MonoGdx;
2+
using Microsoft.Xna.Framework;
3+
using Microsoft.Xna.Framework.Graphics;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Diagnostics;
7+
using System.Globalization;
8+
using System.IO;
9+
using System.Text.Json;
10+
11+
namespace GdxSkinImport;
12+
13+
/// <summary>
14+
/// This is the main type for your game.
15+
/// </summary>
16+
public class Game1 : Game
17+
{
18+
private readonly GraphicsDeviceManager _graphics;
19+
private readonly string _inputFile;
20+
21+
public Game1(string inputFile)
22+
{
23+
_inputFile = inputFile;
24+
25+
_graphics = new GraphicsDeviceManager(this)
26+
{
27+
PreferredBackBufferWidth = 1200,
28+
PreferredBackBufferHeight = 800
29+
};
30+
31+
Window.AllowUserResizing = true;
32+
IsMouseVisible = true;
33+
Content.RootDirectory = inputFile;
34+
}
35+
36+
protected override void LoadContent()
37+
{
38+
TextureAtlas atlas = null;
39+
var atlasFile = Path.ChangeExtension(_inputFile, "atlas");
40+
if (File.Exists(atlasFile))
41+
{
42+
atlas = new TextureAtlas(GraphicsDevice, atlasFile);
43+
}
44+
45+
Dictionary<string, object> data;
46+
using (TextReader reader = new StreamReader(_inputFile))
47+
{
48+
data = Json.Deserialize(reader) as Dictionary<string, object>;
49+
}
50+
51+
Exit();
52+
}
53+
54+
protected override void Update(GameTime gameTime)
55+
{
56+
base.Update(gameTime);
57+
}
58+
59+
/// This is called when the game should draw itself.
60+
/// </summary>
61+
/// <param name="gameTime">Provides a snapshot of timing values.</param>
62+
protected override void Draw(GameTime gameTime)
63+
{
64+
GraphicsDevice.Clear(Color.CornflowerBlue);
65+
66+
base.Draw(gameTime);
67+
}
68+
}

0 commit comments

Comments
 (0)