forked from KolibriOS/kolibrios
Upload game_center, update Liza, kolibrin search program uses @notify new features
git-svn-id: svn://kolibrios.org@4870 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3b7c0f7388
commit
244ba684f5
@ -4,29 +4,9 @@
|
|||||||
#include "..\lib\mem.h"
|
#include "..\lib\mem.h"
|
||||||
#include "..\lib\file_system.h"
|
#include "..\lib\file_system.h"
|
||||||
|
|
||||||
void str_replace(dword buf_in, what_replace, to_what_replace) {
|
|
||||||
dword start_pos=0;
|
|
||||||
dword buf_from;
|
|
||||||
|
|
||||||
buf_from = malloc(strlen(buf_in));
|
|
||||||
loop() {
|
|
||||||
strcpy(buf_from, buf_in);
|
|
||||||
start_pos = strstr(buf_from, what_replace);
|
|
||||||
if (start_pos == 0) break;
|
|
||||||
strlcpy(buf_in, buf_from, start_pos-buf_from);
|
|
||||||
strcat(buf_in, to_what_replace);
|
|
||||||
start_pos += strlen(what_replace);
|
|
||||||
strcat(buf_in, start_pos);
|
|
||||||
}
|
|
||||||
free(buf_from);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
int id, key;
|
int id, key;
|
||||||
strcpy(#param, " <html>lorem</html>");
|
|
||||||
str_replace(#param, "<", "<");
|
|
||||||
str_replace(#param, ">", ">");
|
|
||||||
|
|
||||||
loop()
|
loop()
|
||||||
{
|
{
|
||||||
|
5
programs/cmm/game_center/compile.bat
Normal file
5
programs/cmm/game_center/compile.bat
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
C-- game_center.c
|
||||||
|
@del game_center
|
||||||
|
@rename game_center.com game_center
|
||||||
|
@pause
|
||||||
|
@del warning.txt
|
157
programs/cmm/game_center/game_center.c
Normal file
157
programs/cmm/game_center/game_center.c
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
/*
|
||||||
|
GAME CENTER v1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MEMSIZE 0x3E80
|
||||||
|
#include "..\lib\kolibri.h"
|
||||||
|
#include "..\lib\strings.h"
|
||||||
|
#include "..\lib\mem.h"
|
||||||
|
#include "..\lib\file_system.h"
|
||||||
|
#include "..\lib\dll.h"
|
||||||
|
#include "..\lib\figures.h"
|
||||||
|
|
||||||
|
#include "..\lib\lib.obj\libio_lib.h"
|
||||||
|
#include "..\lib\lib.obj\libimg_lib.h"
|
||||||
|
|
||||||
|
system_colors sc;
|
||||||
|
proc_info Form;
|
||||||
|
|
||||||
|
struct link {
|
||||||
|
char *name;
|
||||||
|
char *path;
|
||||||
|
int icon;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct link games[] = {
|
||||||
|
"Bomber", "/kolibrios/games/bomber/bomber", 35,
|
||||||
|
"DOOM1", "/kolibrios/games/doom1/doom", 43,
|
||||||
|
"DOOM2", "/kolibrios/games/doom2/doom", 43,
|
||||||
|
"Fara", "/kolibrios/games/fara/fara", 42,
|
||||||
|
"JumpBump", "/kolibrios/games/jumpbump/jumpbump", 35,
|
||||||
|
"Loderunner", "/kolibrios/games/LRL/LRL", 41,
|
||||||
|
"BabyPainter", "/kolibrios/games/baby painter", 35,
|
||||||
|
"Knight", "/kolibrios/games/knight", 35,
|
||||||
|
"Pinton", "/kolibrios/games/piton", 32,
|
||||||
|
|
||||||
|
"15", "/sys/games/15", 34,
|
||||||
|
"Arcanii", "/sys/games/arcanii", 12,
|
||||||
|
"Ataka", "/sys/games/ataka", 35,
|
||||||
|
"C4", "/sys/games/c4", 35,
|
||||||
|
"Checkers", "/sys/games/checkers", 20,
|
||||||
|
"Clicks", "/sys/games/clicks", 18,
|
||||||
|
"FNumbers", "/sys/games/FindNumbers", 35,
|
||||||
|
"Flood-It", "/sys/games/flood-it", 27,
|
||||||
|
"Freecell", "/sys/games/freecell", 35,
|
||||||
|
"Gomoku", "/sys/games/gomoku", 24,
|
||||||
|
"Invaders", "/kolibrios/games/invaders", 35,
|
||||||
|
"Klavisha", "/sys/games/klavisha", 35,
|
||||||
|
"Kosilka", "/sys/games/kosilka", 23,
|
||||||
|
"Lines", "/sys/games/lines", 35,
|
||||||
|
"MBlocks", "/sys/games/mblocks", 11,
|
||||||
|
"Megamaze", "/sys/games/megamaze", 35,
|
||||||
|
"Mine", "/sys/games/mine", 14,
|
||||||
|
"Square", "/sys/games/msquare", 35,
|
||||||
|
"Padenie", "/sys/games/padenie", 35,
|
||||||
|
"Phenix", "/sys/games/phenix", 35,
|
||||||
|
"Pipes", "/sys/games/pipes", 26,
|
||||||
|
"Pong", "/sys/games/pong", 12,
|
||||||
|
"Pong3", "/sys/games/pong3", 12,
|
||||||
|
"Reversi", "/sys/games/reversi", 35,
|
||||||
|
"Rforces", "/sys/games/rforces", 35,
|
||||||
|
"Rsquare", "/sys/games/rsquare", 35,
|
||||||
|
"Snake", "/sys/games/snake", 32,
|
||||||
|
"Sq game", "/sys/games/sq_game", 35,
|
||||||
|
"Sudoku", "/sys/games/sudoku", 25,
|
||||||
|
"Sea War", "/sys/games/SW", 35,
|
||||||
|
"Tanks", "/sys/games/tanks", 35,
|
||||||
|
"Tetris", "/sys/games/tetris", 35,
|
||||||
|
"Whowtbam", "/sys/games/whowtbam", 35,
|
||||||
|
"Xonix", "/sys/games/xonix", 21,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
struct struct_skin {
|
||||||
|
dword image, w, h;
|
||||||
|
int Load();
|
||||||
|
} skin;
|
||||||
|
|
||||||
|
int struct_skin::Load()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
dword image_data;
|
||||||
|
skin.image = load_image("/sys/iconstrp.png");
|
||||||
|
if (!skin.image) notify("'iconstrp.png not found' -E");
|
||||||
|
skin.w = DSWORD[skin.image+4];
|
||||||
|
skin.h = DSWORD[skin.image+8];
|
||||||
|
image_data = DSDWORD[skin.image+24];
|
||||||
|
sc.get();
|
||||||
|
|
||||||
|
for (i=0; i<w*h*4; i+=4)
|
||||||
|
{
|
||||||
|
if (DSDWORD[image_data + i]==0) DSDWORD[image_data + i] = 0xF3F3F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
int id, key;
|
||||||
|
mem_Init();
|
||||||
|
if (load_dll2(libio, #libio_init,1)!=0) notify("Error: library doesn't exists - libio");
|
||||||
|
if (load_dll2(libimg, #libimg_init,1)!=0) notify("Error: library doesn't exists - libimg");
|
||||||
|
skin.Load();
|
||||||
|
|
||||||
|
loop()
|
||||||
|
{
|
||||||
|
switch(WaitEvent())
|
||||||
|
{
|
||||||
|
case evButton:
|
||||||
|
id=GetButtonID();
|
||||||
|
if (id==1) ExitProcess();
|
||||||
|
if (id>=100) RunProgram(games[id-100].path, "");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case evKey:
|
||||||
|
key = GetKey();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case evReDraw:
|
||||||
|
sc.get();
|
||||||
|
DefineAndDrawWindow(215,100,568,390+60+GetSkinHeight(),0x74,sc.work," ");
|
||||||
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
|
if (Form.status_window>2) break;
|
||||||
|
draw_window();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw_window()
|
||||||
|
{
|
||||||
|
int row, col, col_max=8;
|
||||||
|
int col_w=68, col_h=70;
|
||||||
|
int tmp,y=25;
|
||||||
|
DrawBar(0,0,Form.cwidth, y-1, sc.work);
|
||||||
|
DrawBar(0,y-1, Form.cwidth, 1, sc.work_graph);
|
||||||
|
DrawBar(0,y, Form.cwidth, Form.cheight-y, 0xF3F3F3);
|
||||||
|
WriteTextB(Form.cwidth/2-70, 9, 0x90, sc.work_text, "KolibriOS Game Center");
|
||||||
|
|
||||||
|
y += 7;
|
||||||
|
for (col=0, row=0; games[row*col_max+col].name!=0; col++)
|
||||||
|
{
|
||||||
|
if (col==col_max) {
|
||||||
|
row++;
|
||||||
|
col=0;
|
||||||
|
}
|
||||||
|
DefineButton(col*col_w+6,row*col_h+y,col_w,col_h,row*col_max+col+100+BT_HIDE,0);
|
||||||
|
tmp = col_w/2;
|
||||||
|
img_draw stdcall(skin.image, col*col_w+tmp-10, row*col_h+5+y, 32, 32, 0, games[row*col_max+col].icon*32);
|
||||||
|
WriteTextCenter(col*col_w+7,row*col_h+47+y,col_w,0xD4D4d4,games[row*col_max+col].name);
|
||||||
|
WriteTextCenter(col*col_w+6,row*col_h+46+y,col_w,0x000000,games[row*col_max+col].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
stop:
|
@ -38,8 +38,7 @@ void main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GetSystemLanguage()==4) notify("<EFBFBD>¥ ¬®£ã ©â¨ installer.kex ¨ ¢ ®¤®¬ ª®à¥ ¤¨áª ! <20>®¯à®¡ã©â¥ ©â¨ ¨ § ¯ãáâ¨âì ¥£® ¢àãçãî.");
|
notify("'<27>¥ ¬®£ã ©â¨ installer.kex ¨ ¢ ®¤®¬ ª®à¥ ¤¨áª !\n<EFBFBD>®¯à®¡ã©â¥ ©â¨ ¨ § ¯ãáâ¨âì ¥£® ¢àãçãî.' -dE");
|
||||||
else notify("Can't find installer.kex at the root of all disks! Try to find and run it manually."w);
|
|
||||||
ExitProcess();
|
ExitProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +79,17 @@ char immbuffer[BUFFERSIZE];
|
|||||||
llist mail_list;
|
llist mail_list;
|
||||||
llist letter_view;
|
llist letter_view;
|
||||||
|
|
||||||
|
dword TAB_H = false; //19;
|
||||||
|
dword TAB_W = 150;
|
||||||
|
dword TOOLBAR_H = 31; //50;
|
||||||
|
dword STATUSBAR_H =15;
|
||||||
|
dword col_bg;
|
||||||
|
dword panel_color;
|
||||||
|
dword border_color;
|
||||||
|
|
||||||
|
pb progress_bar = {0, 10, 83, 150, 12, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F};
|
||||||
|
|
||||||
|
int http_transfer;
|
||||||
char version[]=" WebView 0.1";
|
char version[]=" WebView 0.1";
|
||||||
#include "..\TWB\TWB.c"
|
#include "..\TWB\TWB.c"
|
||||||
|
|
||||||
|
@ -100,21 +100,25 @@ void MailBoxNetworkProcess() {
|
|||||||
mailsize = atr.GetSize(mail_list.current+1) + 1024;
|
mailsize = atr.GetSize(mail_list.current+1) + 1024;
|
||||||
free(mailstart);
|
free(mailstart);
|
||||||
mailstart = malloc(mailsize);
|
mailstart = malloc(mailsize);
|
||||||
|
mailend = mailstart;
|
||||||
if (!mailstart)
|
if (!mailstart)
|
||||||
{
|
{
|
||||||
debugln("alloc error!");
|
debugln("alloc error!");
|
||||||
aim=NULL;
|
aim=NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mailend = mailstart;
|
debug("mailsize: "); debugi(mailsize);
|
||||||
aim = GET_ANSWER_RETR;
|
aim = GET_ANSWER_RETR;
|
||||||
debugln("goto GET_ANSWER_RETR");
|
debugln("goto GET_ANSWER_RETR");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GET_ANSWER_RETR:
|
case GET_ANSWER_RETR:
|
||||||
|
debug("mailsize: "); debugi(mailsize);
|
||||||
|
debug("mailstart: "); debugi(mailstart);
|
||||||
|
debug("mailend: "); debugi(mailend);
|
||||||
ticks = Receive(socketnum, mailend, mailsize + mailstart - mailend, MSG_DONTWAIT);
|
ticks = Receive(socketnum, mailend, mailsize + mailstart - mailend, MSG_DONTWAIT);
|
||||||
if (ticks == 0xffffffff) break;
|
if (ticks == 0xffffffff) break;
|
||||||
mailend += ticks;
|
mailend = mailend + ticks;
|
||||||
if (mailsize + mailstart - mailend - 2 < 0)
|
if (mailsize + mailstart - mailend - 2 < 0)
|
||||||
{
|
{
|
||||||
debugln("Resizing buffer");
|
debugln("Resizing buffer");
|
||||||
@ -122,13 +126,15 @@ void MailBoxNetworkProcess() {
|
|||||||
mailstart = realloc(mailstart, mailsize);
|
mailstart = realloc(mailstart, mailsize);
|
||||||
if (!mailstart) { StopConnect("Realloc error!"); break;}
|
if (!mailstart) { StopConnect("Realloc error!"); break;}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (mailsize>9000)
|
if (mailsize>9000)
|
||||||
{
|
{
|
||||||
load_persent = mailend - mailstart * 100 ;
|
load_persent = mailend - mailstart * 100 ;
|
||||||
load_persent /= mailsize - 1024;
|
load_persent /= mailsize - 1024;
|
||||||
if (load_persent != cur_st_percent) SetMailBoxStatus( load_persent , NULL);
|
if (load_persent != cur_st_percent) SetMailBoxStatus( load_persent , NULL);
|
||||||
}
|
}
|
||||||
ParseMail();
|
*/
|
||||||
|
//ParseMail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +321,7 @@ void DrawMailList() {
|
|||||||
WriteText(on_x + 42, on_y+5, 0x80, 0, atr.GetSubject(i+mail_list.first+1));
|
WriteText(on_x + 42, on_y+5, 0x80, 0, atr.GetSubject(i+mail_list.first+1));
|
||||||
DrawBar(0, on_y + mail_list.line_h-1, mail_list.w, 1, 0xCCCccc);
|
DrawBar(0, on_y + mail_list.line_h-1, mail_list.w, 1, 0xCCCccc);
|
||||||
WriteText(10, on_y+5, 0x80, 0, itoa(i+mail_list.first+1));
|
WriteText(10, on_y+5, 0x80, 0, itoa(i+mail_list.first+1));
|
||||||
WriteText(mail_list.w - 40, on_y+5, 0x80, 0, ConvertMemSize(atr.GetSize(i+mail_list.first+1)));
|
WriteText(mail_list.w - 40, on_y+5, 0x80, 0, ConvertSize(atr.GetSize(i+mail_list.first+1)));
|
||||||
}
|
}
|
||||||
DrawBar(0, i*mail_list.line_h + mail_list.y, mail_list.w, -i*mail_list.line_h+mail_list.h, 0xFFFfff);
|
DrawBar(0, i*mail_list.line_h + mail_list.y, mail_list.w, -i*mail_list.line_h+mail_list.h, 0xFFFfff);
|
||||||
DrawScroller1();
|
DrawScroller1();
|
||||||
@ -328,9 +334,9 @@ void DrawLetterInfo() {
|
|||||||
DrawBar(0, lt_y+2, Form.cwidth, LIST_INFO_H-4, sc.work);
|
DrawBar(0, lt_y+2, Form.cwidth, LIST_INFO_H-4, sc.work);
|
||||||
WriteText(mail_list.w-30/2, lt_y, 0x80, 0x888888, "= = =");
|
WriteText(mail_list.w-30/2, lt_y, 0x80, 0x888888, "= = =");
|
||||||
WriteText(mail_list.w-30/2, lt_y+1, 0x80, 0xEeeeee, "= = =");
|
WriteText(mail_list.w-30/2, lt_y+1, 0x80, 0xEeeeee, "= = =");
|
||||||
DrawBar(0, lt_y+LIST_INFO_H-2, mail_list.w, 1, sc.work_graph); //bottom
|
DrawBar(0, lt_y+LIST_INFO_H-2, Form.cwidth, 1, sc.work_graph); //bottom
|
||||||
DrawBar(0, lt_y+LIST_INFO_H-1, mail_list.w, 1, 0xdfdfdf);
|
DrawBar(0, lt_y+LIST_INFO_H-1, Form.cwidth, 1, 0xdfdfdf);
|
||||||
DrawBar(0, lt_y+LIST_INFO_H , mail_list.w, 1, 0xf0f0f0);
|
DrawBar(0, lt_y+LIST_INFO_H , Form.cwidth, 1, 0xf0f0f0);
|
||||||
WriteTextB(10, lt_y+8 , 0x80, sc.work_text, "From:");
|
WriteTextB(10, lt_y+8 , 0x80, sc.work_text, "From:");
|
||||||
WriteText (45, lt_y+8 , 0x80, sc.work_text, #from);
|
WriteText (45, lt_y+8 , 0x80, sc.work_text, #from);
|
||||||
WriteTextB(10, lt_y+20, 0x80, sc.work_text, "To:");
|
WriteTextB(10, lt_y+20, 0x80, sc.work_text, "To:");
|
||||||
@ -347,7 +353,7 @@ void InitTWB() {
|
|||||||
Form.cheight - mail_list.y - mail_list.h - LIST_INFO_H - 1 - status_bar_h, 60, 12);
|
Form.cheight - mail_list.y - mail_list.h - LIST_INFO_H - 1 - status_bar_h, 60, 12);
|
||||||
WB1.list.column_max = WB1.list.w - 30 / 6;
|
WB1.list.column_max = WB1.list.w - 30 / 6;
|
||||||
WB1.list.visible = WB1.list.h / WB1.list.line_h;
|
WB1.list.visible = WB1.list.h / WB1.list.line_h;
|
||||||
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h, WB1.list.line_h);
|
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h);
|
||||||
|
|
||||||
strcpy(#header, #version);
|
strcpy(#header, #version);
|
||||||
pre_text = 0;
|
pre_text = 0;
|
||||||
@ -359,6 +365,7 @@ void DrawLetter() {
|
|||||||
bufsize = strlen(mdata);
|
bufsize = strlen(mdata);
|
||||||
WB1.Prepare(bufsize, mdata);
|
WB1.Prepare(bufsize, mdata);
|
||||||
if (bufsize) WB1.Parse();
|
if (bufsize) WB1.Parse();
|
||||||
|
DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, 0xFFFfff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -388,7 +395,8 @@ void DrawStatusBar() {
|
|||||||
|
|
||||||
|
|
||||||
void SetMailBoxStatus(dword percent1, text1) {
|
void SetMailBoxStatus(dword percent1, text1) {
|
||||||
DrawProgressBar(3, Form.cheight -status_bar_h + 1, 220, 12, sc.work, 0xC3C3C3, 0x54B1D6, sc.work_text, percent1, text1);
|
DrawProgressBar(3, Form.cheight -status_bar_h + 1, 220, 12, sc.work, 0xC3C3C3, 0x54B1D6, sc.work_text, percent1);
|
||||||
|
WriteText(3, Form.cheight -status_bar_h + 1, 0x80, sc.work_text, text1);
|
||||||
cur_st_percent = percent1;
|
cur_st_percent = percent1;
|
||||||
cur_st_text = text1;
|
cur_st_text = text1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user