what a hack, but the cursors work and the terrain doesnt break anymore

This commit is contained in:
Chris Forbes
2009-10-15 19:15:40 +13:00
parent b2f1d2aa88
commit 9a9452c3fa
8 changed files with 48 additions and 6 deletions

View File

@@ -6,7 +6,8 @@ using OpenRa.TechTree;
namespace OpenRa.Game
{
using GRegion = OpenRa.Game.Graphics.Region;
using GRegion = OpenRa.Game.Graphics.Region;
using System.Runtime.InteropServices;
class MainWindow : Form
{
@@ -21,7 +22,10 @@ namespace OpenRa.Game
return new Size(settings.GetValue("width", desktopResolution.Width),
settings.GetValue("height", desktopResolution.Height));
}
}
[DllImport("user32")]
static extern int ShowCursor([MarshalAs(UnmanagedType.Bool)] bool visible);
public MainWindow(Settings settings)
{
@@ -58,7 +62,9 @@ namespace OpenRa.Game
sidebar = new Sidebar(renderer, game);
renderer.BuildPalette(game.map);
renderer.BuildPalette(game.map);
ShowCursor(false);
}
internal void Run()
@@ -66,6 +72,12 @@ namespace OpenRa.Game
while (Created && Visible)
{
game.Tick();
// rude hack
game.viewport.cursor = (game.controller.orderGenerator is UnitOrderGenerator)
&& (game.controller.orderGenerator as UnitOrderGenerator).selection.Count > 0
? OpenRa.Game.Cursor.Move : OpenRa.Game.Cursor.Default;
Application.DoEvents();
}
}