loads tileset.
needs a lot of rework, cant push existing implementation into hardware. git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1107 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -11,7 +11,13 @@ namespace OpenRa.Game
|
||||
{
|
||||
class MainWindow : Form
|
||||
{
|
||||
GraphicsDevice device;
|
||||
readonly GraphicsDevice device;
|
||||
readonly Map map;
|
||||
readonly TileSet tileSet;
|
||||
|
||||
Palette pal;
|
||||
Package TileMix;
|
||||
string TileSuffix;
|
||||
|
||||
const string mapName = "scm12ea.ini";
|
||||
|
||||
@@ -24,9 +30,11 @@ namespace OpenRa.Game
|
||||
device = GraphicsDevice.Create(this, ClientSize.Width, ClientSize.Height, true, false);
|
||||
|
||||
IniFile mapFile = new IniFile(File.OpenRead("../../../" + mapName));
|
||||
Map map = new Map(mapFile);
|
||||
map = new Map(mapFile);
|
||||
|
||||
Text = string.Format("OpenRA - {0} - {1}", map.Title, mapName);
|
||||
|
||||
tileSet = LoadTileSet(map);
|
||||
}
|
||||
|
||||
internal void Run()
|
||||
@@ -43,8 +51,35 @@ namespace OpenRa.Game
|
||||
device.Begin();
|
||||
device.Clear(0);
|
||||
|
||||
// render something :)
|
||||
|
||||
device.End();
|
||||
device.Present();
|
||||
}
|
||||
|
||||
TileSet LoadTileSet(Map currentMap)
|
||||
{
|
||||
switch (currentMap.Theater.ToLowerInvariant())
|
||||
{
|
||||
case "temperate":
|
||||
pal = new Palette(File.OpenRead("../../../temperat.pal"));
|
||||
TileMix = new Package("../../../temperat.mix");
|
||||
TileSuffix = ".tem";
|
||||
break;
|
||||
case "snow":
|
||||
pal = new Palette(File.OpenRead("../../../snow.pal"));
|
||||
TileMix = new Package("../../../snow.mix");
|
||||
TileSuffix = ".sno";
|
||||
break;
|
||||
case "interior":
|
||||
pal = new Palette(File.OpenRead("../../../interior.pal"));
|
||||
TileMix = new Package("../../../interior.mix");
|
||||
TileSuffix = ".int";
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
return new TileSet(TileMix, TileSuffix, pal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user