diff --git a/programs/cmm/installer/install.c b/programs/cmm/installer/install.c index e5cd1e800..9ac1c1437 100644 --- a/programs/cmm/installer/install.c +++ b/programs/cmm/installer/install.c @@ -3,9 +3,17 @@ #include "../lib/io.h" #include "../lib/gui.h" #include "../lib/copyf.h" + #include "../lib/obj/libini.h" +#include "../lib/obj/libio.h" +#include "../lib/obj/libimg.h" + #include "../lib/patterns/restart_process.h" +#ifndef AUTOBUILD +#include "lang.h--" +#endif + char logo[] = " ЫЫЫЫ ЫЫЫЫ ЫЫЫЫЫЫЫЫЫЫ ЫЫЫЫ ЫЫЫЫ ЫЫЫЫЫЫЫЫЫЫЫ ЫЫЫЫ ЫЫ ЫЫЫ ЫЫЫ ЫЫЫ ЫЫ ЫЫЫ ЫЫ @@ -16,14 +24,28 @@ char logo[] = " ЫЫЫЫ ЫЫЫ ЫЫЫЫЫЫЫЫЫЫ ЫЫЫЫ ЫЫЫЫ ЫЫЫЫЫ "; -char intro[] = "Џ®Їа®Ўг©вҐ ­®ў®Ґ ўЁ§г «м­®Ґ ®д®а¬«Ґ­ЁҐ Љ®«ЁЎаЁ, Є®в®а®Ґ а ­миҐ Ўл«® ¤®бвгЇ­® в®«мЄ® ў KolibriNext."; +#ifdef LANG_RUS +#define T_INTRO "Џ®Їа®Ўг©вҐ ­®ў®Ґ ўЁ§г «м­®Ґ ®д®а¬«Ґ­ЁҐ Љ®«ЁЎаЁ, Є®в®а®Ґ а ­миҐ Ўл«® ¤®бвгЇ­® в®«мЄ® ў KolibriNext."; +#define T_INSTALL "“бв ­®ўЁвм" +#define T_COMPLETE "“бв ­®ўЄ  § ўҐа襭 " +#define T_EXIT "‚л室" +#else +#define T_INTRO "Try a new visual design of KolibriOS, which previously was available only in KolibriNext."; +#define T_INSTALL "Install" +#define T_COMPLETE "Install complete" +#define T_EXIT "Exit" +#endif #define B_INSTALL 10 +bool install_complete = false; + void main() { word btn; load_dll(libini, #lib_init,1); + load_dll(libio, #libio_init,1); + load_dll(libimg, #libimg_init,1); loop() switch(WaitEventTimeout(300) & 0xFF) { case evButton: @@ -35,6 +57,10 @@ void main() case evKey: GetKeys(); if (key_scancode == SCAN_CODE_ESC) ExitProcess(); + if (key_scancode == SCAN_CODE_ENTER) { + if (install_complete) ExitProcess(); + else EventInstall(); + } break; case evReDraw: @@ -54,21 +80,31 @@ void draw_window() system.color.get(); DefineAndDrawWindow(screen.width-WINW/2,screen.height-WINH/2, WINW+9,WINH+skin_height,0x34,system.color.work,"KolibriN10",0); - DrawLogo(); + if (install_complete) DrawInstallComplete(); else DrawIntro(); +} +void DrawIntro() +{ DrawTextViewArea(30, 140, WINW-60, WINH-80, - #intro, -1, system.color.work_text); - + T_INTRO, -1, system.color.work_text); DrawCaptButton(WINW-110/2, WINH-70, 110, 28, B_INSTALL, - 0x0092D8, 0xFFFfff, "“бв ­®ўЁвм"); + 0x0092D8, 0xFFFfff, T_INSTALL); +} + +void DrawInstallComplete() +{ + DrawIcon32(WINW-32/2, 140, system.color.work, 49); + WriteTextCenter(0,185, WINW, system.color.work_text, T_COMPLETE); + DrawCaptButton(WINW-110/2, WINH-70, 110, 28, CLOSE_BTN, + 0x0092D8, 0xFFFfff, T_EXIT); } void DrawLogo() { #define LX -46*6+WINW/2 #define LY 25 - WriteTextLines(LX-1, LY, 0x80, 0x9F87B8, #logo, 9); + WriteTextLines(LX-2, LY, 0x80, 0xF497C0, #logo, 9); WriteTextLines(LX+3, LY, 0x80, 0x7ED1E3, #logo, 9); pause(1); @@ -77,9 +113,6 @@ void DrawLogo() WriteTextLines(LX, LY, 0x80, 0xEC008C, #logo, 9); } - - - void EventInstall() { //#include "..\lib\added_sysdir.c"; @@ -92,6 +125,9 @@ void EventInstall() RestartProcessByName("/sys/@docky", SINGLE); RunProgram("/sys/media/kiv", "\\S__/kolibrios/res/Wallpapers/Free yourself.jpg"); + + install_complete = true; + draw_window(); } void Operation_Draw_Progress(dword filename) { debug("copying: "); debugln(filename); } \ No newline at end of file diff --git a/programs/cmm/lib/gui.h b/programs/cmm/lib/gui.h index 2066c151d..1df91d060 100644 --- a/programs/cmm/lib/gui.h +++ b/programs/cmm/lib/gui.h @@ -41,10 +41,13 @@ :void DrawRectangle(dword x,y,w,h,color1) { + DrawRectangle3D(x,y,w,h,color1,color1); + /* DrawBar(x,y,w,1,color1); DrawBar(x,y+h,w,1,color1); DrawBar(x,y,1,h,color1); DrawBar(x+w,y,1,h+1,color1); + */ } :void DrawWideRectangle(dword x,y,w,h,boder,color1) diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index fa4335273..6d335fe17 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -89,10 +89,9 @@ inline fastcall dword CheckEvent() $int 0x40 } -:dword WaitEventTimeout(dword time) +inline fastcall dword WaitEventTimeout(EBX) { EAX = 23; - EBX = time; $int 0x40 } diff --git a/programs/games/mine/trunk/draw.h-- b/programs/games/mine/trunk/draw.h-- index 1cf29c7af..4d677848b 100644 --- a/programs/games/mine/trunk/draw.h-- +++ b/programs/games/mine/trunk/draw.h-- @@ -18,6 +18,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *******************************************************************************/ +?define HEADER_Y 4 +?define BTNSIZE 19 +char game_mode[] = "1/3"; void draw_window() // Процедура отрисовки окна { @@ -25,28 +28,32 @@ void draw_window() // // WINDOW sys_window_redraw(1); - EBX = xpos << 16 + xsize; + EBX = xpos << 16 + xsize + 9; ECX = ypos << 16 + ysize; - sys_draw_window(EBX, ECX, 0x14CCCCCC, colors.w_work | 0x80000000, "MineSweeper"); + sys_draw_window(EBX, ECX, 0x34CCCCCC, colors.w_work | 0x80000000, "MineSweeper"); sys_window_redraw(2); // Leency ROLLED UP FIX sys_process_info(#procinfo, -1); IF (procinfo.ysize<70) return; - // BUTTON (911) + // BUTTON (911) EBX = xsize / 2 - 10; - EBX = EBX << 16 + 20; - sys_draw_button(EBX, 25<<16+20, 911, clLightGray); + EBX = EBX << 16 + BTNSIZE; + sys_draw_button(EBX, HEADER_Y<<16+BTNSIZE, 911+BT_HIDE, clLightGray); + draw_rectangle(xsize/2-10,HEADER_Y,BTNSIZE,BTNSIZE,clWhite,clDarkGray); // BUTTON (1001) - sys_draw_button(10<<16+7, 23<<16+7, 1001, 0x118811); + sys_draw_button(5<<16+32, HEADER_Y<<16+BTNSIZE, 1001+BT_HIDE, clLightGray); + draw_rectangle(5,HEADER_Y,32,BTNSIZE,clWhite,clDarkGray); + game_mode[0] = mode + '0'; + sys_write_text(9<<16+HEADER_Y+3, 0x90000000+clDarkGray, #game_mode, 3); // BUTTON (1002) - //sys_draw_button(20<<16+7, ECX, EDX+1, 0xddbb44); + //sys_draw_button(BTNSIZE<<16+7, ECX, EDX+1, 0xddbb44); draw_time(); // draw timer - draw_minesi(); // draw mines + draw_mines_left(); // draw mines draw_squares(); // draw field } @@ -131,25 +138,17 @@ void draw_square(int x, y) } } - -// Таймер void draw_time() { - sys_draw_bar(XST<<16+25, 31<<16+14, 0xCCCCCC); - sys_write_number(0x00030000, time, XST<<16+32, 0x10ff0000); + sys_draw_bar(xsize-XST-58<<16+29, HEADER_Y<<16+20, clWhiteGray); + sys_write_number(0x00030000, time, xsize-XST-56<<16+HEADER_Y+3, 0x101166C3); } -// Индикатор количества нерасставленных мин -void draw_minesi() +void draw_mines_left() { - EBX = xsize - XST - 25; - $PUSH EBX - EBX = EBX << 16 + 25; - sys_draw_bar(EBX, 31<<16+14, 0xCCCCCC); - $POP EDX - EDX <<= 16; EDX += 32; - sys_write_number(0x00030000, cmines, EDX, 0x10ff0000); + sys_draw_bar(xsize-XST-29<<16+29, HEADER_Y<<16+20, clWhiteGray); + sys_write_number(0x00030000, cmines, xsize-XST-27<<16+HEADER_Y+3, 0x10ff0000); } @@ -162,3 +161,11 @@ void draw_squares() FOR (x=0; x < ncx; x++) draw_square(x, y); } + +void draw_rectangle(dword x,y,w,h,color1,color2) +{ + sys_draw_bar(x<<16+w+1,y<<16+1,color1); + sys_draw_bar(x<<16+1,y+1<<16+h-1,color1); + sys_draw_bar(x+w<<16+1,y+1<<16+h,color2); + sys_draw_bar(x<<16+w,y+h<<16+1,color2); +} \ No newline at end of file diff --git a/programs/games/mine/trunk/kos_sys.h-- b/programs/games/mine/trunk/kos_sys.h-- index b0254b51d..a820ad5c7 100644 --- a/programs/games/mine/trunk/kos_sys.h-- +++ b/programs/games/mine/trunk/kos_sys.h-- @@ -14,10 +14,16 @@ #define RETURN_KEY 13 #define BACKSPACE_KEY 8 +//Button options +#define BT_DEL 0x80000000 +#define BT_HIDE 0x40000000 +#define BT_NOFRAME 0x20000000 + // Color constant #define clWhite 0x00ffffff #define clGray 0x00808080 #define clLightGray 0x00c0c0c0 +#define clWhiteGray 0x00E2E2E2 #define clDarkGray 0x00707070 #define clBlack 0x00000000 #define clRed 0x00ff0000 diff --git a/programs/games/mine/trunk/mine.c-- b/programs/games/mine/trunk/mine.c-- index 5cb55705d..e5ace9b9e 100644 --- a/programs/games/mine/trunk/mine.c-- +++ b/programs/games/mine/trunk/mine.c-- @@ -58,9 +58,10 @@ struct byte nmines; } stdmodes[3] = {9,9,10, 16,16,40, 30,16,99}; // {x,y,m} -int XST, // offset of first pixel X - смещение поля от границы окна - YST, - ncx, // number of squares in X - размер поля +?define XST 5 // offset of first pixel X - смещение поля от границы окна +?define YST 28 + +int ncx, // number of squares in X - размер поля ncy, cmines, // mines discovered - количество неоткрытых мин initmines, // number of initial mines - изначальное количество мин @@ -107,8 +108,6 @@ inline void fastcall mouse_disable() void init() // Инициализация { - XST = 10; YST = 52; // FIELD POSITION IN WINDOW - ECX = mode; IF (ECX != 0) { @@ -126,7 +125,7 @@ void init() } xsize = ncx * XPX + XST + XST; - ysize = ncy * YPX + YST + XST; + ysize = ncy * YPX + YST + XST + sys_get_skin_height() + 4; } // init @@ -258,7 +257,7 @@ inline void do_mouse(void) set_mark(x, y, EBX); - draw_minesi(); + draw_mines_left(); draw_square(x, y); return; } @@ -287,7 +286,7 @@ inline void do_mouse(void) cmines--; draw_square(x, y); } - draw_minesi(); + draw_mines_left(); } } // do_mouse @@ -438,31 +437,32 @@ void main() { switch (sys_wait_event_timeout(100)) // wait for 1 second { - case evReDraw: + CASE evReDraw: draw_window(); continue; - case evKey: + CASE evKey: IF (sys_get_key() == 27) sys_exit_process(); continue; - case evButton: + CASE evButton: EAX = sys_get_button_id(); IF (EAX == 911) // new game { new_game(); draw_squares(); draw_time(); - draw_minesi(); + draw_mines_left(); } ELSE IF (EAX == 1001) // change mode { - // mode++; mode%=3; mode++; - EAX = mode; EAX++; EAX = EAX%3; EAX++; mode = AL; + mode++; + if (mode==4) mode=1; + //EAX = mode; EAX++; EAX = EAX%3; EAX++; mode = AL; new_game(); - window_move_size(OLD,OLD,xsize,ysize); + window_move_size(OLD,OLD,xsize+9,ysize); CONTINUE; } // ELSE IF (EAX == 1002)