SRL Archive - Snippets

TReflectionTiles.TileOnScreen


flamingo1

2015-03-12 19:59:42


function TReflectionTiles.TileOnMS(Tile: TTile): Boolean;
var
MS: TPoint;
begin
MS := TReflectionInternals.TileToMS(Tile.X, Tile.Y, 0);
Result := (MS.X > MSX1) and (MS.X < MSX2) and
(MS.Y > MSY1) and (MS.Y < MSY2);
end;

I use this to determine whether I can click on the tile or I have to turn the camera to the tile (or use the minimap.)

Fitta

2015-03-13 13:01:11


function TileOnMS(Tile: TPoint): Boolean;
begin
Result := PointInBox(Reflect.Tiles.TileToMS(Tile), intToBox(MSX1, MSY1, MSX2, MSY2));
end;

:)

flamingo1

2015-03-13 15:52:47

From: Fitta


:)


Much simpler than mine, thanks for this!