mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using SFML.Graphics;
|
|
using SFML.System;
|
|
using SS14.Client.Graphics;
|
|
using SS14.Client.Interfaces.Map;
|
|
|
|
namespace SS14.Client.Placement.Modes
|
|
{
|
|
public class AlignFree : PlacementMode
|
|
{
|
|
public AlignFree(PlacementManager pMan) : base(pMan)
|
|
{
|
|
}
|
|
|
|
public override bool Update(Vector2i mouseS, IMapManager currentMap)
|
|
{
|
|
if (currentMap == null) return false;
|
|
|
|
spriteToDraw = GetDirectionalSprite(pManager.CurrentBaseSpriteKey);
|
|
|
|
mouseScreen = mouseS;
|
|
mouseWorld = CluwneLib.ScreenToWorld(mouseScreen);
|
|
currentTile = currentMap.GetTileRef(mouseWorld);
|
|
|
|
return true;
|
|
}
|
|
|
|
public override void Render()
|
|
{
|
|
if (spriteToDraw != null)
|
|
{
|
|
var bounds = spriteToDraw.GetLocalBounds();
|
|
spriteToDraw.Color = pManager.ValidPosition ? new Color(34, 34, 139) : new Color(205, 92, 92);
|
|
spriteToDraw.Position = new Vector2f(mouseScreen.X - (bounds.Width/2f),
|
|
mouseScreen.Y - (bounds.Height/2f));
|
|
//Centering the sprite on the cursor.
|
|
spriteToDraw.Draw();
|
|
spriteToDraw.Color = Color.White;
|
|
}
|
|
}
|
|
}
|
|
} |