Results 1 to 10 of 24

Thread: Tilengine 2D Pascal Wrapper!

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Last edited by Thyandyr; 29-05-2017 at 02:43 PM.

  2. #2
    For Delphi on Windows

    1) Change project output directory to ..\..\..\bin\
    2) In Benchmark method CreateWindow('A', CWF_NONE); instead of CreateWindow(nil, CWF_NONE);
    3) Copy everything from Tilengine-master\lib\win32 to Tilengine-master\bin
    4) Compile
    5) Open command promt to Tilengine-master\bin
    6) Run TileEngine_Benchmark.exe

    Now... that makes the benchmark work. I still have no idea what it does, some odd stuff appears on a window and the exe exits gracefully.

    C:\Users\Admin\Downloads\Tilengine-master\bin>TileEngine_Benchmark.exe
    Tilengine benchmark tool ObjectPascal
    http://www.tilengine.org
    Normal layer..........
    217194570 pixels/s.
    Scaling layer..........
    331034483 pixels/s.
    Affine layer..........
    64602961 pixels/s.
    Blend layer..........
    132780083 pixels/s.
    Scaling blend layer...
    204255319 pixels/s.
    Affine blend layer....
    54825814 pixels/s.
    Affine blend layer....
    423841060 pixels/s.
    Colliding sprites......
    228571429 pixels/s.

    C:\Users\Admin\Downloads\Tilengine-master\bin>
    CPU 12.5%

    The same project in C outputs:

    Tilengine benchmark tool
    Written by Megamarc - Jun 1 2017 19:20:44
    Library version: 1.13.0
    http://www.tilengine.org

    Syntax: benchmark format
    format : pixel format (16 or 32)
    C:\Users\Admin\Downloads\Tilengine-master\bin>

    PS. Got to love the authentic look of old CRT pixels
    Last edited by Thyandyr; 01-06-2017 at 05:32 PM.

  3. #3
    Code:
    var
      Version: Integer;
    
    Begin
    // Get version
      Version := uTileEngine.GetVersion;
      Writeln(
      'Library version: ' + ((Version shr 16) and $FF).ToString +
      '.' + ((Version shr 8 ) and $FF).ToString +
      '.' + (Version and $FF).ToString
    );
    This adds the version number in Delphi as it is the C example.

  4. #4
    Code:
    //  load layer (tileset + tilemap)
    
    //      tileset = TLN_LoadTileset ("Sonic_md_bg1.tsx");
      tileset := uTileEngine.LoadTileset('Sonic_md_bg1.tsx'); 
    
    //      tilemap = TLN_LoadTilemap ("Sonic_md_bg1.tmx", "Layer 1");
      tilemap := uTileEngine.LoadTileMap('Sonic_md_bg1.tmx', 'Layer 1');
    Commented lines are from the C example.

    Pascal header:
    function LoadTileset(filename : string) : Pointer; cdecl; external dllname name 'TLN_LoadTileset';
    function LoadTilemap(filename, layername : string) : Pointer; cdecl; external dllname name 'TLN_LoadTilemap';

    Should be:
    function LoadTileset(filename : PAnsiChar) : Pointer; cdecl; external dllname name 'TLN_LoadTileset';
    function LoadTilemap(filename, layername : PAnsiChar) : Pointer; cdecl; external dllname name 'TLN_LoadTilemap';

    and possibly for many others lines in the header...
    Last edited by Thyandyr; 01-06-2017 at 07:14 PM.

  5. #5
    How do I use this without the built-in windowing?

    SetRenderTarget sounds like it might do the trick, but how do I get pointer to a framebuffer in VCL?

    Code:
    TLNAPI void TLN_SetRenderTarget     (     
    uint8_t *      data,
    int      pitch
    )
    Sets the output surface for rendering.
    Parameters
    data Pointer to the start of the target framebuffer
    pitch Number of bytes per each scanline of the framebuffer


    I don't get this command. What sort information can be passed in 8 bit pointer? Memory address for lego computer?

    The source is not included so I cannot go look there what is done with the 'data'. Can you add a function returning the array of data created and let the users do what they want with it?

    Haaalp plz I don't understand!
    Last edited by Thyandyr; 01-06-2017 at 09:41 PM.

  6. #6
    I will ask megamarc and return here with answers.

  7. #7
    Quote Originally Posted by Thyandyr View Post
    Code:
    //  load layer (tileset + tilemap)
    
    //      tileset = TLN_LoadTileset ("Sonic_md_bg1.tsx");
      tileset := uTileEngine.LoadTileset('Sonic_md_bg1.tsx'); 
    
    //      tilemap = TLN_LoadTilemap ("Sonic_md_bg1.tmx", "Layer 1");
      tilemap := uTileEngine.LoadTileMap('Sonic_md_bg1.tmx', 'Layer 1');
    Commented lines are from the C example.

    Pascal header:
    function LoadTileset(filename : string) : Pointer; cdecl; external dllname name 'TLN_LoadTileset';
    function LoadTilemap(filename, layername : string) : Pointer; cdecl; external dllname name 'TLN_LoadTilemap';

    Should be:
    function LoadTileset(filename : PAnsiChar) : Pointer; cdecl; external dllname name 'TLN_LoadTileset';
    function LoadTilemap(filename, layername : PAnsiChar) : Pointer; cdecl; external dllname name 'TLN_LoadTilemap';

    and possibly for many others lines in the header...
    Thanks for your changes! Do a pull request in the repo

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
  •