mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-24 01:39:35 +03:00
Mine: slightly update UI
KolibriN Installer: translation, add complete frame git-svn-id: svn://kolibrios.org@7661 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e1a32382fd
commit
4b31a55f25
@ -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[] = "<EFBFBD>®¯à®¡ã©â¥ ®¢®¥ ¢¨§ã «ì®¥ ®ä®à¬«¥¨¥ Š®«¨¡à¨, ª®â®à®¥ à ìè¥ ¡ë«® ¤®áâ㯮 ⮫쪮 ¢ KolibriNext.";
|
||||
#ifdef LANG_RUS
|
||||
#define T_INTRO "<22>®¯à®¡ã©â¥ ®¢®¥ ¢¨§ã «ì®¥ ®ä®à¬«¥¨¥ Š®«¨¡à¨, ª®â®à®¥ à ìè¥ ¡ë«® ¤®áâ㯮 ⮫쪮 ¢ 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); }
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
// <NEW GAME> BUTTON (911)
|
||||
// <NEW GAME> 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);
|
||||
|
||||
// <CHANGE MODE> 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);
|
||||
|
||||
// <USER FIELD> 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);
|
||||
}
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user