hedgewars/uFLData.pas
author unc0rr
Wed, 01 Oct 2014 01:20:05 +0400
branchqmlfrontend
changeset 10436 084e046f6bd5
parent 10434 1614b13ad35e
child 10438 50ed968e4fee
permissions -rw-r--r--
flib provides theme icons, qmlFrontend shows them

unit uFLData;
interface

function getThemesList: PPChar; cdecl;
procedure freeThemesList(list: PPChar); cdecl;
function getThemeIcon(themeName: PChar; buffer: PChar; buflen: Longword): Longword; cdecl;

implementation
uses uPhysFSLayer;

function getThemesList: PPChar; cdecl;
begin
    getThemesList:= pfsEnumerateFiles('Themes')
end;

procedure freeThemesList(list: PPChar); cdecl;
begin
    pfsFreeList(list)
end;

function getThemeIcon(themeName: PChar; buffer: PChar; buflen: Longword): Longword; cdecl;
var s: shortstring;
    f: PFSFile;
begin
    s:= '/Themes/' + shortstring(themeName) + '/icon@2x.png';

    f:= pfsOpenRead(s);

    if f = nil then
        getThemeIcon:= 0
    else
    begin
        getThemeIcon:= pfsBlockRead(f, buffer, buflen);
        pfsClose(f)
    end;
end;

end.