git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@2049 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Drawing;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
using System.Windows.Forms;
|
||||
using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
class ConstructionYard : Building
|
||||
{
|
||||
public ConstructionYard( int2 location, Player owner, Game game )
|
||||
: base( "fact", location, owner, game )
|
||||
{
|
||||
animation.PlayThen("make", () => animation.PlayRepeating("build"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
@@ -45,10 +44,9 @@ namespace OpenRa.Game
|
||||
|
||||
network = new Network();
|
||||
|
||||
buildingCreation.Add("fact", (location, owner) => new ConstructionYard(location, owner, this));
|
||||
buildingCreation.Add("proc", (location, owner) => new Refinery(location, owner, this));
|
||||
|
||||
string[] buildings = { "powr", "apwr", "weap", "barr", "atek", "stek", "dome" };
|
||||
string[] buildings = { "fact", "powr", "apwr", "weap", "barr", "atek", "stek", "dome" };
|
||||
foreach (string s in buildings)
|
||||
AddBuilding(s);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class Animation
|
||||
{
|
||||
@@ -19,6 +16,7 @@ namespace OpenRa.Game
|
||||
}
|
||||
|
||||
public Sprite[] Images { get { return new Sprite[] { currentSequence.GetSprite( frame ) }; } }
|
||||
public float2 Center { get { return 0.25f * new float2(currentSequence.GetSprite(0).bounds.Size); } }
|
||||
|
||||
public void Play( string sequenceName )
|
||||
{
|
||||
@@ -35,13 +33,13 @@ namespace OpenRa.Game
|
||||
tickAlways = false;
|
||||
currentSequence = SequenceProvider.GetSequence( name, sequenceName );
|
||||
frame = 0;
|
||||
tickFunc = _ =>
|
||||
tickFunc = () =>
|
||||
{
|
||||
++frame;
|
||||
if( frame >= currentSequence.Length )
|
||||
{
|
||||
frame = currentSequence.Length - 1;
|
||||
tickFunc = t => { };
|
||||
tickFunc = () => { };
|
||||
after();
|
||||
}
|
||||
};
|
||||
@@ -52,22 +50,22 @@ namespace OpenRa.Game
|
||||
tickAlways = true;
|
||||
currentSequence = SequenceProvider.GetSequence( name, sequenceName );
|
||||
frame = func();
|
||||
tickFunc = t => frame = func();
|
||||
tickFunc = () => frame = func();
|
||||
}
|
||||
|
||||
int timeUntilNextFrame;
|
||||
Action tickFunc;
|
||||
|
||||
Action<int> tickFunc;
|
||||
public void Tick( int t )
|
||||
{
|
||||
if( tickAlways )
|
||||
tickFunc( t );
|
||||
tickFunc();
|
||||
else
|
||||
{
|
||||
timeUntilNextFrame -= t;
|
||||
while( timeUntilNextFrame <= 0 )
|
||||
{
|
||||
tickFunc( 40 );
|
||||
tickFunc();
|
||||
timeUntilNextFrame += 40; // 25 fps == 40 ms
|
||||
}
|
||||
}
|
||||
131
OpenRa.Game/Graphics/Graphics.cd
Normal file
131
OpenRa.Game/Graphics/Graphics.cd
Normal file
@@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram MajorVersion="1" MinorVersion="1">
|
||||
<Class Name="OpenRa.Game.Graphics.Animation">
|
||||
<Position X="15.75" Y="9" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAQCgACAAAAAAAAAAAAAAAAAAAAEABAEgAAAAQQIQAA=</HashCode>
|
||||
<FileName>Graphics\Animation.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsCollectionAssociation>
|
||||
<Property Name="Images" />
|
||||
</ShowAsCollectionAssociation>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.Viewport">
|
||||
<Position X="4.25" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAQAABAAAgAAAAIYAAEAAAABCAAAAAABgAAAAgAE=</HashCode>
|
||||
<FileName>Graphics\Viewport.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsAssociation>
|
||||
<Field Name="renderer" />
|
||||
</ShowAsAssociation>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.HardwarePalette">
|
||||
<Position X="9.75" Y="10" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAQAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAQAAAAA=</HashCode>
|
||||
<FileName>Graphics\HardwarePalette.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.Region" Collapsed="true">
|
||||
<Position X="18.25" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AIQAAAAAAAAAggAABAIAIAQCAAAAAGAAAAAAAAAQAAA=</HashCode>
|
||||
<FileName>Graphics\Region.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.Renderer">
|
||||
<Position X="4.25" Y="5.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>QACAEAAGAAAAAgMAAAAAAAAAAAAAAAAAAAAAAEAAAAA=</HashCode>
|
||||
<FileName>Graphics\Renderer.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.Sheet">
|
||||
<Position X="9.75" Y="6" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAACAgAAACAgAAAAIAAAAAgAAAAIAAAAggAA=</HashCode>
|
||||
<FileName>Graphics\Sheet.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsAssociation>
|
||||
<Field Name="renderer" />
|
||||
</ShowAsAssociation>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.SheetBuilder">
|
||||
<Position X="1.25" Y="6" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AQIACAAAAAAAIQAAAAAAAAAAgAAAAIAAAEAAAAACgAA=</HashCode>
|
||||
<FileName>Graphics\SheetBuilder.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsAssociation>
|
||||
<Field Name="renderer" />
|
||||
</ShowAsAssociation>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.Sprite">
|
||||
<Position X="12.75" Y="6.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAQAAIAAAAIAAAAAAAAAAAAABAAACAAAEAgA=</HashCode>
|
||||
<FileName>Graphics\Sprite.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsAssociation>
|
||||
<Field Name="sheet" />
|
||||
</ShowAsAssociation>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.SpriteRenderer">
|
||||
<Position X="6.75" Y="5.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAQQAAAAECAAAAAAAAAAAAAABAQABAAAAAAAACIwAQ=</HashCode>
|
||||
<FileName>Graphics\SpriteRenderer.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsAssociation>
|
||||
<Field Name="currentSheet" />
|
||||
<Field Name="renderer" />
|
||||
</ShowAsAssociation>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.SpriteSheetBuilder">
|
||||
<Position X="12.75" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAACAAAA=</HashCode>
|
||||
<FileName>Graphics\SpriteSheetBuilder.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsCollectionAssociation>
|
||||
<Field Name="sprites" />
|
||||
</ShowAsCollectionAssociation>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.TerrainRenderer">
|
||||
<Position X="7" Y="2.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AACQEAAAAAAAAgAAAAAACAAAABgAAAAAAAAAAAAAgAA=</HashCode>
|
||||
<FileName>Graphics\TerrainRenderer.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsAssociation>
|
||||
<Field Name="renderer" />
|
||||
<Field Name="terrainSheet" />
|
||||
</ShowAsAssociation>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.UnitSheetBuilder">
|
||||
<Position X="15.75" Y="6" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAgAAAAAAAAAAAAAAAAQAAAAAAAQAAAACAAAA=</HashCode>
|
||||
<FileName>Graphics\UnitSheetBuilder.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsCollectionAssociation>
|
||||
<Field Name="sprites" />
|
||||
</ShowAsCollectionAssociation>
|
||||
</Class>
|
||||
<Struct Name="OpenRa.Game.Graphics.Vertex" Collapsed="true">
|
||||
<Position X="18.25" Y="1.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAgAAACAAFJgAQAAAAA=</HashCode>
|
||||
<FileName>Graphics\Vertex.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Struct>
|
||||
<Enum Name="OpenRa.Game.Graphics.TextureChannel" Collapsed="true">
|
||||
<Position X="18.25" Y="3" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAACAAAAAAAAAgAAAAAAAAAAAAAAABAAAAAAABAAAAA=</HashCode>
|
||||
<FileName>Graphics\Sprite.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Font Name="Segoe UI" Size="9" />
|
||||
</ClassDiagram>
|
||||
@@ -6,7 +6,7 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class HardwarePalette : Sheet
|
||||
{
|
||||
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class Region
|
||||
{
|
||||
@@ -13,15 +11,10 @@ namespace OpenRa.Game
|
||||
|
||||
public float2 Location
|
||||
{
|
||||
get { return location + viewport.Location; }
|
||||
get { return location + viewport.Location; } // WTF HACK HACK HACK
|
||||
}
|
||||
|
||||
float2 size;
|
||||
|
||||
public float2 Size
|
||||
{
|
||||
get { return size; }
|
||||
}
|
||||
public readonly float2 Size;
|
||||
|
||||
Action drawFunction;
|
||||
MouseEventHandler mouseHandler;
|
||||
@@ -71,7 +64,7 @@ namespace OpenRa.Game
|
||||
Region(int2 location, int2 size, Viewport viewport, Action drawFunction, MouseEventHandler mouseHandler)
|
||||
{
|
||||
this.location = location;
|
||||
this.size = size;
|
||||
this.Size = size;
|
||||
this.drawFunction = drawFunction;
|
||||
this.viewport = viewport;
|
||||
this.mouseHandler = mouseHandler;
|
||||
@@ -82,7 +75,7 @@ namespace OpenRa.Game
|
||||
|
||||
public void Draw(Renderer renderer)
|
||||
{
|
||||
renderer.Device.EnableScissor((int)location.X, (int)location.Y, (int)size.X, (int)size.Y);
|
||||
renderer.Device.EnableScissor((int)location.X, (int)location.Y, (int)Size.X, (int)Size.Y);
|
||||
drawFunction();
|
||||
renderer.Device.DisableScissor();
|
||||
}
|
||||
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Ijw.DirectX;
|
||||
using System.IO;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class Renderer
|
||||
{
|
||||
@@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Ijw.DirectX;
|
||||
using System.Xml;
|
||||
using Ijw.DirectX;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class Sequence
|
||||
{
|
||||
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
static class SequenceProvider
|
||||
{
|
||||
@@ -1,11 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using Ijw.DirectX;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class Sheet
|
||||
{
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
static class SheetBuilder
|
||||
{
|
||||
@@ -16,7 +12,6 @@ namespace OpenRa.Game
|
||||
public static Sprite Add(byte[] src, Size size)
|
||||
{
|
||||
Sprite rect = AddImage(size);
|
||||
//Util.CopyIntoChannel(rect, src);
|
||||
Util.FastCopyIntoChannel(rect, src);
|
||||
return rect;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class Sprite
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using OpenRa.FileFormats;
|
||||
using System.Drawing;
|
||||
using Ijw.DirectX;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class SpriteRenderer
|
||||
{
|
||||
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
static class SpriteSheetBuilder
|
||||
{
|
||||
@@ -1,15 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Ijw.DirectX;
|
||||
using IjwFramework.Collections;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class TerrainRenderer
|
||||
{
|
||||
@@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class TreeCache
|
||||
{
|
||||
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
using System.Drawing;
|
||||
using Ijw.DirectX;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
static class UnitSheetBuilder
|
||||
{
|
||||
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
static class Util
|
||||
{
|
||||
@@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Drawing;
|
||||
using Ijw.DirectX;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct Vertex
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OpenRa.Game
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class Viewport
|
||||
{
|
||||
@@ -1,15 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
|
||||
using System.Windows.Forms;
|
||||
using OpenRa.FileFormats;
|
||||
using System.IO;
|
||||
using OpenRa.Game.Graphics;
|
||||
using OpenRa.TechTree;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
using GRegion = OpenRa.Game.Graphics.Region;
|
||||
|
||||
class MainWindow : Form
|
||||
{
|
||||
readonly Renderer renderer;
|
||||
@@ -74,7 +72,7 @@ namespace OpenRa.Game
|
||||
lastPos = new int2(e.Location);
|
||||
|
||||
if (e.Button == MouseButtons.Left)
|
||||
foreach (Region region in game.viewport.Regions)
|
||||
foreach (GRegion region in game.viewport.Regions)
|
||||
if (region.Contains(lastPos))
|
||||
region.Clicked(e);
|
||||
}
|
||||
|
||||
@@ -71,53 +71,53 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Actor.cs" />
|
||||
<Compile Include="Animation.cs" />
|
||||
<Compile Include="Graphics\Animation.cs" />
|
||||
<Compile Include="Building.cs" />
|
||||
<Compile Include="Game.cs" />
|
||||
<Compile Include="IOrderGenerator.cs" />
|
||||
<Compile Include="Item.cs" />
|
||||
<Compile Include="TechTree\Item.cs" />
|
||||
<Compile Include="Network\Packet.cs" />
|
||||
<Compile Include="Player.cs" />
|
||||
<Compile Include="PlayerOwned.cs" />
|
||||
<Compile Include="Race.cs" />
|
||||
<Compile Include="Rules.cs" />
|
||||
<Compile Include="SharedResources.cs" />
|
||||
<Compile Include="Sheet.cs" />
|
||||
<Compile Include="Log.cs" />
|
||||
<Compile Include="Graphics\Sheet.cs" />
|
||||
<Compile Include="Support\Log.cs" />
|
||||
<Compile Include="Network\Network.cs" />
|
||||
<Compile Include="PathFinder.cs" />
|
||||
<Compile Include="Sequence.cs" />
|
||||
<Compile Include="ConstructionYard.cs" />
|
||||
<Compile Include="Graphics\Sequence.cs" />
|
||||
<Compile Include="MoveOrder.cs" />
|
||||
<Compile Include="Region.cs" />
|
||||
<Compile Include="SequenceProvider.cs" />
|
||||
<Compile Include="SheetBuilder.cs" />
|
||||
<Compile Include="HardwarePalette.cs" />
|
||||
<Compile Include="Graphics\Region.cs" />
|
||||
<Compile Include="Graphics\SequenceProvider.cs" />
|
||||
<Compile Include="Graphics\SheetBuilder.cs" />
|
||||
<Compile Include="Graphics\HardwarePalette.cs" />
|
||||
<Compile Include="MainWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Support\Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Refinery.cs" />
|
||||
<Compile Include="Renderer.cs" />
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="Graphics\Renderer.cs" />
|
||||
<Compile Include="Support\Settings.cs" />
|
||||
<Compile Include="Sidebar.cs" />
|
||||
<Compile Include="SidebarItem.cs" />
|
||||
<Compile Include="Sprite.cs" />
|
||||
<Compile Include="SpriteRenderer.cs" />
|
||||
<Compile Include="SpriteSheetBuilder.cs" />
|
||||
<Compile Include="TechTree.cs" />
|
||||
<Compile Include="Graphics\Sprite.cs" />
|
||||
<Compile Include="Graphics\SpriteRenderer.cs" />
|
||||
<Compile Include="Graphics\SpriteSheetBuilder.cs" />
|
||||
<Compile Include="TechTree\TechTree.cs" />
|
||||
<Compile Include="TerrainCosts.cs" />
|
||||
<Compile Include="TerrainRenderer.cs" />
|
||||
<Compile Include="Graphics\TerrainRenderer.cs" />
|
||||
<Compile Include="Tree.cs" />
|
||||
<Compile Include="TreeCache.cs" />
|
||||
<Compile Include="Graphics\TreeCache.cs" />
|
||||
<Compile Include="UiOverlay.cs" />
|
||||
<Compile Include="Unit.cs" />
|
||||
<Compile Include="UnitInfo.cs" />
|
||||
<Compile Include="UnitMissions.cs" />
|
||||
<Compile Include="UnitSheetBuilder.cs" />
|
||||
<Compile Include="Util.cs" />
|
||||
<Compile Include="Vertex.cs" />
|
||||
<Compile Include="Viewport.cs" />
|
||||
<Compile Include="Graphics\UnitSheetBuilder.cs" />
|
||||
<Compile Include="Graphics\Util.cs" />
|
||||
<Compile Include="Graphics\Vertex.cs" />
|
||||
<Compile Include="Graphics\Viewport.cs" />
|
||||
<Compile Include="World.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -148,7 +148,7 @@
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ClassDiagram1.cd" />
|
||||
<None Include="Graphics\Graphics.cd" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
using System.Windows.Forms;
|
||||
using IjwFramework.Collections;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
@@ -32,21 +33,4 @@ namespace OpenRa.Game
|
||||
return unitInfos[ name.ToUpperInvariant() ];
|
||||
}
|
||||
}
|
||||
|
||||
class UnitInfo
|
||||
{
|
||||
public readonly int Speed;
|
||||
public readonly SupportedMissions supportedMissions;
|
||||
|
||||
public UnitInfo( string unitName, IniSection ini )
|
||||
{
|
||||
Speed = int.Parse( ini.GetValue( "Speed", "0" ) );
|
||||
|
||||
supportedMissions = SupportedMissions.Stop;
|
||||
if( unitName == "MCV" )
|
||||
supportedMissions |= SupportedMissions.Deploy;
|
||||
if( unitName == "HARV" )
|
||||
supportedMissions |= SupportedMissions.Harvest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using IjwFramework.Types;
|
||||
using OpenRa.FileFormats;
|
||||
using IjwFramework.Types;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
class SharedResources
|
||||
{
|
||||
static Lazy<IniFile> rules = new Lazy<IniFile>( () => new IniFile( FileSystem.Open( "rules.ini" )));
|
||||
static Lazy<IniFile> rules = new Lazy<IniFile>(
|
||||
() => new IniFile( FileSystem.Open( "rules.ini" )));
|
||||
|
||||
public static IniFile Rules { get { return rules.Value; } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.TechTree;
|
||||
using Ijw.DirectX;
|
||||
using OpenRa.FileFormats;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using OpenRa.FileFormats;
|
||||
using OpenRa.Game.Graphics;
|
||||
using OpenRa.TechTree;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
using GRegion = OpenRa.Game.Graphics.Region;
|
||||
|
||||
class Sidebar
|
||||
{
|
||||
TechTree.TechTree techTree;
|
||||
@@ -17,11 +17,11 @@ namespace OpenRa.Game
|
||||
SpriteRenderer spriteRenderer, clockRenderer;
|
||||
Sprite blank;
|
||||
Game game;
|
||||
readonly Region region;
|
||||
readonly GRegion region;
|
||||
|
||||
Animation clockAnimation = new Animation("clock");
|
||||
|
||||
public Region Region { get { return region; } }
|
||||
public GRegion Region { get { return region; } }
|
||||
public float Width { get { return spriteWidth * 2; } }
|
||||
|
||||
Dictionary<string, Sprite> sprites = new Dictionary<string,Sprite>();
|
||||
@@ -33,7 +33,7 @@ namespace OpenRa.Game
|
||||
{
|
||||
this.techTree = game.players[ game.localPlayerIndex ].TechTree;
|
||||
this.game = game;
|
||||
region = Region.Create(game.viewport, DockStyle.Right, 128, Paint, MouseHandler);
|
||||
region = GRegion.Create(game.viewport, DockStyle.Right, 128, Paint, MouseHandler);
|
||||
game.viewport.AddRegion( region );
|
||||
spriteRenderer = new SpriteRenderer(renderer, false);
|
||||
clockRenderer = new SpriteRenderer(renderer, true);
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.Game.Graphics;
|
||||
using OpenRa.TechTree;
|
||||
|
||||
namespace OpenRa.Game
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace OpenRa.Game
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
namespace OpenRa.TechTree
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
using System.IO;
|
||||
using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
using System.Drawing;
|
||||
using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
@@ -23,12 +22,12 @@ namespace OpenRa.Game
|
||||
: base( game, name, cell )
|
||||
{
|
||||
fromCell = toCell = cell;
|
||||
this.renderOffset = new float2( 12, 12 ); // TODO: pull this from the sprite
|
||||
|
||||
this.owner = owner;
|
||||
this.unitInfo = Rules.UnitInfo( name );
|
||||
|
||||
animation = new Animation( name );
|
||||
animation.PlayFetchIndex( "idle", () => facing );
|
||||
renderOffset = animation.Center;
|
||||
}
|
||||
|
||||
static float2[] fvecs = Util.MakeArray<float2>(32,
|
||||
|
||||
25
OpenRa.Game/UnitInfo.cs
Normal file
25
OpenRa.Game/UnitInfo.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
class UnitInfo
|
||||
{
|
||||
public readonly int Speed;
|
||||
public readonly SupportedMissions supportedMissions;
|
||||
|
||||
public UnitInfo(string unitName, IniSection ini)
|
||||
{
|
||||
Speed = int.Parse(ini.GetValue("Speed", "0"));
|
||||
|
||||
supportedMissions = SupportedMissions.Stop;
|
||||
if (unitName == "MCV")
|
||||
supportedMissions |= SupportedMissions.Deploy;
|
||||
if (unitName == "HARV")
|
||||
supportedMissions |= SupportedMissions.Harvest;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
@@ -102,7 +101,7 @@ namespace OpenRa.Game
|
||||
game.world.AddFrameEndTask( _ =>
|
||||
{
|
||||
game.world.Remove( unit );
|
||||
game.world.Add( new ConstructionYard( unit.fromCell - new int2( 1, 1 ), unit.owner, game ) );
|
||||
game.world.Add( new Building("fact", unit.fromCell - new int2( 1, 1 ), unit.owner, game ) );
|
||||
} );
|
||||
unit.currentOrder = null;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenRa.FileFormats;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Ijw.DirectX;
|
||||
using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
@@ -51,7 +49,7 @@ namespace OpenRa.Game
|
||||
int dt = t - lastTime;
|
||||
lastTime = t;
|
||||
|
||||
Range<float2> range = new Range<float2>(region.Location, region.Location + region.Size);
|
||||
var range = new Range<float2>(region.Location, region.Location + region.Size);
|
||||
|
||||
foreach (Actor a in actors)
|
||||
{
|
||||
@@ -70,10 +68,7 @@ namespace OpenRa.Game
|
||||
spriteRenderer.DrawSprite(image, loc, (a.owner != null) ? a.owner.Palette : 0);
|
||||
}
|
||||
|
||||
foreach( Action<World> a in frameEndActions )
|
||||
{
|
||||
a( this );
|
||||
}
|
||||
foreach (Action<World> a in frameEndActions) a(this);
|
||||
frameEndActions.Clear();
|
||||
|
||||
uiOverlay.Draw();
|
||||
|
||||
Reference in New Issue
Block a user