1,4 → 1,4 |
#define MEMSIZE 0x2EE80 |
#define MEMSIZE 1024*30 |
|
#include "../lib/kfont.h" |
#include "../lib/gui.h" |
7,7 → 7,6 |
#define WIN_W 490 |
#define WIN_H 315 |
#define BASE_TAB_BUTTON_ID 97 |
proc_info Form; |
|
_tabs tabs = { WIN_W-130, 0, NULL, BASE_TAB_BUTTON_ID }; |
|
18,8 → 17,10 |
|
void main() |
{ |
proc_info Form; |
char title[1024]; |
int btn; |
char title[4196]; |
|
if (!param) strcpy(#param, DEFAULT_FONT); |
kfont.init(#param); |
strcpy(#title, "Font preview: "); |
28,16 → 29,17 |
tabs.add("Phrase", #DrawPreviewPhrase); |
tabs.add("Chars", #DrawPreviewChars); |
|
loop() switch(WaitEvent()) |
loop() switch(@WaitEvent()) |
{ |
case evButton: |
btn = GetButtonID(); |
if (btn==1) ExitProcess(); |
btn = @GetButtonID(); |
if (btn==1) @ExitProcess(); |
bold.click(btn); |
smooth.click(btn); |
colored.click(btn); |
tabs.click(btn); |
goto _DRAW_WINDOW_CONTENT; |
GOTO _DRAW_WINDOW_CONTENT; |
|
case evReDraw: |
sc.get(); |
DefineAndDrawWindow(215,100,WIN_W+9,WIN_H+skin_height+5,0x74,0xFFFFFF,#title,0); |
48,27 → 50,24 |
kfont.bold = bold.checked; |
kfont.smooth = smooth.checked; |
|
DrawBar(0, 0, Form.cwidth, PANELH-1, sc.work); |
DrawBar(0, PANELH-1,Form.cwidth,1,sc.work_graph); |
DrawBar(0, 0, WIN_W, PANELH-1, sc.work); |
DrawBar(0, PANELH-1,WIN_W,1,sc.work_graph); |
|
if (!kfont.font) { |
DrawBar(preview.x, preview.y, preview.w, preview.h, 0xFFFfff); |
WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded."); |
} else { |
bold.draw(10, 8); |
smooth.draw(83,8); |
colored.draw(170,8); |
|
tabs.draw(); |
tabs.draw_active_tab(); |
|
if (!kfont.font) |
{ |
DrawBar(preview.x, preview.y, preview.w, preview.h, 0xFFFfff); |
WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded."); |
break; |
} |
} |
} |
|
dword pal[] = { 0x4E4153, 0x57417C, 0x89633B, 0x819156, 0x00CCCC, 0x2AD266, |
0xE000CC, 0x0498F9, 0xC3A9F5, 0xFFC200, 0xFF5836, 0xA086BA, |
0,0,0,0,0 }; |
0xE000CC, 0x0498F9, 0xC3A9F5, 0xFFC200, 0xFF5836, 0xA086BA, 0 }; |
|
void DrawPreviewPhrase() |
{ |
79,10 → 78,10 |
for (i=10, y=12; i<22; i++, y+=kfont.height+3;) //not flexible, need to calculate font count and max line length |
{ |
if (colored.checked) c = pal[i-10]; else c=0; |
strcpy(#line, " §¬¥à èà¨äâ /forn size is "); |
strcpy(#line, " §¬¥à èà¨äâ /font size is "); |
strcat(#line, itoa(i)); |
strcat(#line, " ¯¨ªá¥«¥©/px."); |
kfont.WriteIntoBuffer(14,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, c, i, #line); |
kfont.WriteIntoBuffer(14,y,WIN_W,WIN_H-PANELH, 0xFFFFFF, c, i, #line); |
} |
if (kfont.smooth) kfont.ApplySmooth(); |
kfont.ShowBuffer(preview.x, preview.y); |
91,13 → 90,12 |
void DrawPreviewChars() |
{ |
dword i, x=20, y=0; |
char line[2]; |
line[1]=NULL; |
char line[2]=0; |
kfont.raw_size = free(kfont.raw); |
for (i=0; i<255; i++) //not flexible, need to calculate font count and max line length |
{ |
line[0]=i; |
kfont.WriteIntoBuffer(x,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, 16, #line); |
kfont.WriteIntoBuffer(x,y,WIN_W,WIN_H-PANELH, 0xFFFFFF, 0, 16, #line); |
x+= kfont.height+2; |
if (x>=preview.w-30) { |
x=20; |