Draw texture function added to Video driver.

This commit is contained in:
Kieron Morris 2022-02-06 13:26:12 +00:00
parent d182fd7f46
commit a7111d3cac

View File

@ -22,7 +22,7 @@ unit video;
interface interface
uses uses
lmemorymanager, tracer, color, videotypes, hashmap, util; lmemorymanager, tracer, color, videotypes, hashmap, util, texture;
procedure init(); procedure init();
procedure DrawPixel(X : uint32; Y : uint32; Pixel : TRGB32); procedure DrawPixel(X : uint32; Y : uint32; Pixel : TRGB32);
@ -41,6 +41,8 @@ function backBufferWidth : uint32;
function backBufferHeight : uint32; function backBufferHeight : uint32;
function backBufferBpp : uint8; function backBufferBpp : uint8;
Procedure basicFDrawTexture(Buffer : PVideoBuffer; X : uint32; Y : uint32; Texture : PTexture);
implementation implementation
Procedure dummyFDrawPixel(Buffer : PVideoBuffer; X : uint32; Y : uint32; Pixel : TRGB32); Procedure dummyFDrawPixel(Buffer : PVideoBuffer; X : uint32; Y : uint32; Pixel : TRGB32);
@ -70,6 +72,19 @@ begin
end; end;
end; end;
Procedure basicFDrawTexture(Buffer : PVideoBuffer; X : uint32; Y : uint32; Texture : PTexture);
var
i, j : uint32;
begin
//Draw texture to Buffer at x and y
for i:=0 to Texture^.Height - 1 do begin
for j:=0 to Texture^.Width - 1 do begin
DrawPixel(X + j, Y + i, Texture^.Pixels[(i * Texture^.Width) + j]);
end;
end;
end;
procedure basicFDrawLine(Buffer : PVideoBuffer; x1,y1,x2,y2 : uint32; thickness : uint32; Color : TRGB32); procedure basicFDrawLine(Buffer : PVideoBuffer; x1,y1,x2,y2 : uint32; thickness : uint32; Color : TRGB32);
var var
X, Y, DX, DY, DX1, DY1, PX, PY, XE, YE, I : sint32; X, Y, DX, DY, DX1, DY1, PX, PY, XE, YE, I : sint32;