2013-03-11 22:16:24 +04:00
|
|
|
|
#define MEMSIZE 0x3E80
|
2012-11-26 19:26:15 +04:00
|
|
|
|
#include "..\lib\kolibri.h"
|
2015-03-05 23:55:28 +03:00
|
|
|
|
#include "..\lib\gui.h"
|
2012-11-26 19:26:15 +04:00
|
|
|
|
#include "..\lib\strings.h"
|
|
|
|
|
#include "..\lib\random.h"
|
|
|
|
|
#include "..\lib\mem.h"
|
|
|
|
|
#include "..\lib\file_system.h"
|
|
|
|
|
|
|
|
|
|
#ifndef ru
|
|
|
|
|
char *BUTTONS_CAPTIONS[]={
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [Enter]"w, 13,
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [End]"w, 181,
|
2014-04-23 20:30:49 +04:00
|
|
|
|
//"<22><><EFBFBD><EFBFBD> [Home]"w, 180,
|
2012-11-26 19:26:15 +04:00
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [Esc]"w, 27,
|
|
|
|
|
0};
|
|
|
|
|
#else
|
|
|
|
|
char *BUTTONS_CAPTIONS[]={
|
|
|
|
|
" Reboot [Enter]",13,
|
|
|
|
|
" Power off [End]",181,
|
2014-04-23 20:30:49 +04:00
|
|
|
|
//" Kernel [Home]",180,
|
2012-11-26 19:26:15 +04:00
|
|
|
|
" Close [Esc]",27,
|
|
|
|
|
0};
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
system_colors sc;
|
|
|
|
|
|
|
|
|
|
unsigned char moon[6*6] = FROM "moon.raw";
|
|
|
|
|
|
|
|
|
|
int WIN_SIZE_X, WIN_SIZE_Y;
|
|
|
|
|
int PANEL_X, PANEL_Y;
|
|
|
|
|
|
2014-04-23 20:30:49 +04:00
|
|
|
|
#define NIGHT_PALEL_HEIGHT 50
|
|
|
|
|
#define STARS_COUNT 25
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
|
|
|
|
#define PANEL_SIZE_X 260
|
2014-04-23 20:30:49 +04:00
|
|
|
|
#define PANEL_SIZE_Y 148
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
|
:void ShadowScreen(dword img, w, h)
|
|
|
|
|
{
|
|
|
|
|
dword to = w*h*3 + img;
|
2013-04-08 17:21:32 +04:00
|
|
|
|
for ( ; img < to; img+=4)
|
|
|
|
|
{
|
|
|
|
|
ESDWORD[img] >>= 1;
|
|
|
|
|
$and ESDWORD[img], 7F7F7F7Fh
|
|
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
|
//for ( ; img < to; img+=4) { ESDWORD[img] >>= 2; $and ESDWORD[img], 3F3F3F3Fh }
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
|
|
|
|
void main()
|
|
|
|
|
{
|
|
|
|
|
int key;
|
2015-07-20 02:09:56 +03:00
|
|
|
|
dword s1,s2, s3, s4, sides_w,i;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
|
|
|
|
mem_Init();
|
2012-11-26 19:26:15 +04:00
|
|
|
|
WIN_SIZE_X=GetScreenWidth()+1;
|
|
|
|
|
WIN_SIZE_Y=GetScreenHeight()+1;
|
|
|
|
|
PANEL_X=WIN_SIZE_X-PANEL_SIZE_X/2;
|
|
|
|
|
PANEL_Y=WIN_SIZE_Y-PANEL_SIZE_Y/2;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
|
|
|
|
sides_w = WIN_SIZE_X-PANEL_SIZE_X/2;
|
|
|
|
|
s1 = mem_Alloc(WIN_SIZE_X*PANEL_Y*3);
|
|
|
|
|
s2 = mem_Alloc(sides_w*PANEL_Y*3);
|
|
|
|
|
s3 = mem_Alloc(sides_w*PANEL_Y*3);
|
|
|
|
|
s4 = mem_Alloc(WIN_SIZE_X*PANEL_Y*3);
|
|
|
|
|
|
|
|
|
|
CopyScreen(s1, 0, 0, WIN_SIZE_X, PANEL_Y);
|
|
|
|
|
ShadowScreen(s1, WIN_SIZE_X, PANEL_Y);
|
|
|
|
|
|
|
|
|
|
CopyScreen(s2, 0, PANEL_Y, sides_w, PANEL_SIZE_Y+1);
|
|
|
|
|
ShadowScreen(s2, sides_w, PANEL_SIZE_Y+1);
|
|
|
|
|
|
|
|
|
|
CopyScreen(s3, sides_w+PANEL_SIZE_X+1, PANEL_Y, sides_w-1, PANEL_SIZE_Y+1);
|
|
|
|
|
ShadowScreen(s3, sides_w, PANEL_SIZE_Y+1);
|
|
|
|
|
|
|
|
|
|
CopyScreen(s4, 0, PANEL_Y+PANEL_SIZE_Y+1, WIN_SIZE_X, PANEL_Y-1);
|
|
|
|
|
ShadowScreen(s4, WIN_SIZE_X, PANEL_Y-1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
goto _DRAW;
|
2012-11-26 19:26:15 +04:00
|
|
|
|
loop()
|
|
|
|
|
{
|
2014-04-23 20:30:49 +04:00
|
|
|
|
WaitEventTimeout(330);
|
2012-11-26 19:26:15 +04:00
|
|
|
|
switch(EAX & 0xFF)
|
|
|
|
|
{
|
|
|
|
|
case evButton:
|
|
|
|
|
key=GetButtonID();
|
|
|
|
|
if (key==1) ExitProcess();
|
|
|
|
|
GOTO _BUTTON_MARK;
|
|
|
|
|
|
|
|
|
|
case evKey:
|
|
|
|
|
key = GetKey();
|
|
|
|
|
_BUTTON_MARK:
|
|
|
|
|
if (key== 13) ExitSystem(REBOOT); //ENTER
|
|
|
|
|
if (key==180) ExitSystem(KERNEL); //HOME
|
|
|
|
|
if (key==181) ExitSystem(TURN_OFF); //END
|
|
|
|
|
if (key== 27) ExitProcess(); //ESC
|
|
|
|
|
if (key== 19) //CTRL+S
|
|
|
|
|
{
|
|
|
|
|
RunProgram("rdsave",0);
|
|
|
|
|
ExitProcess();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw:
|
2013-03-11 22:16:24 +04:00
|
|
|
|
sc.get();
|
|
|
|
|
DefineAndDrawWindow(0,0,WIN_SIZE_X, WIN_SIZE_Y, 0x01, 0, 0, 0x01fffFFF);
|
|
|
|
|
//_PutImage(0,0,WIN_SIZE_X,WIN_SIZE_Y,shadow_buf);
|
2015-07-20 02:09:56 +03:00
|
|
|
|
if(!i){
|
|
|
|
|
_PutImage(0,0,WIN_SIZE_X, PANEL_Y,s1);
|
|
|
|
|
|
|
|
|
|
_PutImage(0,PANEL_Y,sides_w, PANEL_SIZE_Y+1,s2);
|
|
|
|
|
_PutImage(sides_w+PANEL_SIZE_X+1,PANEL_Y,sides_w-1, PANEL_SIZE_Y+1,s3);
|
|
|
|
|
_PutImage(0,PANEL_Y+PANEL_SIZE_Y+1,WIN_SIZE_X, PANEL_Y-1,s4);
|
|
|
|
|
//i = 1;
|
|
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
|
draw_main_area(PANEL_X, PANEL_Y, PANEL_SIZE_X, PANEL_SIZE_Y);
|
2012-11-26 19:26:15 +04:00
|
|
|
|
break;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
default: _DRAW:
|
2012-11-26 19:26:15 +04:00
|
|
|
|
draw_stars();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void draw_main_area()
|
|
|
|
|
{
|
|
|
|
|
int i=0;
|
|
|
|
|
|
|
|
|
|
DrawRectangle(PANEL_X, PANEL_Y, PANEL_SIZE_X, PANEL_SIZE_Y, 0);
|
|
|
|
|
DrawBar(PANEL_X+1, PANEL_Y+NIGHT_PALEL_HEIGHT+1, PANEL_SIZE_X-1, PANEL_SIZE_Y-NIGHT_PALEL_HEIGHT-1, sc.work);
|
|
|
|
|
|
2014-04-23 20:30:49 +04:00
|
|
|
|
for (i=0; i<3; i++)
|
2012-11-26 19:26:15 +04:00
|
|
|
|
{
|
|
|
|
|
DefineButton(PANEL_X+33, i*23 + PANEL_Y+NIGHT_PALEL_HEIGHT+16, 190,19, BUTTONS_CAPTIONS[i*2+1],sc.work_button);
|
2012-12-15 04:16:06 +04:00
|
|
|
|
WriteText(PANEL_X+59, i*23 + PANEL_Y+NIGHT_PALEL_HEIGHT+22, 0x80,sc.work_button_text, BUTTONS_CAPTIONS[i*2]);
|
2012-11-26 19:26:15 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
draw_stars();
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-23 20:30:49 +04:00
|
|
|
|
dword stars_col[4]={0xD2CF19, 0x716900, 0x002041, 0xEAE0DE}; //0x005BFF - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
void draw_stars()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
int i, x_pic, y_pic, col;
|
|
|
|
|
|
|
|
|
|
DrawBar(PANEL_X+1, PANEL_Y+1, PANEL_SIZE_X-1, NIGHT_PALEL_HEIGHT, 0x002041);
|
|
|
|
|
|
|
|
|
|
for (i=0; i<STARS_COUNT; i++)
|
|
|
|
|
{
|
2014-04-23 20:30:49 +04:00
|
|
|
|
x_pic = random(PANEL_SIZE_X-2);
|
|
|
|
|
y_pic = random(NIGHT_PALEL_HEIGHT-2);
|
|
|
|
|
col = random(4);
|
|
|
|
|
PutPixel(PANEL_X+2 +x_pic, PANEL_Y+2 +y_pic, stars_col[col]);
|
|
|
|
|
if (stars_col[col]==0xD2CF19)
|
|
|
|
|
{
|
|
|
|
|
PutPixel(PANEL_X+2 +x_pic+1, PANEL_Y+2 +y_pic, stars_col[col+1]);
|
|
|
|
|
PutPixel(PANEL_X+2 +x_pic-1, PANEL_Y+2 +y_pic, stars_col[col+1]);
|
|
|
|
|
PutPixel(PANEL_X+2 +x_pic, PANEL_Y+2 +y_pic-1, stars_col[col+1]);
|
|
|
|
|
PutPixel(PANEL_X+2 +x_pic, PANEL_Y+2 +y_pic+1, stars_col[col+1]);
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
}
|
2014-04-23 20:30:49 +04:00
|
|
|
|
_PutImage(PANEL_X+PANEL_SIZE_X-60+random(3),PANEL_Y+10+random(3), 6,6, #moon);
|
2012-11-26 19:26:15 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stop:
|