private void ResizeViewport(IGameViewport viewport) { _viewportSize = viewport.Size; _viewportZoom = viewport.Zoom; // Calculate the tile locations in each corner of the screen var topLeftLoc = viewport.ScreenToTile(0, 0); var topRightLoc = viewport.ScreenToTile(_viewportSize.Width, 0); var bottomLeftLoc = viewport.ScreenToTile(0, _viewportSize.Height); var bottomRightLoc = viewport.ScreenToTile(_viewportSize.Width, _viewportSize.Height); _fogScreenBufferOrigin.locx = topRightLoc.location.locx; _fogScreenBufferOrigin.locy = topLeftLoc.location.locy; // Whatever the point of this may be ... if (topLeftLoc.off_y < topLeftLoc.off_x || topLeftLoc.off_y < -topLeftLoc.off_x) { _fogScreenBufferOrigin.locy--; } _fogScreenBufferWidthSubtiles = (bottomLeftLoc.location.locx - _fogScreenBufferOrigin.locx + 3) * 3; _fogScreenBufferHeightSubtiles = (bottomRightLoc.location.locy - _fogScreenBufferOrigin.locy + 3) * 3; if (_fogScreenBuffer == null || _fogScreenBuffer.Length != _fogScreenBufferWidthSubtiles * _fogScreenBufferHeightSubtiles) { _fogScreenBuffer = new byte[_fogScreenBufferWidthSubtiles * _fogScreenBufferHeightSubtiles]; // TODO: Changing this should not invalidate the line of sight info per party member _lineOfSightInvalidated = true; } }
public static void Render(IGameViewport viewport) { if (ImGui.Begin("Debug Overlay", ref isActive)) { var mousePt = TigSubsystems.Tig.Mouse.GetPos(); var worldCoord = viewport.ScreenToTile(mousePt.X, mousePt.Y); ImGui.Text($"{worldCoord}"); ImGui.End(); } }