eyes: fix blinking

piano: add to rus IMG, make the code more flexible
graph: big fonts

git-svn-id: svn://kolibrios.org@7648 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2019-05-10 17:36:11 +00:00
parent 5486248fed
commit b831f200eb
8 changed files with 113 additions and 137 deletions

View File

@ -550,6 +550,7 @@ tup.append_table(extra_files, {
if build_type == "rus" then tup.append_table(img_files, { if build_type == "rus" then tup.append_table(img_files, {
{"PERIOD", PROGS .. "/other/period/trunk/period"}, {"PERIOD", PROGS .. "/other/period/trunk/period"},
{"DEVELOP/TESTCON2", PROGS .. "/develop/libraries/console_coff/examples/testcon2_rus"}, {"DEVELOP/TESTCON2", PROGS .. "/develop/libraries/console_coff/examples/testcon2_rus"},
{"MEDIA/PIANO", PROGS .. "/media/piano/piano"},
}) else tup.append_table(img_files, { }) else tup.append_table(img_files, {
{"DEVELOP/TESTCON2", PROGS .. "/develop/libraries/console_coff/examples/testcon2_eng"}, {"DEVELOP/TESTCON2", PROGS .. "/develop/libraries/console_coff/examples/testcon2_eng"},
}) end }) end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -5,12 +5,8 @@
; ;
; Position of "eyes" is fixed. To close "eyes" just click on them. ; Position of "eyes" is fixed. To close "eyes" just click on them.
; ;
; NOTE: quite big timeout is used to disable blinking when redrawing.
; If "eyes" blink on your system, enlarge the TIMEOUT. If not, you can
; decrease it due to more realistic movement.
;
TIMEOUT equ 5 TIMEOUT equ 3
; EXECUTABLE HEADER ; EXECUTABLE HEADER
@ -39,9 +35,7 @@ still:
call draw_eyes ; draw those funny "eyes" call draw_eyes ; draw those funny "eyes"
mov eax,23 ; wait for event with timeout mcall 23,TIMEOUT ; wait for event with timeout
mov ebx,TIMEOUT
mcall
cmp eax,1 ; redraw ? cmp eax,1 ; redraw ?
jnz no_draw jnz no_draw
@ -59,13 +53,11 @@ jmp still ; loop
; EVENTS ; EVENTS
key: key:
mov eax,2 ; just read and ignore mcall 2 ; just read and ignore
mcall
jmp still jmp still
button: ; analyze button button: ; analyze button
mov eax,-1 ; this is button 1 - we have only one button :-) mcall -1 ; exit
mcall
jmp still jmp still
; -====- declarations -====- ; -====- declarations -====-
@ -100,29 +92,20 @@ mov [mouse],eax
redraw_overlap: ; label for redraw event (without checkmouse) redraw_overlap: ; label for redraw event (without checkmouse)
mov eax,12 mcall 12,1
mov ebx,1
mcall
xor eax,eax ; define window xor eax,eax ; define window
mov ebx,[win_ebx] mov ebx,[win_ebx]
mov ecx,[win_ecx] mov ecx,[win_ecx]
xor edx,edx mov edx,0x11000000 ; do not draw window, just define its area
xor esi,esi xor esi,esi
xor edi,edi xor edi,edi
mcall mcall
mov eax,8 ; define closebutton mcall 8,60,45,1+0x40000000 ; define closebutton
mov ebx,60
mov ecx,45
mov edx,1
mcall
mov eax,7
mov ebx,skindata mov ebx,skindata
mov ecx,60*65536+30 mcall 7,,60*65536+30,15
mov edx,15
mcall
mov eax,15 mov eax,15
mov ebx,30 mov ebx,30
@ -130,9 +113,7 @@ call draw_eye_point
add eax,30 add eax,30
call draw_eye_point call draw_eye_point
mov eax,12 mcall 12,2
mov ebx,2
mcall
ret ret

View File

@ -816,6 +816,10 @@ still:
;--- Ž<><C5BD>…„…<E280B9>ˆˆ Ž<C5BD>ˆŽŠ€ ŽŠ<C5BD>€ ---------------------------------- ;--- Ž<><C5BD>…„…<E280B9>ˆˆ Ž<C5BD>ˆŽŠ€ ŽŠ<C5BD>€ ----------------------------------
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
WHITE_W=48 ; While key width
BLACK_W=30 ; Black key width
BLACK_X=34 ; Black key X offset
draw_window: draw_window:
mcall 12, 1 ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ® ­ ç «¥ ®âà¨á®¢ª¨ mcall 12, 1 ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ® ­ ç «¥ ®âà¨á®¢ª¨
@ -835,61 +839,61 @@ draw_window:
mov edx, [sc.work] ; 梥â ä®­  mov edx, [sc.work] ; 梥â ä®­ 
or edx, 0x33000000 ; ¨ ⨯ ®ª­  3 or edx, 0x33000000 ; ¨ ⨯ ®ª­  3
mcall 0, <0,760>, <200,250>, , ,title mcall 0, <20,WHITE_W*15+9>, <200,250>, , ,title
mcall 8, <0,50>, <0,100>, 0x21, 0xff7a74 mcall 8, <WHITE_W*0,WHITE_W>, <0,100>, 0x21, 0xff7a74
mcall 8, <50,50>, <0,100>, 0x23, 0x907040 mcall 8, <WHITE_W*1,WHITE_W>, <0,100>, 0x23, 0x907040
mcall 8, <100,50>, <0,100>, 0x25, 0xa08050 mcall 8, <WHITE_W*2,WHITE_W>, <0,100>, 0x25, 0xa08050
mcall 8, <150,50>, <0,100>, 0x26, 0xb09060 mcall 8, <WHITE_W*3,WHITE_W>, <0,100>, 0x26, 0xb09060
mcall 8, <200,50>, <00,100>, 0x28, 0xc0a070 mcall 8, <WHITE_W*4,WHITE_W>, <00,100>, 0x28, 0xc0a070
mcall 8, <250,50>, <00,100>, 0x2a, 0xd0b080 mcall 8, <WHITE_W*5,WHITE_W>, <00,100>, 0x2a, 0xd0b080
mcall 8, <300,50>, <0,100>, 0x2c, 0xe0c090 mcall 8, <WHITE_W*6,WHITE_W>, <0,100>, 0x2c, 0xe0c090
mcall 8, <350,50>, <0,100>, 0x31, 0xffa97c mcall 8, <WHITE_W*7,WHITE_W>, <0,100>, 0x31, 0xffa97c
mcall 8, <400,50>, <0,100>, 0x33, 0xaf8d8d mcall 8, <WHITE_W*8,WHITE_W>, <0,100>, 0x33, 0xaf8d8d
mcall 8, <450,50>, <0,100>, 0x35, 0xbf9d9d mcall 8, <WHITE_W*9,WHITE_W>, <0,100>, 0x35, 0xbf9d9d
mcall 8, <500,50>, <0,100>, 0x36, 0xcfadad mcall 8, <WHITE_W*10,WHITE_W>, <0,100>, 0x36, 0xcfadad
mcall 8, <550,50>, <00,100>, 0x38, 0xdfbdbd mcall 8, <WHITE_W*11,WHITE_W>, <00,100>, 0x38, 0xdfbdbd
mcall 8, <600,50>, <00,100>, 0x3a, 0xefcdcd mcall 8, <WHITE_W*12,WHITE_W>, <00,100>, 0x3a, 0xefcdcd
mcall 8, <650,50>, <0,100>, 0x3c, 0xffdddd mcall 8, <WHITE_W*13,WHITE_W>, <0,100>, 0x3c, 0xffdddd
mcall 8, <700,50>, <0,100>, 0x41, 0xffe558 mcall 8, <WHITE_W*14,WHITE_W>, <0,100>, 0x41, 0xffe558
mcall 8, <35,30>, <0,50>, 0x22, 0x221100 mcall 8, <WHITE_W*0+BLACK_X,BLACK_W>, <0,50>, 0x22, 0x221100
mcall 8, <85,30>, <0,50>, 0x24, 0x221100 mcall 8, <WHITE_W*1+BLACK_X,BLACK_W>, <0,50>, 0x24, 0x221100
mcall 8, <185,30>, <0,50>, 0x27, 0x221100 mcall 8, <WHITE_W*3+BLACK_X,BLACK_W>, <0,50>, 0x27, 0x221100
mcall 8, <235,30>, <0,50>, 0x29, 0x221100 mcall 8, <WHITE_W*4+BLACK_X,BLACK_W>, <0,50>, 0x29, 0x221100
mcall 8, <285,30>, <0,50>, 0x2b, 0x221100 mcall 8, <WHITE_W*5+BLACK_X,BLACK_W>, <0,50>, 0x2b, 0x221100
mcall 8, <385,30>, <0,50>, 0x32, 0x221100 mcall 8, <WHITE_W*7+BLACK_X,BLACK_W>, <0,50>, 0x32, 0x221100
mcall 8, <435,30>, <0,50>, 0x34, 0x221100 mcall 8, <WHITE_W*8+BLACK_X,BLACK_W>, <0,50>, 0x34, 0x221100
mcall 8, <535,30>, <0,50>, 0x37, 0x221100 mcall 8, <WHITE_W*10+BLACK_X,BLACK_W>, <0,50>, 0x37, 0x221100
mcall 8, <585,30>, <0,50>, 0x39, 0x221100 mcall 8, <WHITE_W*11+BLACK_X,BLACK_W>, <0,50>, 0x39, 0x221100
mcall 8, <635,30>, <0,50>, 0x3b, 0x221100 mcall 8, <WHITE_W*12+BLACK_X,BLACK_W>, <0,50>, 0x3b, 0x221100
mcall 8, <0,50>, <100,100>, 0xa1, 0x702050 mcall 8, <WHITE_W*0,WHITE_W>, <100,100>, 0xa1, 0x702050
mcall 8, <50,50>, <100,100>, 0x03, 0x683638 mcall 8, <WHITE_W*1,WHITE_W>, <100,100>, 0x03, 0x683638
mcall 8, <100,50>, <100,100>, 0x05, 0x784648 mcall 8, <WHITE_W*2,WHITE_W>, <100,100>, 0x05, 0x784648
mcall 8, <150,50>, <100,100>, 0x06, 0x885658 mcall 8, <WHITE_W*3,WHITE_W>, <100,100>, 0x06, 0x885658
mcall 8, <200,50>, <100,100>, 0x08, 0x986668 mcall 8, <WHITE_W*4,WHITE_W>, <100,100>, 0x08, 0x986668
mcall 8, <250,50>, <100,100>, 0x0a, 0xa87678 mcall 8, <WHITE_W*5,WHITE_W>, <100,100>, 0x0a, 0xa87678
mcall 8, <300,50>, <100,100>, 0x0c, 0xb88688 mcall 8, <WHITE_W*6,WHITE_W>, <100,100>, 0x0c, 0xb88688
mcall 8, <350,50>, <100,100>, 0x11, 0x880040 mcall 8, <WHITE_W*7,WHITE_W>, <100,100>, 0x11, 0x880040
mcall 8, <400,50>, <100,100>, 0x13, 0x90622b mcall 8, <WHITE_W*8,WHITE_W>, <100,100>, 0x13, 0x90622b
mcall 8, <450,50>, <100,100>, 0x15, 0xa0723b mcall 8, <WHITE_W*9,WHITE_W>, <100,100>, 0x15, 0xa0723b
mcall 8, <500,50>, <100,100>, 0x16, 0xb0824b mcall 8, <WHITE_W*10,WHITE_W>, <100,100>, 0x16, 0xb0824b
mcall 8, <550,50>, <100,100>, 0x18, 0xc0925b mcall 8, <WHITE_W*11,WHITE_W>, <100,100>, 0x18, 0xc0925b
mcall 8, <600,50>, <100,100>, 0x1a, 0xd0a26b mcall 8, <WHITE_W*12,WHITE_W>, <100,100>, 0x1a, 0xd0a26b
mcall 8, <650,50>, <100,100>, 0x1c, 0xe0b27b mcall 8, <WHITE_W*13,WHITE_W>, <100,100>, 0x1c, 0xe0b27b
mcall 8, <700,50>, <100,100>, 0x21, 0xff7a74 mcall 8, <WHITE_W*14,WHITE_W>, <100,100>, 0x21, 0xff7a74
mcall 8, <35,30>, <100,50>, 0x02, 0x221100 mcall 8, <WHITE_W*0+BLACK_X,BLACK_W>, <100,50>, 0x02, 0x221100
mcall 8, <85,30>, <100,50>, 0x04, 0x221100 mcall 8, <WHITE_W*1+BLACK_X,BLACK_W>, <100,50>, 0x04, 0x221100
mcall 8, <185,30>, <100,50>, 0x07, 0x221100 mcall 8, <WHITE_W*3+BLACK_X,BLACK_W>, <100,50>, 0x07, 0x221100
mcall 8, <235,30>, <100,50>, 0x09, 0x221100 mcall 8, <WHITE_W*4+BLACK_X,BLACK_W>, <100,50>, 0x09, 0x221100
mcall 8, <285,30>, <100,50>, 0x0b, 0x221100 mcall 8, <WHITE_W*5+BLACK_X,BLACK_W>, <100,50>, 0x0b, 0x221100
mcall 8, <385,30>, <100,50>, 0x12, 0x221100 mcall 8, <WHITE_W*7+BLACK_X,BLACK_W>, <100,50>, 0x12, 0x221100
mcall 8, <435,30>, <100,50>, 0x14, 0x221100 mcall 8, <WHITE_W*8+BLACK_X,BLACK_W>, <100,50>, 0x14, 0x221100
mcall 8, <535,30>, <100,50>, 0x17, 0x221100 mcall 8, <WHITE_W*10+BLACK_X,BLACK_W>, <100,50>, 0x17, 0x221100
mcall 8, <585,30>, <100,50>, 0x19, 0x221100 mcall 8, <WHITE_W*11+BLACK_X,BLACK_W>, <100,50>, 0x19, 0x221100
mcall 8, <635,30>, <100,50>, 0x1b, 0x221100 mcall 8, <WHITE_W*12+BLACK_X,BLACK_W>, <100,50>, 0x1b, 0x221100
; ¢ë¢®¤ ⥪á⮢®© áâப¨ ; ¢ë¢®¤ ⥪á⮢®© áâப¨
@ -900,14 +904,7 @@ draw_window:
mcall 4, <10, 260>, , message2 mcall 4, <10, 260>, , message2
mcall 4, <10, 285>, , message3 mcall 4, <10, 285>, , message3
mcall 4, <10, 310>, , message4 mcall 4, <10, 310>, , message4
mcall 4, <15, 185>, , message5 mcall 4, <16, 185>, , t_notes
mcall 4, <65, 185>, , message6
mcall 4, <115, 185>, , message7
mcall 4, <165, 185>, , message8
mcall 4, <210, 185>, , message9
mcall 4, <265, 185>, , message10
mcall 4, <315, 185>, , message11
mcall 4, <365, 185>, , message5
mcall 12, 2 ; äã­ªæ¨ï 12.2, § ª®­ç¨«¨ à¨á®¢ âì mcall 12, 2 ; äã­ªæ¨ï 12.2, § ª®­ç¨«¨ à¨á®¢ âì
@ -929,16 +926,10 @@ sc system_colors
message db '‘¯à ¢ª : éñ«ª­¨â¥ 2 à §  ­  § £®«®¢ª¥.',0 message db '‘¯à ¢ª : éñ«ª­¨â¥ 2 à §  ­  § £®«®¢ª¥.',0
message1 db '<27> ¦¬¨â¥ «î¡ãî ª« ¢¨èã ¢  ­£«¨©áª®© à áª« ¤ª¥ - ',0 message1 db '<27> ¦¬¨â¥ «î¡ãî ª« ¢¨èã ¢  ­£«¨©áª®© à áª« ¤ª¥ - ',0
message2 db '¤®«¦¥­ §¢ãç âì ¤¨­ ¬¨ª ª®¬¯ìîâ¥à .',0 message2 db '¤®«¦Ą­ §˘ăç âě ˘áâ஥­­ë© ¤¨­ ¬¨Ş Ş®¬ŻěîâĄŕ  (­Ą Ş®«®­Ş¨!)',0
message3 db '<27>®â  "„®" - ª« ¢¨è¨ V,Tab,U,Enter, ¯à¨ ¢ª«î祭¨¨',0 message3 db '<27>®â  "„®" - ª« ¢¨è¨ V,Tab,U,Enter, ¯à¨ ¢ª«î祭¨¨',0
message4 db 'Caps Lock - ª« ¢¨è¨ V,Q,I.',0 message4 db 'Caps Lock - ª« ¢¨è¨ V,Q,I.',0
message5 db '„Ž',0 t_notes db '„Ž <20>… Ś<> ”€ ‘Ž‹ś ‹ź <> „Ž',0
message6 db '<27>…',0
message7 db 'Œˆ',0
message8 db '”€',0
message9 db '‘Ž‹œ',0
message10 db '‹Ÿ',0
message11 db 'ˆ',0
title db '„¥â᪮¥ ¯¨ ­¨­®',0 title db '„¥â᪮¥ ¯¨ ­¨­®',0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------

View File

@ -388,4 +388,12 @@ void rectangle( int x1, int y1, int x2, int y2)
} }
Dword kos_GetSkinHeight()
{
__asm{
mov eax, 48
mov ebx, 4
int 0x40
}
}

View File

@ -27,6 +27,7 @@ typedef struct
} TCoord; } TCoord;
Dword kos_GetSkinHeight();
void kos_DrawLine( Word x1, Word y1, Word x2, Word y2, Dword colour, Dword invert); void kos_DrawLine( Word x1, Word y1, Word x2, Word y2, Dword colour, Dword invert);
void DrawRegion(Dword x,Dword y,Dword width,Dword height,Dword color1); void DrawRegion(Dword x,Dword y,Dword width,Dword height,Dword color1);
int atoi(const char* string); int atoi(const char* string);

View File

@ -43,10 +43,9 @@ Dword point_count = 0;
double x1,y1,x2,y2; double x1,y1,x2,y2;
char *funct = NULL; char *funct = NULL;
char edit_path[1024]; char edit_path[256];
//Dword editbox_y = WND_H - 16, editbox_w = WND_W - 70; edit_box mybox = {0,92,WND_H-16-32,0xffffff,0x94AECE,0,0x808080,0x10000000,
edit_box mybox = {0,9*8-5,WND_H - 16-32,0xffffff,0x94AECE,0,0x808080,0,sizeof(edit_path),0,(dword)&edit_path, 0, 0}; //100000000000010b}; sizeof(edit_path)-1,0,(dword)&edit_path, 0, 0};
char *full_head; char *full_head;
@ -380,10 +379,7 @@ int load_points3()
double d; double d;
Dword filesize, num_number; Dword filesize, num_number;
double *p2; double *p2=0;
if (edit_path[0] == '\0')
return 0;
// get file size // get file size
strcpy(fileInfo.fileURL,edit_path); strcpy(fileInfo.fileURL,edit_path);
@ -397,7 +393,7 @@ int load_points3()
rtlDebugOutString(debuf); rtlDebugOutString(debuf);
if (rr != 0) if (rr != 0)
{ {
kos_WriteTextToWindow(10,10,0,0x00,(char*)er_file_not_found,strlen(er_file_not_found)); kos_WriteTextToWindow(10,10,0x90,0xFF0000,(char*)er_file_not_found,strlen(er_file_not_found));
return 0; return 0;
} }
@ -552,51 +548,39 @@ double fu(double x)
void draw_window(void) void draw_window(void)
{ {
double xx0=0.0, yy0=0.0; double xx0=0.0, yy0=0.0;
sProcessInfo info;
Dword wi, he;
void *p;
for (int i = 0; i < 1024; i++)
info.rawData[i] = 0;
kos_ProcessInfo(&info, 0xFFFFFFFF);
p = info.rawData + 42; // magic
wi = *(Dword *)(p);
he = *(Dword *)((Byte *)p + 4);
if (wi == 0)
wi = WND_W;
if (he == 0)
he = WND_H;
mybox.top = he - 50;
mybox.width = wi - mybox.left - 80;
kos_WindowRedrawStatus(1); kos_WindowRedrawStatus(1);
kos_DefineAndDrawWindow(10,40,WND_W,WND_H, 0x33,0xFFFFFF,0,0,(Dword)full_head); kos_DefineAndDrawWindow(100,80,WND_W,WND_H, 0x33,0xFFFFFF,0,0,(Dword)full_head);
kos_WindowRedrawStatus(2); kos_WindowRedrawStatus(2);
if (info.rawData[70]&0x04) return; //íè÷åãî íå äåëàòü åñëè îêíî ñõëîïíóòî â çàãîëîâîê sProcessInfo info;
kos_ProcessInfo(&info, 0xFFFFFFFF);
int cWidth = info.processInfo.width - 9;
int cHeight = info.processInfo.height - kos_GetSkinHeight() - 4;
mybox.top = cHeight - 50;
mybox.width = cWidth - mybox.left - 80;
if (info.processInfo.status_window&0x04) return; //draw nothing if window is rolled-up
if (point_count == 0 && funct == NULL) if (point_count == 0 && funct == NULL)
{ {
kos_WriteTextToWindow((wi - 6 * strlen(empty_text))/2,he/2,0,0x000000,(char *)empty_text,strlen(empty_text)); kos_WriteTextToWindow((cWidth - 8 * strlen(empty_text))/2,cHeight/2-25,0x90,
0x000000,(char *)empty_text,strlen(empty_text));
} }
else else
{ {
drawFunction(&fu, coord(10, 20), coord(id(wi - 20), id(he - 70)), drawFunction(&fu, coord(10, 20), coord(id(cWidth - 20), id(cHeight - 70)),
coord(x1,y1), coord(x2,y2), 0x00ff0000); coord(x1,y1), coord(x2,y2), 0x00ff0000);
} }
kos_WriteTextToWindow(4, mybox.top + 4, 0, 0, (char*)str_filename, strlen(str_filename)); kos_WriteTextToWindow(15, mybox.top + 4, 0x90, 0x000000, (char*)str_filename, strlen(str_filename));
if ((void*)edit_box_draw != NULL)
edit_box_draw((DWORD)&mybox); edit_box_draw((DWORD)&mybox);
kos_DefineButton(wi - 70, mybox.top, 50, 12, 5, 0xc0c0c0); kos_DefineButton(cWidth - 70, mybox.top, 50, 21, 5, 0xc0c0c0);
kos_WriteTextToWindow(wi - 58, mybox.top + 4, 0, 0, (char*)str_editfile, strlen(str_editfile)); kos_WriteTextToWindow(cWidth - 60, mybox.top + 4, 0x90, 0x000000, (char*)str_editfile,0);
} }
void kos_Main() void kos_Main()

View File

@ -80,6 +80,7 @@ struct RGB
}; };
#pragma pack(push, 1)
union sProcessInfo union sProcessInfo
{ {
Byte rawData[1024]; Byte rawData[1024];
@ -87,7 +88,7 @@ union sProcessInfo
{ {
Dword cpu_usage; Dword cpu_usage;
Word window_stack_position; Word window_stack_position;
Word window_stack_value; Word window_slot; //slot
Word reserved1; Word reserved1;
char process_name[12]; char process_name[12];
Dword memory_start; Dword memory_start;
@ -95,11 +96,20 @@ union sProcessInfo
Dword PID; Dword PID;
Dword x_start; Dword x_start;
Dword y_start; Dword y_start;
Dword x_size; Dword width;
Dword y_size; Dword height;
Word slot_state; Word slot_state;
Word reserved3;
Dword work_left;
Dword work_top;
Dword work_width;
Dword work_height;
char status_window;
Dword cwidth;
Dword cheight;
} processInfo; } processInfo;
}; };
#pragma pack(pop)
#ifndef AUTOBUILD #ifndef AUTOBUILD
// //