code_glitch
14-12-2010, 04:54 PM
So anyway, still hard at work - now updated Prometheus' polygon and primitve support to add fills and etc...
I'm using the following code:
procedure Primitive.Draw(X, Y: Int64);
var
c: Int64;
XData, YData: array of PSInt16;
begin
//extract data into simple array for sdl
c := 0;
repeat
c := c + 1;
XData[c - 1]^ := trunc(PointPosition[c].X); //dest is -1 as sdl array starts at 0 and Prometheus starts at 1
YData[c - 1]^ := trunc(PointPosition[c].Y);
until c >= Points;
if Points < 3 then
Exit;
PolygonRGBA( Sdl_GetVideoSurface(), XData, YData, Points, LineColour.R, LineColour.G, LineColour.B, LineColour.Alpha);
end;
Appart from the usual XData and YData not initialized errors ::) I get the following:
Error: Incompatible type for arg no. 3: Got "Dynamic Array Of PSInt16", expected "PSInt16"
And I find that annoying since I know a PSint16 is a pointer to SInt16 which is a smallint. However on sdl_gfx's docs it says an ARRAY of data. How do I pass an array of data in a single PSInt16?
If anyone has any good example that would be much appreciated. Also, prometheus primitive does support 1 and 2 line polygons, but without fill. :D Duh.
Any help would be much appreciated - this one has me stumped. ???
I'm using the following code:
procedure Primitive.Draw(X, Y: Int64);
var
c: Int64;
XData, YData: array of PSInt16;
begin
//extract data into simple array for sdl
c := 0;
repeat
c := c + 1;
XData[c - 1]^ := trunc(PointPosition[c].X); //dest is -1 as sdl array starts at 0 and Prometheus starts at 1
YData[c - 1]^ := trunc(PointPosition[c].Y);
until c >= Points;
if Points < 3 then
Exit;
PolygonRGBA( Sdl_GetVideoSurface(), XData, YData, Points, LineColour.R, LineColour.G, LineColour.B, LineColour.Alpha);
end;
Appart from the usual XData and YData not initialized errors ::) I get the following:
Error: Incompatible type for arg no. 3: Got "Dynamic Array Of PSInt16", expected "PSInt16"
And I find that annoying since I know a PSint16 is a pointer to SInt16 which is a smallint. However on sdl_gfx's docs it says an ARRAY of data. How do I pass an array of data in a single PSInt16?
If anyone has any good example that would be much appreciated. Also, prometheus primitive does support 1 and 2 line polygons, but without fill. :D Duh.
Any help would be much appreciated - this one has me stumped. ???