diff --git a/OpenRa.FileFormats/Map.cs b/OpenRa.FileFormats/Map.cs index dc34583e6b..fa5c8956dc 100644 --- a/OpenRa.FileFormats/Map.cs +++ b/OpenRa.FileFormats/Map.cs @@ -118,7 +118,7 @@ namespace OpenRa.FileFormats for( int i = 0 ; i < 128 ; i++ ) 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 ) MapTiles[ j, i ].image = (byte)( i % 4 + ( j % 4 ) * 4 ); } diff --git a/OpenRa.FileFormats/Package.cs b/OpenRa.FileFormats/Package.cs index fd5eff64ed..cda9f79e20 100644 --- a/OpenRa.FileFormats/Package.cs +++ b/OpenRa.FileFormats/Package.cs @@ -17,14 +17,14 @@ namespace OpenRa.FileFormats readonly Dictionary index; readonly bool isRmix, isEncrypted; readonly long dataStart; - readonly Stream s; + readonly Stream s; public Package(string 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(); isRmix = 0 == (signature & ~(uint)(MixFileFlags.Checksum | MixFileFlags.Encrypted)); @@ -50,7 +50,7 @@ namespace OpenRa.FileFormats { BinaryReader reader = new BinaryReader(s); byte[] keyblock = reader.ReadBytes(80); - byte[] blowfishKey = new BlowfishKeyProvider().DecryptKey(keyblock); + byte[] blowfishKey = new BlowfishKeyProvider().DecryptKey(keyblock); uint[] h = ReadUints(reader, 2); @@ -117,9 +117,9 @@ namespace OpenRa.FileFormats public Stream GetContent(uint hash) { - PackageEntry e; - if (!index.TryGetValue(hash, out e)) - return null; + PackageEntry e; + if (!index.TryGetValue(hash, out e)) + return null; s.Seek( dataStart + e.Offset, SeekOrigin.Begin ); byte[] data = new byte[ e.Length ]; diff --git a/OpenRa.FileFormats/PackageEntry.cs b/OpenRa.FileFormats/PackageEntry.cs index 99871c059c..106925b020 100644 --- a/OpenRa.FileFormats/PackageEntry.cs +++ b/OpenRa.FileFormats/PackageEntry.cs @@ -39,11 +39,11 @@ namespace OpenRa.FileFormats MemoryStream ms = new MemoryStream(Encoding.ASCII.GetBytes(name)); BinaryReader reader = new BinaryReader(ms); - int len = name.Length >> 2; + int len = name.Length >> 2; uint result = 0; - while (len-- != 0) - result = ((result << 1) | (result >> 31)) + reader.ReadUInt32(); + while (len-- != 0) + result = ((result << 1) | (result >> 31)) + reader.ReadUInt32(); return result; } diff --git a/OpenRa.FileFormats/ShpReader.cs b/OpenRa.FileFormats/ShpReader.cs index dc65213bc9..3e4ccaf73a 100644 --- a/OpenRa.FileFormats/ShpReader.cs +++ b/OpenRa.FileFormats/ShpReader.cs @@ -109,7 +109,7 @@ namespace OpenRa.FileFormats } h.Image = CopyImageData( h.RefImage.Image ); - Format40.DecodeInto(ReadCompressedData(stream, h), h.Image); + Format40.DecodeInto(ReadCompressedData(stream, h), h.Image); break; } case Format.Format80: diff --git a/OpenRa.Game/Bullet.cs b/OpenRa.Game/Bullet.cs index 38d15a4c78..c381c65e99 100644 --- a/OpenRa.Game/Bullet.cs +++ b/OpenRa.Game/Bullet.cs @@ -1,49 +1,49 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using OpenRa.Game.GameRules; -using IjwFramework.Types; -using OpenRa.Game.Graphics; - -namespace OpenRa.Game -{ - interface IEffect - { - void Tick(); - IEnumerable> Render(); - Player Owner { get; } - } - - class Bullet : IEffect - { - public Player Owner { get; private set; } - readonly Actor FiredBy; - readonly WeaponInfo Weapon; - readonly ProjectileInfo Projectile; - readonly WarheadInfo Warhead; - readonly int2 Src; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using OpenRa.Game.GameRules; +using IjwFramework.Types; +using OpenRa.Game.Graphics; + +namespace OpenRa.Game +{ + interface IEffect + { + void Tick(); + IEnumerable> Render(); + Player Owner { get; } + } + + class Bullet : IEffect + { + public Player Owner { get; private set; } + readonly Actor FiredBy; + readonly WeaponInfo Weapon; + readonly ProjectileInfo Projectile; + readonly WarheadInfo Warhead; + readonly int2 Src; readonly int2 Dest; - readonly int2 VisualDest; - - int t = 0; - Animation anim; - - const int BaseBulletSpeed = 100; /* pixels / 40ms frame */ - - /* src, dest are *pixel* coords */ - public Bullet(string weapon, Player owner, Actor firedBy, - int2 src, int2 dest) - { - Owner = owner; - FiredBy = firedBy; - Src = src; + readonly int2 VisualDest; + + int t = 0; + Animation anim; + + const int BaseBulletSpeed = 100; /* pixels / 40ms frame */ + + /* src, dest are *pixel* coords */ + public Bullet(string weapon, Player owner, Actor firedBy, + int2 src, int2 dest) + { + Owner = owner; + FiredBy = firedBy; + Src = src; Dest = dest; VisualDest = Dest + new int2( Game.CosmeticRandom.Next(-10, 10), - Game.CosmeticRandom.Next(-10, 10)); - Weapon = Rules.WeaponInfo[weapon]; - Projectile = Rules.ProjectileInfo[Weapon.Projectile]; + Game.CosmeticRandom.Next(-10, 10)); + Weapon = Rules.WeaponInfo[weapon]; + Projectile = Rules.ProjectileInfo[Weapon.Projectile]; Warhead = Rules.WarheadInfo[Weapon.Warhead]; if (Projectile.Image != null && Projectile.Image != "none") @@ -56,19 +56,19 @@ namespace OpenRa.Game anim.CurrentSequence.Length)); else anim.PlayRepeating("idle"); - } - } - - int TotalTime() { return (Dest - Src).Length * BaseBulletSpeed / Weapon.Speed; } - - public void Tick() - { - if (t == 0) - Game.PlaySound(Weapon.Report + ".aud", false); - - t += 40; - - if (t > TotalTime()) /* remove finished bullets */ + } + } + + int TotalTime() { return (Dest - Src).Length * BaseBulletSpeed / Weapon.Speed; } + + public void Tick() + { + if (t == 0) + Game.PlaySound(Weapon.Report + ".aud", false); + + t += 40; + + if (t > TotalTime()) /* remove finished bullets */ { Game.world.AddFrameEndTask(w => { @@ -86,19 +86,19 @@ namespace OpenRa.Game if (impact != null) Game.PlaySound(impact+ ".aud", false); - }); - - var maxSpread = GetMaximumSpread(); - var hitActors = Game.FindUnitsInCircle(Dest, GetMaximumSpread()); - - foreach (var victim in hitActors) - victim.InflictDamage(FiredBy, this, (int)GetDamageToInflict(victim)); - } + }); + + var maxSpread = GetMaximumSpread(); + var hitActors = Game.FindUnitsInCircle(Dest, GetMaximumSpread()); + + foreach (var victim in hitActors) + victim.InflictDamage(FiredBy, this, (int)GetDamageToInflict(victim)); + } } - const float height = .1f; - - public IEnumerable> Render() + const float height = .1f; + + public IEnumerable> Render() { if (anim != null) { @@ -119,25 +119,25 @@ namespace OpenRa.Game } else yield return Tuple.New(anim.Image, pos, Owner.Palette); - } - } - - float GetMaximumSpread() - { - return (int)(Warhead.Spread * Math.Log(Weapon.Damage, 2)); - } - - float GetDamageToInflict(Actor target) + } + } + + float GetMaximumSpread() + { + return (int)(Warhead.Spread * Math.Log(Weapon.Damage, 2)); + } + + float GetDamageToInflict(Actor target) { if( target.unitInfo == null ) // tree or other doodad - return 0; - - /* todo: some things can't be damaged AT ALL by certain weapons! */ - var distance = (target.CenterLocation - Dest).Length; - var rawDamage = Weapon.Damage * (float)Math.Exp(-distance / Warhead.Spread); - var multiplier = Warhead.EffectivenessAgainst(target.unitInfo.Armor); - - return rawDamage * multiplier; - } - } -} + return 0; + + /* todo: some things can't be damaged AT ALL by certain weapons! */ + var distance = (target.CenterLocation - Dest).Length; + var rawDamage = Weapon.Damage * (float)Math.Exp(-distance / Warhead.Spread); + var multiplier = Warhead.EffectivenessAgainst(target.unitInfo.Armor); + + return rawDamage * multiplier; + } + } +} diff --git a/OpenRa.Game/Graphics/LineRenderer.cs b/OpenRa.Game/Graphics/LineRenderer.cs index 181072c856..acbf6aeb2a 100644 --- a/OpenRa.Game/Graphics/LineRenderer.cs +++ b/OpenRa.Game/Graphics/LineRenderer.cs @@ -8,59 +8,59 @@ using System.Drawing; namespace OpenRa.Game.Graphics { - class LineRenderer - { - Renderer renderer; - FvfVertexBuffer vertexBuffer; - IndexBuffer indexBuffer; /* kindof a waste of space, but the GPU likes indexing, oh well */ + class LineRenderer + { + Renderer renderer; + FvfVertexBuffer vertexBuffer; + 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]; - ushort[] indices = new ushort[2 * linesPerBatch]; - int lines = 0; - int nv = 0, ni = 0; + Vertex[] vertices = new Vertex[ 2 * linesPerBatch ]; + ushort[] indices = new ushort[ 2 * linesPerBatch ]; + int lines = 0; + int nv = 0, ni = 0; - public LineRenderer(Renderer renderer) - { - this.renderer = renderer; - vertexBuffer = new FvfVertexBuffer(renderer.Device, vertices.Length, Vertex.Format); - indexBuffer = new IndexBuffer(renderer.Device, indices.Length); - } + public LineRenderer( Renderer renderer ) + { + this.renderer = renderer; + vertexBuffer = new FvfVertexBuffer( renderer.Device, vertices.Length, Vertex.Format ); + indexBuffer = new IndexBuffer( renderer.Device, indices.Length ); + } - public void Flush() - { - if (lines > 0) - { - renderer.LineShader.Render(() => - { - vertexBuffer.SetData(vertices); - indexBuffer.SetData(indices); - renderer.DrawBatch(vertexBuffer, indexBuffer, - nv, ni / 2, null, PrimitiveType.LineList); - }); + public void Flush() + { + if( lines > 0 ) + { + renderer.LineShader.Render( () => + { + vertexBuffer.SetData( vertices ); + indexBuffer.SetData( indices ); + renderer.DrawBatch( vertexBuffer, indexBuffer, + nv, ni / 2, null, PrimitiveType.LineList ); + } ); - nv = 0; ni = 0; - lines = 0; - } - } + nv = 0; ni = 0; + lines = 0; + } + } - public void DrawLine(float2 start, float2 end, Color startColor, Color endColor) - { - 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)); + 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 ) ); - vertices[nv++] = new Vertex(end, - new float2(endColor.R / 255.0f, endColor.G / 255.0f), - new float2(endColor.B / 255.0f, endColor.A / 255.0f)); + indices[ ni++ ] = (ushort)nv; - if (++lines >= linesPerBatch) - Flush(); - } - } + vertices[ nv++ ] = new Vertex( end, + new float2( endColor.R / 255.0f, endColor.G / 255.0f ), + new float2( endColor.B / 255.0f, endColor.A / 255.0f ) ); + + if( ++lines >= linesPerBatch ) + Flush(); + } + } } diff --git a/OpenRa.Game/Graphics/Renderer.cs b/OpenRa.Game/Graphics/Renderer.cs index 87145b4eb8..7b09588d4f 100644 --- a/OpenRa.Game/Graphics/Renderer.cs +++ b/OpenRa.Game/Graphics/Renderer.cs @@ -70,14 +70,14 @@ namespace OpenRa.Game.Graphics Range vertexRange, Range indexRange, Texture texture, PrimitiveType type, Shader shader) where T : struct { - shader.SetValue("DiffuseTexture", texture); + shader.SetValue( "DiffuseTexture", texture ); shader.Commit(); - vertices.Bind(0); + vertices.Bind( 0 ); indices.Bind(); - device.DrawIndexedPrimitives(type, - vertexRange, indexRange); + device.DrawIndexedPrimitives( type, + vertexRange, indexRange ); } public void DrawBatch(FvfVertexBuffer vertices, IndexBuffer indices, diff --git a/OpenRa.Game/Graphics/Sprite.cs b/OpenRa.Game/Graphics/Sprite.cs index 054bed7647..5f3b699159 100644 --- a/OpenRa.Game/Graphics/Sprite.cs +++ b/OpenRa.Game/Graphics/Sprite.cs @@ -13,7 +13,7 @@ namespace OpenRa.Game.Graphics public readonly RectangleF uv; public readonly float2 size; - readonly float2[] uvhax; + readonly float2[] uvhax; internal Sprite(Sheet sheet, Rectangle bounds, TextureChannel channel) { @@ -27,22 +27,22 @@ namespace OpenRa.Game.Graphics (float)(bounds.Width) / sheet.Size.Width, (float)(bounds.Height) / sheet.Size.Height); - uvhax = new float2[] - { - new float2( uv.Left, uv.Top ), - new float2( uv.Right, uv.Top ), - new float2( uv.Left, uv.Bottom ), - new float2( uv.Right, uv.Bottom ), - }; + uvhax = new float2[] + { + new float2( uv.Left, uv.Top ), + new float2( uv.Right, uv.Top ), + new float2( uv.Left, uv.Bottom ), + new float2( uv.Right, uv.Bottom ), + }; this.size = new float2(bounds.Size); } - public float2 FastMapTextureCoords(int k) - { - return uvhax[k]; - } - } + public float2 FastMapTextureCoords( int k ) + { + return uvhax[ k ]; + } + } public enum TextureChannel { diff --git a/OpenRa.Game/Graphics/SpriteRenderer.cs b/OpenRa.Game/Graphics/SpriteRenderer.cs index f1fbcdf9c4..9277f3f4d5 100644 --- a/OpenRa.Game/Graphics/SpriteRenderer.cs +++ b/OpenRa.Game/Graphics/SpriteRenderer.cs @@ -16,12 +16,12 @@ namespace OpenRa.Game.Graphics const int spritesPerBatch = 1024; - Vertex[] vertices = new Vertex[4 * spritesPerBatch]; - ushort[] indices = new ushort[6 * spritesPerBatch]; + Vertex[] vertices = new Vertex[4 * spritesPerBatch]; + ushort[] indices = new ushort[6 * spritesPerBatch]; Sheet currentSheet = null; int sprites = 0; ShaderQuality quality; - int nv = 0, ni = 0; + int nv = 0, ni = 0; public SpriteRenderer(Renderer renderer, bool allowAlpha, Shader shader) { @@ -41,19 +41,19 @@ namespace OpenRa.Game.Graphics { if (sprites > 0) { - shader.Quality = quality; - shader.Render(() => - { - vertexBuffer.SetData(vertices); - indexBuffer.SetData(indices); - renderer.DrawBatch(vertexBuffer, indexBuffer, - new Range(0, nv), - new Range(0, ni), - currentSheet.Texture, PrimitiveType.TriangleList, - shader); - }); + shader.Quality = quality; + shader.Render(() => + { + vertexBuffer.SetData(vertices); + indexBuffer.SetData(indices); + renderer.DrawBatch(vertexBuffer, indexBuffer, + new Range(0, nv), + new Range(0, ni), + currentSheet.Texture, PrimitiveType.TriangleList, + shader); + }); - nv = 0; ni = 0; + nv = 0; ni = 0; currentSheet = null; sprites = 0; } @@ -66,7 +66,7 @@ namespace OpenRa.Game.Graphics currentSheet = s.sheet; Util.FastCreateQuad(vertices, indices, location, s, palette, nv, ni); - nv += 4; ni += 6; + nv += 4; ni += 6; if (++sprites >= spritesPerBatch) Flush(); } diff --git a/OpenRa.Game/Graphics/TerrainRenderer.cs b/OpenRa.Game/Graphics/TerrainRenderer.cs index 86533152f6..a5305bb041 100644 --- a/OpenRa.Game/Graphics/TerrainRenderer.cs +++ b/OpenRa.Game/Graphics/TerrainRenderer.cs @@ -25,28 +25,28 @@ namespace OpenRa.Game.Graphics tileSet = new TileSet( map.TileSuffix ); - Size tileSize = new Size( Game.CellSize, Game.CellSize ); + Size tileSize = new Size( Game.CellSize, Game.CellSize ); SheetBuilder.ForceNewSheet(); - var tileMapping = new Cache( - x => SheetBuilder.Add(tileSet.GetBytes(x), tileSize)); + var tileMapping = new Cache( + x => SheetBuilder.Add(tileSet.GetBytes(x), tileSize)); - Vertex[] vertices = new Vertex[4 * map.Height * map.Width]; - ushort[] indices = new ushort[6 * map.Height * map.Width]; + Vertex[] vertices = new Vertex[4 * map.Height * map.Width]; + ushort[] indices = new ushort[6 * map.Height * map.Width]; - int nv = 0; - int ni = 0; + int nv = 0; + int ni = 0; for( int j = map.YOffset ; j < map.YOffset + map.Height ; j++ ) - for( int i = map.XOffset ; i < map.XOffset + map.Width; i++ ) - { - Sprite tile = tileMapping[map.MapTiles[i, j]]; - Util.FastCreateQuad(vertices, indices, Game.CellSize * new float2(i, j), tile, 0, nv, ni); - nv += 4; - ni += 6; - } + for( int i = map.XOffset ; i < map.XOffset + map.Width; i++ ) + { + Sprite tile = tileMapping[map.MapTiles[i, j]]; + Util.FastCreateQuad(vertices, indices, Game.CellSize * new float2(i, j), tile, 0, nv, ni); + nv += 4; + ni += 6; + } - terrainSheet = tileMapping[map.MapTiles[map.XOffset, map.YOffset]].sheet; + terrainSheet = tileMapping[map.MapTiles[map.XOffset, map.YOffset]].sheet; vertexBuffer = new FvfVertexBuffer( renderer.Device, vertices.Length, Vertex.Format ); vertexBuffer.SetData( vertices ); @@ -71,12 +71,12 @@ namespace OpenRa.Game.Graphics if (firstRow < 0) firstRow = 0; if (lastRow > map.Height) lastRow = map.Height; - renderer.SpriteShader.Quality = ShaderQuality.Low; - renderer.SpriteShader.Render(() => - renderer.DrawBatch(vertexBuffer, indexBuffer, - new Range(verticesPerRow * firstRow, verticesPerRow * lastRow), - new Range(indicesPerRow * firstRow, indicesPerRow * lastRow), - terrainSheet.Texture, PrimitiveType.TriangleList, renderer.SpriteShader)); + renderer.SpriteShader.Quality = ShaderQuality.Low; + renderer.SpriteShader.Render(() => + renderer.DrawBatch(vertexBuffer, indexBuffer, + new Range(verticesPerRow * firstRow, verticesPerRow * lastRow), + new Range(indicesPerRow * firstRow, indicesPerRow * lastRow), + terrainSheet.Texture, PrimitiveType.TriangleList, renderer.SpriteShader)); overlayRenderer.Draw(); } diff --git a/OpenRa.Game/Graphics/Viewport.cs b/OpenRa.Game/Graphics/Viewport.cs index b7f70706c4..4e3c145969 100644 --- a/OpenRa.Game/Graphics/Viewport.cs +++ b/OpenRa.Game/Graphics/Viewport.cs @@ -63,22 +63,22 @@ namespace OpenRa.Game.Graphics cursorFrame += 0.5f; } - IHandleInput dragRegion = null; - public void DispatchMouseInput(MouseInput mi) - { + IHandleInput dragRegion = null; + public void DispatchMouseInput(MouseInput mi) + { if (mi.Event == MouseInputEvent.Move) mousePos = mi.Location; - if (dragRegion != null) { - dragRegion.HandleInput( mi ); - if (mi.Event == MouseInputEvent.Up) dragRegion = null; - return; - } + if (dragRegion != null) { + dragRegion.HandleInput( mi ); + if (mi.Event == MouseInputEvent.Up) dragRegion = null; + return; + } - dragRegion = regions.FirstOrDefault(r => r.HandleInput(mi)); - if (mi.Event != MouseInputEvent.Down) - dragRegion = null; - } + dragRegion = regions.FirstOrDefault(r => r.HandleInput(mi)); + if (mi.Event != MouseInputEvent.Down) + dragRegion = null; + } public float2 ViewToWorld(MouseInput mi) { diff --git a/OpenRa.Game/Graphics/WorldRenderer.cs b/OpenRa.Game/Graphics/WorldRenderer.cs index 4ca858a94e..61b7131d6b 100644 --- a/OpenRa.Game/Graphics/WorldRenderer.cs +++ b/OpenRa.Game/Graphics/WorldRenderer.cs @@ -23,11 +23,6 @@ namespace OpenRa.Game.Graphics { 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; spriteRenderer = new SpriteRenderer(renderer, true); lineRenderer = new LineRenderer(renderer); diff --git a/OpenRa.Game/MainWindow.cs b/OpenRa.Game/MainWindow.cs index 41964c91d5..03726a120a 100755 --- a/OpenRa.Game/MainWindow.cs +++ b/OpenRa.Game/MainWindow.cs @@ -85,18 +85,18 @@ namespace OpenRa.Game int2 lastPos; - protected override void OnMouseDown(MouseEventArgs e) - { - base.OnMouseDown(e); - lastPos = new int2(e.Location); + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + lastPos = new int2(e.Location); - Game.viewport.DispatchMouseInput(new MouseInput - { - Button = e.Button, - Event = MouseInputEvent.Down, - Location = new int2(e.Location) - }); - } + Game.viewport.DispatchMouseInput(new MouseInput + { + Button = e.Button, + Event = MouseInputEvent.Down, + Location = new int2(e.Location) + }); + } protected override void OnMouseMove(MouseEventArgs e) { @@ -109,25 +109,25 @@ namespace OpenRa.Game lastPos = p; } - Game.viewport.DispatchMouseInput(new MouseInput - { - Button = e.Button, - Event = MouseInputEvent.Move, - Location = new int2(e.Location) - }); + Game.viewport.DispatchMouseInput(new MouseInput + { + Button = e.Button, + Event = MouseInputEvent.Move, + Location = new int2(e.Location) + }); } - protected override void OnMouseUp(MouseEventArgs e) - { - base.OnMouseUp(e); + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); - Game.viewport.DispatchMouseInput(new MouseInput - { - Button = e.Button, - Event = MouseInputEvent.Up, - Location = new int2(e.Location) - }); - } + Game.viewport.DispatchMouseInput(new MouseInput + { + Button = e.Button, + Event = MouseInputEvent.Up, + Location = new int2(e.Location) + }); + } protected override void OnKeyPress(KeyPressEventArgs e) { @@ -140,12 +140,12 @@ namespace OpenRa.Game } } - struct MouseInput - { - public MouseInputEvent Event; - public int2 Location; - public MouseButtons Button; - } + struct MouseInput + { + public MouseInputEvent Event; + public int2 Location; + public MouseButtons Button; + } - enum MouseInputEvent { Down, Move, Up }; + enum MouseInputEvent { Down, Move, Up }; }