[Fixing indentation]

This commit is contained in:
Bob
2009-11-19 15:02:04 +13:00
parent e427e6b16e
commit a17296ff8a
13 changed files with 244 additions and 249 deletions

View File

@@ -118,7 +118,7 @@ namespace OpenRa.FileFormats
for( int i = 0 ; i < 128 ; i++ ) for( int i = 0 ; i < 128 ; i++ )
for( int j = 0 ; j < 128 ; j++ ) for( int j = 0 ; j < 128 ; j++ )
{ {
MapTiles[j, i].image = (byte)ms.ReadByte(); MapTiles[j, i].image = (byte)ms.ReadByte();
if( MapTiles[ j, i ].tile == 0xff || MapTiles[ j, i ].tile == 0xffff ) if( MapTiles[ j, i ].tile == 0xff || MapTiles[ j, i ].tile == 0xffff )
MapTiles[ j, i ].image = (byte)( i % 4 + ( j % 4 ) * 4 ); MapTiles[ j, i ].image = (byte)( i % 4 + ( j % 4 ) * 4 );
} }

View File

@@ -17,14 +17,14 @@ namespace OpenRa.FileFormats
readonly Dictionary<uint, PackageEntry> index; readonly Dictionary<uint, PackageEntry> index;
readonly bool isRmix, isEncrypted; readonly bool isRmix, isEncrypted;
readonly long dataStart; readonly long dataStart;
readonly Stream s; readonly Stream s;
public Package(string filename) public Package(string filename)
{ {
this.filename = filename; this.filename = filename;
s = FileSystem.Open(filename); s = FileSystem.Open(filename);
BinaryReader reader = new BinaryReader(s); BinaryReader reader = new BinaryReader(s);
uint signature = reader.ReadUInt32(); uint signature = reader.ReadUInt32();
isRmix = 0 == (signature & ~(uint)(MixFileFlags.Checksum | MixFileFlags.Encrypted)); isRmix = 0 == (signature & ~(uint)(MixFileFlags.Checksum | MixFileFlags.Encrypted));
@@ -50,7 +50,7 @@ namespace OpenRa.FileFormats
{ {
BinaryReader reader = new BinaryReader(s); BinaryReader reader = new BinaryReader(s);
byte[] keyblock = reader.ReadBytes(80); byte[] keyblock = reader.ReadBytes(80);
byte[] blowfishKey = new BlowfishKeyProvider().DecryptKey(keyblock); byte[] blowfishKey = new BlowfishKeyProvider().DecryptKey(keyblock);
uint[] h = ReadUints(reader, 2); uint[] h = ReadUints(reader, 2);
@@ -117,9 +117,9 @@ namespace OpenRa.FileFormats
public Stream GetContent(uint hash) public Stream GetContent(uint hash)
{ {
PackageEntry e; PackageEntry e;
if (!index.TryGetValue(hash, out e)) if (!index.TryGetValue(hash, out e))
return null; return null;
s.Seek( dataStart + e.Offset, SeekOrigin.Begin ); s.Seek( dataStart + e.Offset, SeekOrigin.Begin );
byte[] data = new byte[ e.Length ]; byte[] data = new byte[ e.Length ];

View File

@@ -39,11 +39,11 @@ namespace OpenRa.FileFormats
MemoryStream ms = new MemoryStream(Encoding.ASCII.GetBytes(name)); MemoryStream ms = new MemoryStream(Encoding.ASCII.GetBytes(name));
BinaryReader reader = new BinaryReader(ms); BinaryReader reader = new BinaryReader(ms);
int len = name.Length >> 2; int len = name.Length >> 2;
uint result = 0; uint result = 0;
while (len-- != 0) while (len-- != 0)
result = ((result << 1) | (result >> 31)) + reader.ReadUInt32(); result = ((result << 1) | (result >> 31)) + reader.ReadUInt32();
return result; return result;
} }

View File

@@ -109,7 +109,7 @@ namespace OpenRa.FileFormats
} }
h.Image = CopyImageData( h.RefImage.Image ); h.Image = CopyImageData( h.RefImage.Image );
Format40.DecodeInto(ReadCompressedData(stream, h), h.Image); Format40.DecodeInto(ReadCompressedData(stream, h), h.Image);
break; break;
} }
case Format.Format80: case Format.Format80:

View File

@@ -1,49 +1,49 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using OpenRa.Game.GameRules; using OpenRa.Game.GameRules;
using IjwFramework.Types; using IjwFramework.Types;
using OpenRa.Game.Graphics; using OpenRa.Game.Graphics;
namespace OpenRa.Game namespace OpenRa.Game
{ {
interface IEffect interface IEffect
{ {
void Tick(); void Tick();
IEnumerable<Tuple<Sprite, float2, int>> Render(); IEnumerable<Tuple<Sprite, float2, int>> Render();
Player Owner { get; } Player Owner { get; }
} }
class Bullet : IEffect class Bullet : IEffect
{ {
public Player Owner { get; private set; } public Player Owner { get; private set; }
readonly Actor FiredBy; readonly Actor FiredBy;
readonly WeaponInfo Weapon; readonly WeaponInfo Weapon;
readonly ProjectileInfo Projectile; readonly ProjectileInfo Projectile;
readonly WarheadInfo Warhead; readonly WarheadInfo Warhead;
readonly int2 Src; readonly int2 Src;
readonly int2 Dest; readonly int2 Dest;
readonly int2 VisualDest; readonly int2 VisualDest;
int t = 0; int t = 0;
Animation anim; Animation anim;
const int BaseBulletSpeed = 100; /* pixels / 40ms frame */ const int BaseBulletSpeed = 100; /* pixels / 40ms frame */
/* src, dest are *pixel* coords */ /* src, dest are *pixel* coords */
public Bullet(string weapon, Player owner, Actor firedBy, public Bullet(string weapon, Player owner, Actor firedBy,
int2 src, int2 dest) int2 src, int2 dest)
{ {
Owner = owner; Owner = owner;
FiredBy = firedBy; FiredBy = firedBy;
Src = src; Src = src;
Dest = dest; Dest = dest;
VisualDest = Dest + new int2( VisualDest = Dest + new int2(
Game.CosmeticRandom.Next(-10, 10), Game.CosmeticRandom.Next(-10, 10),
Game.CosmeticRandom.Next(-10, 10)); Game.CosmeticRandom.Next(-10, 10));
Weapon = Rules.WeaponInfo[weapon]; Weapon = Rules.WeaponInfo[weapon];
Projectile = Rules.ProjectileInfo[Weapon.Projectile]; Projectile = Rules.ProjectileInfo[Weapon.Projectile];
Warhead = Rules.WarheadInfo[Weapon.Warhead]; Warhead = Rules.WarheadInfo[Weapon.Warhead];
if (Projectile.Image != null && Projectile.Image != "none") if (Projectile.Image != null && Projectile.Image != "none")
@@ -56,19 +56,19 @@ namespace OpenRa.Game
anim.CurrentSequence.Length)); anim.CurrentSequence.Length));
else else
anim.PlayRepeating("idle"); anim.PlayRepeating("idle");
} }
} }
int TotalTime() { return (Dest - Src).Length * BaseBulletSpeed / Weapon.Speed; } int TotalTime() { return (Dest - Src).Length * BaseBulletSpeed / Weapon.Speed; }
public void Tick() public void Tick()
{ {
if (t == 0) if (t == 0)
Game.PlaySound(Weapon.Report + ".aud", false); Game.PlaySound(Weapon.Report + ".aud", false);
t += 40; t += 40;
if (t > TotalTime()) /* remove finished bullets */ if (t > TotalTime()) /* remove finished bullets */
{ {
Game.world.AddFrameEndTask(w => Game.world.AddFrameEndTask(w =>
{ {
@@ -86,19 +86,19 @@ namespace OpenRa.Game
if (impact != null) if (impact != null)
Game.PlaySound(impact+ ".aud", false); Game.PlaySound(impact+ ".aud", false);
}); });
var maxSpread = GetMaximumSpread(); var maxSpread = GetMaximumSpread();
var hitActors = Game.FindUnitsInCircle(Dest, GetMaximumSpread()); var hitActors = Game.FindUnitsInCircle(Dest, GetMaximumSpread());
foreach (var victim in hitActors) foreach (var victim in hitActors)
victim.InflictDamage(FiredBy, this, (int)GetDamageToInflict(victim)); victim.InflictDamage(FiredBy, this, (int)GetDamageToInflict(victim));
} }
} }
const float height = .1f; const float height = .1f;
public IEnumerable<Tuple<Sprite, float2, int>> Render() public IEnumerable<Tuple<Sprite, float2, int>> Render()
{ {
if (anim != null) if (anim != null)
{ {
@@ -119,25 +119,25 @@ namespace OpenRa.Game
} }
else else
yield return Tuple.New(anim.Image, pos, Owner.Palette); yield return Tuple.New(anim.Image, pos, Owner.Palette);
} }
} }
float GetMaximumSpread() float GetMaximumSpread()
{ {
return (int)(Warhead.Spread * Math.Log(Weapon.Damage, 2)); return (int)(Warhead.Spread * Math.Log(Weapon.Damage, 2));
} }
float GetDamageToInflict(Actor target) float GetDamageToInflict(Actor target)
{ {
if( target.unitInfo == null ) // tree or other doodad if( target.unitInfo == null ) // tree or other doodad
return 0; return 0;
/* todo: some things can't be damaged AT ALL by certain weapons! */ /* todo: some things can't be damaged AT ALL by certain weapons! */
var distance = (target.CenterLocation - Dest).Length; var distance = (target.CenterLocation - Dest).Length;
var rawDamage = Weapon.Damage * (float)Math.Exp(-distance / Warhead.Spread); var rawDamage = Weapon.Damage * (float)Math.Exp(-distance / Warhead.Spread);
var multiplier = Warhead.EffectivenessAgainst(target.unitInfo.Armor); var multiplier = Warhead.EffectivenessAgainst(target.unitInfo.Armor);
return rawDamage * multiplier; return rawDamage * multiplier;
} }
} }
} }

View File

@@ -8,59 +8,59 @@ using System.Drawing;
namespace OpenRa.Game.Graphics namespace OpenRa.Game.Graphics
{ {
class LineRenderer class LineRenderer
{ {
Renderer renderer; Renderer renderer;
FvfVertexBuffer<Vertex> vertexBuffer; FvfVertexBuffer<Vertex> vertexBuffer;
IndexBuffer indexBuffer; /* kindof a waste of space, but the GPU likes indexing, oh well */ IndexBuffer indexBuffer; /* kindof a waste of space, but the GPU likes indexing, oh well */
const int linesPerBatch = 1024; const int linesPerBatch = 1024;
Vertex[] vertices = new Vertex[2 * linesPerBatch]; Vertex[] vertices = new Vertex[ 2 * linesPerBatch ];
ushort[] indices = new ushort[2 * linesPerBatch]; ushort[] indices = new ushort[ 2 * linesPerBatch ];
int lines = 0; int lines = 0;
int nv = 0, ni = 0; int nv = 0, ni = 0;
public LineRenderer(Renderer renderer) public LineRenderer( Renderer renderer )
{ {
this.renderer = renderer; this.renderer = renderer;
vertexBuffer = new FvfVertexBuffer<Vertex>(renderer.Device, vertices.Length, Vertex.Format); vertexBuffer = new FvfVertexBuffer<Vertex>( renderer.Device, vertices.Length, Vertex.Format );
indexBuffer = new IndexBuffer(renderer.Device, indices.Length); indexBuffer = new IndexBuffer( renderer.Device, indices.Length );
} }
public void Flush() public void Flush()
{ {
if (lines > 0) if( lines > 0 )
{ {
renderer.LineShader.Render(() => renderer.LineShader.Render( () =>
{ {
vertexBuffer.SetData(vertices); vertexBuffer.SetData( vertices );
indexBuffer.SetData(indices); indexBuffer.SetData( indices );
renderer.DrawBatch(vertexBuffer, indexBuffer, renderer.DrawBatch( vertexBuffer, indexBuffer,
nv, ni / 2, null, PrimitiveType.LineList); nv, ni / 2, null, PrimitiveType.LineList );
}); } );
nv = 0; ni = 0; nv = 0; ni = 0;
lines = 0; lines = 0;
} }
} }
public void DrawLine(float2 start, float2 end, Color startColor, Color endColor) public void DrawLine( float2 start, float2 end, Color startColor, Color endColor )
{ {
indices[ni++] = (ushort)nv; indices[ ni++ ] = (ushort)nv;
vertices[nv++] = new Vertex(start,
new float2(startColor.R / 255.0f, startColor.G / 255.0f),
new float2(startColor.B / 255.0f, startColor.A / 255.0f));
indices[ni++] = (ushort)nv; vertices[ nv++ ] = new Vertex( start,
new float2( startColor.R / 255.0f, startColor.G / 255.0f ),
new float2( startColor.B / 255.0f, startColor.A / 255.0f ) );
vertices[nv++] = new Vertex(end, indices[ ni++ ] = (ushort)nv;
new float2(endColor.R / 255.0f, endColor.G / 255.0f),
new float2(endColor.B / 255.0f, endColor.A / 255.0f));
if (++lines >= linesPerBatch) vertices[ nv++ ] = new Vertex( end,
Flush(); new float2( endColor.R / 255.0f, endColor.G / 255.0f ),
} new float2( endColor.B / 255.0f, endColor.A / 255.0f ) );
}
if( ++lines >= linesPerBatch )
Flush();
}
}
} }

View File

@@ -70,14 +70,14 @@ namespace OpenRa.Game.Graphics
Range<int> vertexRange, Range<int> indexRange, Texture texture, PrimitiveType type, Shader shader) Range<int> vertexRange, Range<int> indexRange, Texture texture, PrimitiveType type, Shader shader)
where T : struct where T : struct
{ {
shader.SetValue("DiffuseTexture", texture); shader.SetValue( "DiffuseTexture", texture );
shader.Commit(); shader.Commit();
vertices.Bind(0); vertices.Bind( 0 );
indices.Bind(); indices.Bind();
device.DrawIndexedPrimitives(type, device.DrawIndexedPrimitives( type,
vertexRange, indexRange); vertexRange, indexRange );
} }
public void DrawBatch<T>(FvfVertexBuffer<T> vertices, IndexBuffer indices, public void DrawBatch<T>(FvfVertexBuffer<T> vertices, IndexBuffer indices,

View File

@@ -13,7 +13,7 @@ namespace OpenRa.Game.Graphics
public readonly RectangleF uv; public readonly RectangleF uv;
public readonly float2 size; public readonly float2 size;
readonly float2[] uvhax; readonly float2[] uvhax;
internal Sprite(Sheet sheet, Rectangle bounds, TextureChannel channel) internal Sprite(Sheet sheet, Rectangle bounds, TextureChannel channel)
{ {
@@ -27,22 +27,22 @@ namespace OpenRa.Game.Graphics
(float)(bounds.Width) / sheet.Size.Width, (float)(bounds.Width) / sheet.Size.Width,
(float)(bounds.Height) / sheet.Size.Height); (float)(bounds.Height) / sheet.Size.Height);
uvhax = new float2[] uvhax = new float2[]
{ {
new float2( uv.Left, uv.Top ), new float2( uv.Left, uv.Top ),
new float2( uv.Right, uv.Top ), new float2( uv.Right, uv.Top ),
new float2( uv.Left, uv.Bottom ), new float2( uv.Left, uv.Bottom ),
new float2( uv.Right, uv.Bottom ), new float2( uv.Right, uv.Bottom ),
}; };
this.size = new float2(bounds.Size); this.size = new float2(bounds.Size);
} }
public float2 FastMapTextureCoords(int k) public float2 FastMapTextureCoords( int k )
{ {
return uvhax[k]; return uvhax[ k ];
} }
} }
public enum TextureChannel public enum TextureChannel
{ {

View File

@@ -16,12 +16,12 @@ namespace OpenRa.Game.Graphics
const int spritesPerBatch = 1024; const int spritesPerBatch = 1024;
Vertex[] vertices = new Vertex[4 * spritesPerBatch]; Vertex[] vertices = new Vertex[4 * spritesPerBatch];
ushort[] indices = new ushort[6 * spritesPerBatch]; ushort[] indices = new ushort[6 * spritesPerBatch];
Sheet currentSheet = null; Sheet currentSheet = null;
int sprites = 0; int sprites = 0;
ShaderQuality quality; ShaderQuality quality;
int nv = 0, ni = 0; int nv = 0, ni = 0;
public SpriteRenderer(Renderer renderer, bool allowAlpha, Shader shader) public SpriteRenderer(Renderer renderer, bool allowAlpha, Shader shader)
{ {
@@ -41,19 +41,19 @@ namespace OpenRa.Game.Graphics
{ {
if (sprites > 0) if (sprites > 0)
{ {
shader.Quality = quality; shader.Quality = quality;
shader.Render(() => shader.Render(() =>
{ {
vertexBuffer.SetData(vertices); vertexBuffer.SetData(vertices);
indexBuffer.SetData(indices); indexBuffer.SetData(indices);
renderer.DrawBatch(vertexBuffer, indexBuffer, renderer.DrawBatch(vertexBuffer, indexBuffer,
new Range<int>(0, nv), new Range<int>(0, nv),
new Range<int>(0, ni), new Range<int>(0, ni),
currentSheet.Texture, PrimitiveType.TriangleList, currentSheet.Texture, PrimitiveType.TriangleList,
shader); shader);
}); });
nv = 0; ni = 0; nv = 0; ni = 0;
currentSheet = null; currentSheet = null;
sprites = 0; sprites = 0;
} }
@@ -66,7 +66,7 @@ namespace OpenRa.Game.Graphics
currentSheet = s.sheet; currentSheet = s.sheet;
Util.FastCreateQuad(vertices, indices, location, s, palette, nv, ni); Util.FastCreateQuad(vertices, indices, location, s, palette, nv, ni);
nv += 4; ni += 6; nv += 4; ni += 6;
if (++sprites >= spritesPerBatch) if (++sprites >= spritesPerBatch)
Flush(); Flush();
} }

View File

@@ -25,28 +25,28 @@ namespace OpenRa.Game.Graphics
tileSet = new TileSet( map.TileSuffix ); tileSet = new TileSet( map.TileSuffix );
Size tileSize = new Size( Game.CellSize, Game.CellSize ); Size tileSize = new Size( Game.CellSize, Game.CellSize );
SheetBuilder.ForceNewSheet(); SheetBuilder.ForceNewSheet();
var tileMapping = new Cache<TileReference, Sprite>( var tileMapping = new Cache<TileReference, Sprite>(
x => SheetBuilder.Add(tileSet.GetBytes(x), tileSize)); x => SheetBuilder.Add(tileSet.GetBytes(x), tileSize));
Vertex[] vertices = new Vertex[4 * map.Height * map.Width]; Vertex[] vertices = new Vertex[4 * map.Height * map.Width];
ushort[] indices = new ushort[6 * map.Height * map.Width]; ushort[] indices = new ushort[6 * map.Height * map.Width];
int nv = 0; int nv = 0;
int ni = 0; int ni = 0;
for( int j = map.YOffset ; j < map.YOffset + map.Height ; j++ ) for( int j = map.YOffset ; j < map.YOffset + map.Height ; j++ )
for( int i = map.XOffset ; i < map.XOffset + map.Width; i++ ) for( int i = map.XOffset ; i < map.XOffset + map.Width; i++ )
{ {
Sprite tile = tileMapping[map.MapTiles[i, j]]; Sprite tile = tileMapping[map.MapTiles[i, j]];
Util.FastCreateQuad(vertices, indices, Game.CellSize * new float2(i, j), tile, 0, nv, ni); Util.FastCreateQuad(vertices, indices, Game.CellSize * new float2(i, j), tile, 0, nv, ni);
nv += 4; nv += 4;
ni += 6; ni += 6;
} }
terrainSheet = tileMapping[map.MapTiles[map.XOffset, map.YOffset]].sheet; terrainSheet = tileMapping[map.MapTiles[map.XOffset, map.YOffset]].sheet;
vertexBuffer = new FvfVertexBuffer<Vertex>( renderer.Device, vertices.Length, Vertex.Format ); vertexBuffer = new FvfVertexBuffer<Vertex>( renderer.Device, vertices.Length, Vertex.Format );
vertexBuffer.SetData( vertices ); vertexBuffer.SetData( vertices );
@@ -71,12 +71,12 @@ namespace OpenRa.Game.Graphics
if (firstRow < 0) firstRow = 0; if (firstRow < 0) firstRow = 0;
if (lastRow > map.Height) lastRow = map.Height; if (lastRow > map.Height) lastRow = map.Height;
renderer.SpriteShader.Quality = ShaderQuality.Low; renderer.SpriteShader.Quality = ShaderQuality.Low;
renderer.SpriteShader.Render(() => renderer.SpriteShader.Render(() =>
renderer.DrawBatch(vertexBuffer, indexBuffer, renderer.DrawBatch(vertexBuffer, indexBuffer,
new Range<int>(verticesPerRow * firstRow, verticesPerRow * lastRow), new Range<int>(verticesPerRow * firstRow, verticesPerRow * lastRow),
new Range<int>(indicesPerRow * firstRow, indicesPerRow * lastRow), new Range<int>(indicesPerRow * firstRow, indicesPerRow * lastRow),
terrainSheet.Texture, PrimitiveType.TriangleList, renderer.SpriteShader)); terrainSheet.Texture, PrimitiveType.TriangleList, renderer.SpriteShader));
overlayRenderer.Draw(); overlayRenderer.Draw();
} }

View File

@@ -63,22 +63,22 @@ namespace OpenRa.Game.Graphics
cursorFrame += 0.5f; cursorFrame += 0.5f;
} }
IHandleInput dragRegion = null; IHandleInput dragRegion = null;
public void DispatchMouseInput(MouseInput mi) public void DispatchMouseInput(MouseInput mi)
{ {
if (mi.Event == MouseInputEvent.Move) if (mi.Event == MouseInputEvent.Move)
mousePos = mi.Location; mousePos = mi.Location;
if (dragRegion != null) { if (dragRegion != null) {
dragRegion.HandleInput( mi ); dragRegion.HandleInput( mi );
if (mi.Event == MouseInputEvent.Up) dragRegion = null; if (mi.Event == MouseInputEvent.Up) dragRegion = null;
return; return;
} }
dragRegion = regions.FirstOrDefault(r => r.HandleInput(mi)); dragRegion = regions.FirstOrDefault(r => r.HandleInput(mi));
if (mi.Event != MouseInputEvent.Down) if (mi.Event != MouseInputEvent.Down)
dragRegion = null; dragRegion = null;
} }
public float2 ViewToWorld(MouseInput mi) public float2 ViewToWorld(MouseInput mi)
{ {

View File

@@ -23,11 +23,6 @@ namespace OpenRa.Game.Graphics
{ {
terrainRenderer = new TerrainRenderer(renderer, Game.map); terrainRenderer = new TerrainRenderer(renderer, Game.map);
// TODO: this is layout policy. it belongs at a higher level than this.
//region = Region.Create(Game.viewport, DockStyle.Left,
// Game.viewport.Width, Draw, Game.controller.HandleInput);
//Game.viewport.AddRegion(Game.controller);
this.renderer = renderer; this.renderer = renderer;
spriteRenderer = new SpriteRenderer(renderer, true); spriteRenderer = new SpriteRenderer(renderer, true);
lineRenderer = new LineRenderer(renderer); lineRenderer = new LineRenderer(renderer);

View File

@@ -85,18 +85,18 @@ namespace OpenRa.Game
int2 lastPos; int2 lastPos;
protected override void OnMouseDown(MouseEventArgs e) protected override void OnMouseDown(MouseEventArgs e)
{ {
base.OnMouseDown(e); base.OnMouseDown(e);
lastPos = new int2(e.Location); lastPos = new int2(e.Location);
Game.viewport.DispatchMouseInput(new MouseInput Game.viewport.DispatchMouseInput(new MouseInput
{ {
Button = e.Button, Button = e.Button,
Event = MouseInputEvent.Down, Event = MouseInputEvent.Down,
Location = new int2(e.Location) Location = new int2(e.Location)
}); });
} }
protected override void OnMouseMove(MouseEventArgs e) protected override void OnMouseMove(MouseEventArgs e)
{ {
@@ -109,25 +109,25 @@ namespace OpenRa.Game
lastPos = p; lastPos = p;
} }
Game.viewport.DispatchMouseInput(new MouseInput Game.viewport.DispatchMouseInput(new MouseInput
{ {
Button = e.Button, Button = e.Button,
Event = MouseInputEvent.Move, Event = MouseInputEvent.Move,
Location = new int2(e.Location) Location = new int2(e.Location)
}); });
} }
protected override void OnMouseUp(MouseEventArgs e) protected override void OnMouseUp(MouseEventArgs e)
{ {
base.OnMouseUp(e); base.OnMouseUp(e);
Game.viewport.DispatchMouseInput(new MouseInput Game.viewport.DispatchMouseInput(new MouseInput
{ {
Button = e.Button, Button = e.Button,
Event = MouseInputEvent.Up, Event = MouseInputEvent.Up,
Location = new int2(e.Location) Location = new int2(e.Location)
}); });
} }
protected override void OnKeyPress(KeyPressEventArgs e) protected override void OnKeyPress(KeyPressEventArgs e)
{ {
@@ -140,12 +140,12 @@ namespace OpenRa.Game
} }
} }
struct MouseInput struct MouseInput
{ {
public MouseInputEvent Event; public MouseInputEvent Event;
public int2 Location; public int2 Location;
public MouseButtons Button; public MouseButtons Button;
} }
enum MouseInputEvent { Down, Move, Up }; enum MouseInputEvent { Down, Move, Up };
} }