more infantry tweaks; sidebar mouseover shows desc & prices now
This commit is contained in:
@@ -20,6 +20,8 @@ namespace OpenRa.Game.Graphics
|
||||
Action drawFunction;
|
||||
Action<MouseInput> mouseHandler;
|
||||
Rectangle rect;
|
||||
public bool UseScissor = true;
|
||||
public bool AlwaysWantMovement = false;
|
||||
|
||||
static int2 MakeSize(Viewport v, DockStyle d, int size)
|
||||
{
|
||||
@@ -40,7 +42,6 @@ namespace OpenRa.Game.Graphics
|
||||
|
||||
public bool HandleMouseInput(MouseInput mi)
|
||||
{
|
||||
/* todo: route to the mousehandler once that's sorted */
|
||||
if (mouseHandler != null) mouseHandler(new MouseInput
|
||||
{
|
||||
Button = mi.Button,
|
||||
@@ -83,9 +84,11 @@ namespace OpenRa.Game.Graphics
|
||||
|
||||
public void Draw(Renderer renderer)
|
||||
{
|
||||
renderer.Device.EnableScissor((int)location.X, (int)location.Y, (int)Size.X, (int)Size.Y);
|
||||
if (UseScissor)
|
||||
renderer.Device.EnableScissor((int)location.X, (int)location.Y, (int)Size.X, (int)Size.Y);
|
||||
drawFunction();
|
||||
renderer.Device.DisableScissor();
|
||||
if (UseScissor)
|
||||
renderer.Device.DisableScissor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,5 +96,10 @@ namespace OpenRa.Game.Graphics
|
||||
fhDebug.Draw(sh, text, pos.X, pos.Y, c.ToArgb());
|
||||
sh.End();
|
||||
}
|
||||
|
||||
public int2 MeasureText(string text)
|
||||
{
|
||||
return new int2(fhDebug.MeasureText(sh, text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,10 @@ namespace OpenRa.Game.Graphics
|
||||
return;
|
||||
}
|
||||
|
||||
if (mi.Event == MouseInputEvent.Move)
|
||||
foreach (var reg in regions.Where(r => r.AlwaysWantMovement))
|
||||
reg.HandleMouseInput(mi);
|
||||
|
||||
dragRegion = regions.FirstOrDefault(r => r.Contains(mi.Location) && r.HandleMouseInput(mi));
|
||||
if (mi.Event != MouseInputEvent.Down)
|
||||
dragRegion = null;
|
||||
|
||||
Reference in New Issue
Block a user