From 2e0e4b0bc5e6bc232d8ddb039fe244892d167ce0 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 24 Sep 2013 18:33:48 +1200 Subject: [PATCH] Add WorldRenderer.Position for screen -> world conversion. --- OpenRA.Game/Graphics/WorldRenderer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index 8e4bc582ac..64710fa49a 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -235,5 +235,10 @@ namespace OpenRA.Graphics } public float ScreenZPosition(WPos pos, int zOffset) { return (pos.Y + pos.Z + zOffset)*Game.CellSize/1024f; } + + public WPos Position(int2 screenPx) + { + return new WPos(1024 * screenPx.X / Game.CellSize, 1024 * screenPx.Y / Game.CellSize, 0); + } } }