Results 1 to 2 of 2

Thread: SDL Quickie

  1. #1
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45

    SDL Quickie

    So anyway, still hard at work - now updated Prometheus' polygon and primitve support to add fills and etc...

    I'm using the following code:

    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:

    Code:
    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. Duh.

    Any help would be much appreciated - this one has me stumped.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  2. #2
    You need to cast the argument to the expected type in your call to PolygonRGBA. Try something like "PSInt16(@XData[0])".
    ZGameEditor - Develop 64kb games for Windows.
    Thrust for Vectrex - ROM-file and 6809 source code.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •