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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     1
unit uFLData;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     2
interface
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     3
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     4
function getThemesList: PPChar; cdecl;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     5
procedure freeThemesList(list: PPChar); cdecl;
10436
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
     6
function getThemeIcon(themeName: PChar; buffer: PChar; buflen: Longword): Longword; cdecl;
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     7
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     8
implementation
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     9
uses uPhysFSLayer;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    10
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    11
function getThemesList: PPChar; cdecl;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    12
begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    13
    getThemesList:= pfsEnumerateFiles('Themes')
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    14
end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    15
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    16
procedure freeThemesList(list: PPChar); cdecl;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    17
begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    18
    pfsFreeList(list)
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    19
end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    20
10436
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    21
function getThemeIcon(themeName: PChar; buffer: PChar; buflen: Longword): Longword; cdecl;
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    22
var s: shortstring;
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    23
    f: PFSFile;
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    24
begin
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    25
    s:= '/Themes/' + shortstring(themeName) + '/icon@2x.png';
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    26
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    27
    f:= pfsOpenRead(s);
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    28
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    29
    if f = nil then
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    30
        getThemeIcon:= 0
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    31
    else
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    32
    begin
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    33
        getThemeIcon:= pfsBlockRead(f, buffer, buflen);
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    34
        pfsClose(f)
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    35
    end;
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    36
end;
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    37
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    38
end.