Lights (SQ_GAME): update code and UI

Sysmon: show RAM used in KiB
Sudoku: avoid window move when open/close additional panel
Snake: make a grid less visible
Icons32.png: add couple game icons


git-svn-id: svn://kolibrios.org@7373 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2018-09-16 09:42:32 +00:00
parent f441b6c9b0
commit cc44bb85a6
13 changed files with 72 additions and 64 deletions

View File

@ -411,6 +411,7 @@ tup.append_table(img_files, {
{"GAMES/FREECELL", PROGS .. "/games/freecell/freecell"}, {"GAMES/FREECELL", PROGS .. "/games/freecell/freecell"},
{"GAMES/GOMOKU", PROGS .. "/games/gomoku/trunk/gomoku"}, {"GAMES/GOMOKU", PROGS .. "/games/gomoku/trunk/gomoku"},
{"GAMES/KLAVISHA", PROGS .. "/games/klavisha/trunk/klavisha"}, {"GAMES/KLAVISHA", PROGS .. "/games/klavisha/trunk/klavisha"},
{"GAMES/LIGHTS", PROGS .. "/games/sq_game/trunk/SQ_GAME"},
{"GAMES/LINES", PROGS .. "/games/lines/lines"}, {"GAMES/LINES", PROGS .. "/games/lines/lines"},
{"GAMES/MSQUARE", PROGS .. "/games/MSquare/trunk/MSquare"}, {"GAMES/MSQUARE", PROGS .. "/games/MSquare/trunk/MSquare"},
{"GAMES/PIPES", PROGS .. "/games/pipes/pipes"}, {"GAMES/PIPES", PROGS .. "/games/pipes/pipes"},
@ -418,7 +419,6 @@ tup.append_table(img_files, {
{"GAMES/PONG3", PROGS .. "/games/pong3/trunk/pong3"}, {"GAMES/PONG3", PROGS .. "/games/pong3/trunk/pong3"},
{"GAMES/RSQUARE", PROGS .. "/games/rsquare/trunk/rsquare"}, {"GAMES/RSQUARE", PROGS .. "/games/rsquare/trunk/rsquare"},
{"GAMES/SNAKE", PROGS .. "/games/snake/trunk/snake"}, {"GAMES/SNAKE", PROGS .. "/games/snake/trunk/snake"},
{"GAMES/SQ_GAME", PROGS .. "/games/sq_game/trunk/SQ_GAME"},
{"GAMES/SUDOKU", PROGS .. "/games/sudoku/trunk/sudoku"}, {"GAMES/SUDOKU", PROGS .. "/games/sudoku/trunk/sudoku"},
{"GAMES/SW", PROGS .. "/games/sw/trunk/sw"}, {"GAMES/SW", PROGS .. "/games/sw/trunk/sw"},
{"GAMES/TANKS", PROGS .. "/games/tanks/trunk/tanks"}, {"GAMES/TANKS", PROGS .. "/games/tanks/trunk/tanks"},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -3,6 +3,20 @@ window_width=750
window_title=KolibriOS Game Center window_title=KolibriOS Game Center
default_icon=35 default_icon=35
[Casual]
2048=/kolibrios/games/2048/2048,53
Fara=/kolibrios/games/fara/fara,42
MarbleMatch=/kolibrios/games/MarbleMatch3/MarbleMatch3
Tetris=/sys/games/tetris,47
Pipes=/sys/games/pipes,26
Snake=/sys/games/snake,32
Xonix=/sys/games/xonix,21
RedSquare=/sys/games/rsquare
Freecell=/sys/games/freecell,68
Pong=/sys/games/pong,12
Pong3=/sys/games/pong3,12
Arcanii=/kolibrios/games/arcanii,12
[Arcade] [Arcade]
LaserTank=/kolibrios/games/lasertank/lasertank,72 LaserTank=/kolibrios/games/lasertank/lasertank,72
Heliothryx=/kolibrios/games/heliothryx/heliothryx Heliothryx=/kolibrios/games/heliothryx/heliothryx
@ -27,6 +41,11 @@ BabyPainter=/kolibrios/games/BabyPainter,87
Klavisha=/sys/games/klavisha,69 Klavisha=/sys/games/klavisha,69
Millioneer=/sys/games/whowtbam Millioneer=/sys/games/whowtbam
[3D Shooter]
Quake=/kolibrios/games/quake/sdlquake,56
DOOM1=/kolibrios/games/doom1/doom,43
; DOOM2=/kolibrios/games/doom2/doom,43
[Logical] [Logical]
Clicks=/sys/games/clicks,18 Clicks=/sys/games/clicks,18
Checkers=/sys/games/checkers,20 Checkers=/sys/games/checkers,20
@ -37,26 +56,9 @@ Knight=/kolibrios/games/knight,82
15=/sys/games/15,34 15=/sys/games/15,34
Gomoku=/sys/games/gomoku,24 Gomoku=/sys/games/gomoku,24
Reversi=/sys/games/reversi Reversi=/sys/games/reversi
C4=/sys/games/c4 C4=/sys/games/c4,100
Lights=/sys/games/lights,99
Square=/sys/games/msquare,25 Square=/sys/games/msquare,25
Memory=/sys/games/mblocks Memory=/sys/games/mblocks
Lines=/sys/games/lines,59 Lines=/sys/games/lines,59
[Casual]
2048=/kolibrios/games/2048/2048,53
Fara=/kolibrios/games/fara/fara,42
MarbleMatch=/kolibrios/games/MarbleMatch3/MarbleMatch3
Tetris=/sys/games/tetris,47
Pipes=/sys/games/pipes,26
Snake=/sys/games/snake,32
Xonix=/sys/games/xonix,21
RedSquare=/sys/games/rsquare
Freecell=/sys/games/freecell,68
Pong=/sys/games/pong,12
Pong3=/sys/games/pong3,12
Arcanii=/kolibrios/games/arcanii,12
[3D Shooter]
Quake=/kolibrios/games/quake/sdlquake,56
DOOM1=/kolibrios/games/doom1/doom,43
; DOOM2=/kolibrios/games/doom2/doom,43

View File

@ -508,14 +508,12 @@ void DrawActiveColor(dword iny)
DrawFrame(right_bar.x, outy, CELL, CELL, NULL); DrawFrame(right_bar.x, outy, CELL, CELL, NULL);
DrawBar(right_bar.x+2, outy+2, CELL-4, CELL-4, color1); DrawBar(right_bar.x+2, outy+2, CELL-4, CELL-4, color1);
sprintf(#param, "%A", color1); sprintf(#param, "%A", color1);
EDI = system.color.work; WriteTextWithBg(right_bar.x+30, outy+3, 0xD0, system.color.work_text, #param+4, system.color.work);
WriteText(right_bar.x + 30, outy + 3, 0xD0, system.color.work_text, #param+4);
DrawFrame(right_bar.x+110, outy, CELL, CELL, NULL); DrawFrame(right_bar.x+110, outy, CELL, CELL, NULL);
DrawBar(right_bar.x+110+2, outy+2, CELL-4, CELL-4, color2); DrawBar(right_bar.x+110+2, outy+2, CELL-4, CELL-4, color2);
sprintf(#param, "%A", color2); sprintf(#param, "%A", color2);
EDI = system.color.work; WriteTextWithBg(right_bar.x+30+110, outy+3, 0xD0, system.color.work_text, #param+4, system.color.work);
WriteText(right_bar.x+110 + 30, outy + 3, 0xD0, system.color.work_text, #param+4);
DrawCurrentColorGradientByLightness(); DrawCurrentColorGradientByLightness();
} }

View File

@ -62,8 +62,7 @@ struct checkbox
x=_x; y=_y; x=_x; y=_y;
DefineButton(x-1, y-1, strlen(text)*8 + SIZE + 17, SIZE+2, id+BT_HIDE+BT_NOFRAME, 0); DefineButton(x-1, y-1, strlen(text)*8 + SIZE + 17, SIZE+2, id+BT_HIDE+BT_NOFRAME, 0);
EDI = system.color.work; WriteTextWithBg(x+SIZE+8, SIZE / 2 + y -7, 0xD0, system.color.work_text, text, system.color.work);
WriteText(x+SIZE+8, SIZE / 2 + y -7, 0xD0, system.color.work_text, text);
DrawRectangle(x, y, SIZE, SIZE, system.color.work_graph); DrawRectangle(x, y, SIZE, SIZE, system.color.work_graph);
if (checked == 0) if (checked == 0)
{ {

View File

@ -53,8 +53,7 @@
DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, id_inc, system.color.work_button, system.color.work_button_text, "+"); DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, id_inc, system.color.work_button, system.color.work_button_text, "+");
DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, id_dec, system.color.work_button, system.color.work_button_text, "-"); DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, id_dec, system.color.work_button, system.color.work_button_text, "-");
EDI = system.color.work; WriteTextWithBg(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text, system.color.work);
WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text);
DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light); DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light);
} }

View File

@ -458,12 +458,14 @@ inline fastcall dword SetWindowLayerBehaviour(EDX, ESI)
:dword WriteBufText(dword x,y,byte fontType, dword color, str_offset, buf_offset) :dword WriteBufText(dword x,y,byte fontType, dword color, str_offset, buf_offset)
{ {
EAX = 4;
EBX = x<<16+y;
ECX = fontType<<24+color;
EDX = str_offset;
EDI = buf_offset; EDI = buf_offset;
$int 0x40; WriteText(x,y, fontType, color, str_offset);
}
:void WriteTextWithBg(dword x,y,byte fontType, dword color, str_offset, bgcolor)
{
EDI = bgcolor;
WriteText(x,y, fontType, color, str_offset);
} }
:void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset) :void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset)

View File

@ -99,8 +99,9 @@ void DrawOptionsWindow()
WriteText(ELEM_X, y.inc(20), 0x81, system.color.work_text, "Network settings"); WriteText(ELEM_X, y.inc(20), 0x81, system.color.work_text, "Network settings");
automatic.draw(ELEM_X, y.inc(65)); automatic.draw(ELEM_X, y.inc(65));
EDI = system.color.work; for (i=0; i<4; i++) {
for (i=0; i<4; i++) WriteText(ELEM_X+40, i*35+POP_server_box.top + 3, 0xD0, system.color.work_text, text1[i]); WriteTextWithBg(ELEM_X+40, i*35+POP_server_box.top + 3, 0xD0, system.color.work_text, text1[i], system.color.work);
}
DrawEditBox(#POP_server_box); DrawEditBox(#POP_server_box);
DrawEditBox(#POP_server_port_box); DrawEditBox(#POP_server_port_box);
DrawEditBox(#SMTP_server_box); DrawEditBox(#SMTP_server_box);

View File

@ -138,15 +138,19 @@ void main()
default: default:
MonitorCpu(); MonitorCpu();
//MonitorRam();
ram.draw_progress( ram.draw_progress(
GetFreeRAM()*ram.w/GetTotalRAM(), GetFreeRAM()*ram.w/GetTotalRAM(),
GetTotalRAM()-GetFreeRAM()/1024, GetTotalRAM()-GetFreeRAM()/1024,
GetFreeRAM()/1024, GetFreeRAM()/1024,
"M" "M"
); );
DrawBar(ram.x+ram.w-96, ram.y-25, 96, 20, system.color.work);
sprintf(#param, "%i KiB", GetTotalRAM()-GetFreeRAM());
WriteText(ram.x+ram.w-calc(strlen(#param)*8), ram.y-25, 0x90, system.color.work_text, #param);
dir_size.get("/rd/1"); //MonitorRd();
dir_size.get("/rd/1");
dir_size.bytes += dir_size.files/2 + 32 * 512; //file attr size + FAT table size dir_size.bytes += dir_size.files/2 + 32 * 512; //file attr size + FAT table size
dir_size.bytes /= 1024; //convert to KiB dir_size.bytes /= 1024; //convert to KiB
dir_size.bytes = 1440 - dir_size.bytes; dir_size.bytes = 1440 - dir_size.bytes;
@ -157,6 +161,7 @@ void main()
"K" "K"
); );
//MonitorTmp();
if (tmp_size[0]) { if (tmp_size[0]) {
dir_size.get("/tmp0/1"); dir_size.get("/tmp0/1");
dir_size.bytes += dir_size.files/2 + 32 * 512; //file attr size + FAT table size dir_size.bytes += dir_size.files/2 + 32 * 512; //file attr size + FAT table size

View File

@ -61,7 +61,7 @@ Decorations = 3
; 10 = corners_outer ; 10 = corners_outer
; 11 = corners_crosses ; 11 = corners_crosses
Background_color = 0,0,0 Background_color = 0,0,0
Decorations_color = 170,170,0 Decorations_color = 35,35,0
Snake_color = 17,17,255 Snake_color = 17,17,255
Snake_head_color = 107,107,255 Snake_head_color = 107,107,255
; by default Snake_head_color is equal to Snake_color, so the snake has no head ; by default Snake_head_color is equal to Snake_color, so the snake has no head

View File

@ -2,18 +2,21 @@
; Author: Alexei Ershov aka ealex ; Author: Alexei Ershov aka ealex
; E-mail: e-al[at]yandex[dot]ru ; E-mail: e-al[at]yandex[dot]ru
; Fidonet: 2:469/335.38 ; Fidonet: 2:469/335.38
; slightly updated by leency and renamed to Lights
; https://en.wikipedia.org/wiki/Lights_Out_(game)
; slightly optimized by diamond ; slightly optimized by diamond
; english translation by diamond (two strings in end of source) ; english translation by diamond (two strings in end of source)
BtnSize equ 32 ; à §¬¥à ª­®¯ª¨ BtnSize equ 36 ; à §¬¥à ª­®¯ª¨
BtnSpace equ 10 ; ¯à®¬¥¦ã⮪ ¬¥¦¤ã ª­®¯ª ¬¨ BtnSpace equ 0 ; ¯à®¬¥¦ã⮪ ¬¥¦¤ã ª­®¯ª ¬¨
NofBtn equ 4 ; à §¬¥à ¯®«ï (3-15) NofBtn equ 4 ; à §¬¥à ¯®«ï (3-15)
Color1 equ 0xcc0000 Color1 equ 0xcc0000
Color2 equ 0x00cc00 Color2 equ 0x00cc00
FieldSize = (BtnSize+BtnSpace)*NofBtn + BtnSpace*3 FieldSize = (BtnSize+BtnSpace)*NofBtn + BtnSpace*3
center = FieldSize / 2 center = FieldSize / 2
margin = 20
use32 ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à  use32 ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
@ -28,7 +31,7 @@
dd 0x0 ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢ (­¥ ¨á¯®«ì§ã¥âáï) dd 0x0 ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢ (­¥ ¨á¯®«ì§ã¥âáï)
dd 0x0 ; § à¥§¥à¢¨à®¢ ­® dd 0x0 ; § à¥§¥à¢¨à®¢ ­®
include 'macros.inc' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§­ì  áᥬ¡«¥à騪®¢! include '../../../macros.inc' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§­ì  áᥬ¡«¥à騪®¢!
START: START:
@ -130,16 +133,16 @@ button:
Draw_Window: Draw_Window:
mcall 12, 1 mcall 12, 1
mcall 0, 200*65536+FieldSize,\ mcall 0, 200*65536+FieldSize+margin*2,\
200*65536+FieldSize+20+20+20,\ 200*65536+FieldSize+28+margin*3,\
0x14AABBCC, 0x805080D0, header 0x14DDD7CF, 0x805080D0, header
mcall 8, BtnSpace*2*65536 + 83,\ mcall 8, (BtnSpace*2+margin)*65536 + 83,\
(FieldSize+BtnSpace+20)*65536+ 15, 2 (FieldSize+BtnSpace+margin*2+10)*65536+ 22, 2
mcall 4, (BtnSpace*2+3)*65536+(BtnSize+BtnSpace)*NofBtn+BtnSpace*4+20+4,\ mcall 4, (BtnSpace*2+3+margin)*65536+(FieldSize+BtnSpace+margin*2)+14,\
0x10DDEEFF, strNew, strNew_e - strNew 0x90DDEEFF, strNew
mcall 4, (center - 25) * 65536 + 30, 0, strMovs, strMovs_e - strMovs mcall 4, (center - 25+margin) * 65536 + 30, 0x80000000, strMovs
mcall 47, 4*65536+1, moves, (center + 2 ) * 65536 + 30, 0 mcall 47, 4*65536+1, moves, (center + 2+margin ) * 65536 + 30, 0
@ -155,7 +158,7 @@ buttons: ;
test ah, ah ; ¥á«¨ ah = 0, ­ ç¨­ ¥¬ ­®¢ë© àï¤ test ah, ah ; ¥á«¨ ah = 0, ­ ç¨­ ¥¬ ­®¢ë© àï¤
jnz @f jnz @f
add ecx, (BtnSize+BtnSpace)*65536 add ecx, (BtnSize+BtnSpace)*65536
mov ebx, BtnSpace*2*65536+BtnSize mov ebx, (BtnSpace*2+margin)*65536+BtnSize+1
@@: @@:
mov esi, Color1 ; ¡ ©â ¯®  ¤à¥áã mov esi, Color1 ; ¡ ©â ¯®  ¤à¥áã
cmp byte [field-NofBtn+edx], 0 ; field-NofBtn+­®¬¥à_ª­®¯ª¨ cmp byte [field-NofBtn+edx], 0 ; field-NofBtn+­®¬¥à_ª­®¯ª¨
@ -223,20 +226,14 @@ field db NofBtn * NofBtn dup(0)
moves dd 0 moves dd 0
generator dd 0 generator dd 0
header db 'Lights',0
if lang eq ru if lang eq ru
header db 'CQ game',0 strMovs db '•Ž„',0
header_e: strNew db '<27>®¢ ï ¨£à ',0
strMovs db '•Ž„' ; '•Ž„'
strMovs_e:
strNew db '<27>®¢ ï ¨£à ' ; '<27>®¢ ï ¨£à '
strNew_e:
else else
header db 'CQ game',0 strMovs db 'MOVE',0
header_e: strNew db ' New game',0
strMovs db 'MOVE'
strMovs_e:
strNew db ' New game'
strNew_e:
end if end if

View File

@ -0,0 +1,5 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm sudoku.asm sudoku
@erase lang.inc
@pause

View File

@ -249,7 +249,7 @@ still:
bt [flags],9 bt [flags],9
jnc @f jnc @f
add esi,40 add esi,40
@@: mcall 67,100,100,(24*9+12), @@: mcall 67,-1,-1,(24*9+12),
jmp still jmp still
key: key:
mcall 2 mcall 2