All fixed now. Engine seems to run at 600tiles/sec if you update to screen each time. If you dont its somewhere over 55,000 tiles/second on my 1.2ghz su4100 at 45% background cpu usage. Not bad if I may say so myself. Here is a demo program of it all:
Code:
program TileSetTest;
uses
Prometheus_Vid;
var
TS: TileSet;
cx: Int64;
cy: Int64;
c: Int64;
begin
PrometheusVid_Start();
CreateWindow(1280, 600, 32);
UpdateWindow();
TS.LoadFromImageFile('TileData.png');
TS.SetOffset(2,3);
TS.SetSpacing(1,1);
TS.SetTileSize(16,16);
TS.SetTileTable(140,140);
Ts.SetTiles(10000);
Ts.Update();
cx := 0;
cy := 1;
c := 0;
repeat
cx := cx + 1;
c := c + 1;
Ts.DrawTile((cx - 1) * 16, (cy - 1) * 16, c);
if cx >= Ts.TilesPerRow then
begin
cx := 0;
cy := cy + 1;
end;
until cy > 500;
UpdateCanvas();
readln();
end.
The SetTiles() is not actually required but I put it in as a fallback if something like TS.Update fails entirely.
PS: This uses <~20mb of ram to load a alpha 2739x2264 png tilesheet and draw it along with all other prometheus crap.
Bookmarks