mblocks: -1 IMG sector

games.ini & allgames: use /kg/ link for /kolibrios/games to get -1 IMG sector

git-svn-id: svn://kolibrios.org@7981 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-05-25 14:20:17 +00:00
parent 7c81cafa41
commit 5df2bd058a
8 changed files with 174 additions and 178 deletions

View File

@ -4,9 +4,9 @@ win_width=750
default_icon=35 default_icon=35
[Casual] [Casual]
2048=/k/games/2048,53 2048=/kg/2048,53
Fara=/k/games/fara/fara,42 Fara=/kg/fara/fara,42
MarbleMatch=/k/games/marblematch3 MarbleMatch=/kg/marblematch3
Tetris=games/tetris,47 Tetris=games/tetris,47
Pipes=games/pipes,26 Pipes=games/pipes,26
Snake=games/snake,32 Snake=games/snake,32
@ -15,36 +15,36 @@ RedSquare=games/rsquare,115
Freecell=games/freecell,68 Freecell=games/freecell,68
Pong=games/pong,101 Pong=games/pong,101
Pong3=games/pong3,12 Pong3=games/pong3,12
Arcanii=/k/games/arcanii,12 Arcanii=/kg/arcanii,12
[Arcade] [Arcade]
LaserTank=/k/games/lasertank/lasertank,72 LaserTank=/kg/lasertank/lasertank,72
Heliothryx=/k/games/heliothryx,112 Heliothryx=/kg/heliothryx,112
Dungeons=/k/games/dungeons/dungeons,94 Dungeons=/kg/dungeons/dungeons,94
JumpBump=/k/games/jumpbump/jumpbump.kex,102 JumpBump=/kg/jumpbump/jumpbump.kex,102
Nsider=/k/games/nsider,109 Nsider=/kg/nsider,109
TheBus=/k/games/the_bus/the_bus,86 TheBus=/kg/the_bus/the_bus,86
Mun=/k/games/mun/mun Mun=/kg/mun/mun
Kosilka=games/kosilka,23 Kosilka=games/kosilka,23
Bomber=/k/games/bomber/bomber,97 Bomber=/kg/bomber/bomber,97
Invaders=/k/games/invaders,111 Invaders=/kg/invaders,111
Sea War=games/SW,66 Sea War=games/SW,66
Almaz=/k/games/almaz,81 Almaz=/kg/almaz,81
Tanks=games/tanks,67 Tanks=games/tanks,67
RocketForces=games/rforces,110 RocketForces=games/rforces,110
Pig=/k/games/pig/pigex,120 Pig=/kg/pig/pigex,120
Ataka=/k/games/ataka,35 Ataka=/kg/ataka,35
Donkey=/k/games/donkey Donkey=/kg/donkey
Loderunner=/k/games/LRL/LRL,41 Loderunner=/kg/LRL/LRL,41
; 21days=/k/games/21days,104 ;rus only ; 21days=/kg/21days,104 ;rus only
BabyPainter=/k/games/BabyPainter,87 BabyPainter=/kg/BabyPainter,87
Klavisha=games/klavisha,69 Klavisha=games/klavisha,69
Millioneer=/k/games/WHOWTBAM/whowtbam,114 Millioneer=/kg/WHOWTBAM/whowtbam,114
StarTrek71=/k/games/sstartrek/SStarTrek StarTrek71=/kg/sstartrek/SStarTrek
[3D Shooter] [3D Shooter]
Quake=/k/games/quake/sdlquake,56 Quake=/kg/quake/sdlquake,56
DOOM1=/k/games/doom1/doom,43 DOOM1=/kg/doom1/doom,43
[Logical] [Logical]
Clicks=games/clicks,18 Clicks=games/clicks,18
@ -52,7 +52,7 @@ Checkers=games/checkers,20
Sudoku=games/sudoku,25 Sudoku=games/sudoku,25
Mine=games/mine,14 Mine=games/mine,14
Flood-It=games/flood-it,59 Flood-It=games/flood-it,59
Knight=/k/games/knight,82 Knight=/kg/knight,82
15=games/15,34 15=games/15,34
Gomoku=games/gomoku,24 Gomoku=games/gomoku,24
Reversi=games/reversi,103 Reversi=games/reversi,103
@ -61,4 +61,4 @@ Lights=games/lights,106
Square=games/msquare,25 Square=games/msquare,25
Memory=games/mblocks Memory=games/mblocks
Lines=games/lines,116 Lines=games/lines,116
Chess=/k/games/KosChess/KosChess,82 Chess=/kg/KosChess/KosChess,82

View File

@ -4,9 +4,9 @@ win_width=750
default_icon=35 default_icon=35
[<5B>扼𠼻鴙諝] [<5B>扼𠼻鴙諝]
2048=/k/games/2048,53 2048=/kg/2048,53
Fara=/k/games/fara/fara,42 Fara=/kg/fara/fara,42
MarbleMatch=/k/games/marblematch3 MarbleMatch=/kg/marblematch3
Tetris=games/tetris,47 Tetris=games/tetris,47
Pipes=games/pipes,26 Pipes=games/pipes,26
Snake=games/snake,32 Snake=games/snake,32
@ -15,36 +15,36 @@ RedSquare=games/rsquare,115
Freecell=games/freecell,68 Freecell=games/freecell,68
Pong=games/pong,101 Pong=games/pong,101
Pong3=games/pong3,12 Pong3=games/pong3,12
Arcanii=/k/games/arcanii,12 Arcanii=/kg/arcanii,12
[<5B>鄋𨸹螗 [<5B>鄋𨸹螗
LaserTank=/k/games/lasertank/lasertank,72 LaserTank=/kg/lasertank/lasertank,72
Heliothryx=/k/games/heliothryx,112 Heliothryx=/kg/heliothryx,112
Dungeons=/k/games/dungeons/dungeons,94 Dungeons=/kg/dungeons/dungeons,94
JumpBump=/k/games/jumpbump/jumpbump.kex,102 JumpBump=/kg/jumpbump/jumpbump.kex,102
Nsider=/k/games/nsider,109 Nsider=/kg/nsider,109
TheBus=/k/games/the_bus/the_bus,86 TheBus=/kg/the_bus/the_bus,86
Mun=/k/games/mun/mun Mun=/kg/mun/mun
Kosilka=games/kosilka,23 Kosilka=games/kosilka,23
Bomber=/k/games/bomber/bomber,97 Bomber=/kg/bomber/bomber,97
Invaders=/k/games/invaders,111 Invaders=/kg/invaders,111
Sea War=games/SW,66 Sea War=games/SW,66
Almaz=/k/games/almaz,81 Almaz=/kg/almaz,81
Tanks=games/tanks,67 Tanks=games/tanks,67
RocketForces=games/rforces,110 RocketForces=games/rforces,110
Pig=/k/games/pig/pigex,120 Pig=/kg/pig/pigex,120
Ataka=/k/games/ataka,35 Ataka=/kg/ataka,35
Donkey=/k/games/donkey Donkey=/kg/donkey
Loderunner=/k/games/LRL/LRL,41 Loderunner=/kg/LRL/LRL,41
21days=/k/games/21days,104 ;rus only 21days=/kg/21days,104 ;rus only
BabyPainter=/k/games/BabyPainter,87 BabyPainter=/kg/BabyPainter,87
Klavisha=games/klavisha,69 Klavisha=games/klavisha,69
Millioneer=/k/games/WHOWTBAM/whowtbam,114 Millioneer=/kg/WHOWTBAM/whowtbam,114
StarTrek71=/k/games/sstartrek/SStarTrek StarTrek71=/kg/sstartrek/SStarTrek
[3D 塩漭鳪] [3D 塩漭鳪]
Quake=/k/games/quake/sdlquake,56 Quake=/kg/quake/sdlquake,56
DOOM1=/k/games/doom1/doom,43 DOOM1=/kg/doom1/doom,43
[𨉼ㄗ蟡嶊言] [𨉼ㄗ蟡嶊言]
Clicks=games/clicks,18 Clicks=games/clicks,18
@ -52,7 +52,7 @@ Checkers=games/checkers,20
Sudoku=games/sudoku,25 Sudoku=games/sudoku,25
Mine=games/mine,14 Mine=games/mine,14
Flood-It=games/flood-it,59 Flood-It=games/flood-it,59
Knight=/k/games/knight,82 Knight=/kg/knight,82
15=games/15,34 15=games/15,34
Gomoku=games/gomoku,24 Gomoku=games/gomoku,24
Reversi=games/reversi,103 Reversi=games/reversi,103
@ -61,4 +61,4 @@ Lights=games/lights,106
Square=games/msquare,25 Square=games/msquare,25
Memory=games/mblocks Memory=games/mblocks
Lines=games/lines,116 Lines=games/lines,116
Chess=/k/games/KosChess/KosChess,82 Chess=/kg/KosChess/KosChess,82

View File

@ -133,6 +133,14 @@ GETKEYII:
EAX = key_editbox; EAX = key_editbox;
} }
inline fastcall byte GetKeyScancode()
{
$mov eax,2
$int 0x40
$shr eax,16
return AL;
}
// ECX is a mode: 1 - scancodes, 0 - ascii // ECX is a mode: 1 - scancodes, 0 - ascii
inline fastcall SetKeyboardMode(ECX) inline fastcall SetKeyboardMode(ECX)
{ {

View File

@ -646,10 +646,10 @@ dword __generator; // random number generator init
//The initialization of the initial data before running //The initialization of the initial data before running
void ______INIT______() void ______INIT______()
{ {
skin_height = GetSkinHeight(); skin_height = @GetSkinHeight();
screen.width = GetScreenWidth()+1; screen.width = @GetScreenWidth()+1;
screen.height = GetScreenHeight()+1; screen.height = @GetScreenHeight()+1;
__generator = GetStartTime(); __generator = @GetStartTime();
mem_init(); mem_init();
main(); main();
} }

View File

@ -5,14 +5,11 @@
#include "../lib/kolibri.h" #include "../lib/kolibri.h"
#endif #endif
inline dword mem_init() inline fastcall void mem_init()
{ {
$push ebx
$mov eax, 68 $mov eax, 68
$mov ebx, 11 $mov ebx, 11
$int 0x40 $int 0x40
$pop ebx
} }
:dword malloc(dword size) :dword malloc(dword size)

View File

@ -1,39 +1,42 @@
/* /*
Memory Blocks for KolibriOS v1.11 Memory Blocks for KolibriOS v1.2
Leency&Veliant Edition Leency&Veliant Edition
2008-2019 2008-2020
*/ */
#define MEMSIZE 4096 * 15 #define MEMSIZE 1024 * 20
#include "..\lib\gui.h" #include "..\lib\gui.h"
#include "..\lib\random.h" #include "..\lib\random.h"
#include "..\lib\obj\libio.h" #include "..\lib\obj\libio.h"
#include "..\lib\obj\libimg.h" #include "..\lib\obj\libimg.h"
proc_info Form;
#ifndef AUTOBUILD #ifndef AUTOBUILD
#include "lang.h--" #include "lang.h--"
#endif #endif
#define COLOR_CELL_BG 0xFFFfff #define BTN_CLOSED 0
#define COLOR_CELL_BORDER 0x94AECE #define BTN_PRESSED 1
#define BTN_OPEN 2
#define CELL_SIZE 43 #define CELL_SIZE 43
#define PANEL_Y CELL_SIZE+4*6 + 4 #define PANEL_Y CELL_SIZE+4*6 + 4
#define PANEL_H 36 #define PANEL_H 36
#define WIN_W CELL_SIZE+4*10 + 4
#define WIN_H PANEL_Y+PANEL_H
#define strok 6 //cell count x #define ROWS 6
#define stolbcov 10 //cell count y #define COLS 10
#define COUNT ROWS*COLS
#ifdef LANG_RUS #ifdef LANG_RUS
#define LABEL_NEW_GAME "<22>®¢ ï ¨£à  (F2)"; #define LABEL_NEW_GAME "<22>®¢ ï ¨£à ";
#else #else
#define LABEL_NEW_GAME "New game (F2)"; #define LABEL_NEW_GAME " New game";
#endif #endif
int bitstat[60], bitpict[60]; int bitstat[COUNT], bitpict[COUNT];
dword butonsx[60], butonsy[60]; dword butonsx[COUNT], butonsy[COUNT];
dword firstbit, secondbit; dword firstbit, secondbit;
int count; int count;
@ -45,53 +48,53 @@ void main()
load_dll(libimg, #libimg_init,1); load_dll(libimg, #libimg_init,1);
skin.load("/sys/icons32.png"); skin.load("/sys/icons32.png");
skin.replace_color(0x00000000, COLOR_CELL_BG); skin.replace_color(0x00000000, 0xFFFfff);
NewGame(); NewGame();
loop() switch(WaitEvent()) loop() switch(@WaitEvent())
{ {
case evKey: case evKey:
GetKeys(); if (@GetKeyScancode()==SCAN_CODE_F2) NewGame();
if (key_scancode==60) NewGame();
break; break;
case evButton: case evButton:
id = GetButtonID(); id = @GetButtonID();
if (id==1) ExitProcess(); if (id==1) @ExitProcess();
else if (id==5) NewGame(); else if (id==5) NewGame();
else { else {
if (bitstat[id-100] == 0) id -= 100;
if (bitstat[id] == BTN_CLOSED)
{ {
if (firstbit <> 0x0BAD) if (firstbit != 0x0BAD)
{ {
if (secondbit <> 0x0BAD) if (secondbit != 0x0BAD)
{ {
if (bitpict[firstbit-100] == bitpict[secondbit-100]) if (bitpict[firstbit] == bitpict[secondbit])
bitstat[firstbit-100] = bitstat[secondbit-100] = 2; bitstat[firstbit] = bitstat[secondbit] = BTN_OPEN;
else else
bitstat[firstbit-100] = bitstat[secondbit-100] = 0; bitstat[firstbit] = bitstat[secondbit] = BTN_CLOSED;
ReDraw_Game_Button(firstbit - 100); ReDraw_Game_Button(firstbit);
ReDraw_Game_Button(secondbit - 100); ReDraw_Game_Button(secondbit);
secondbit = 0x0BAD; secondbit = 0x0BAD;
firstbit = id; firstbit = id;
bitstat[id-100] = 1; bitstat[id] = BTN_PRESSED;
ReDraw_Game_Button(id - 100); ReDraw_Game_Button(id);
count++; count++;
} }
else if (firstbit<>id) else if (firstbit != id)
{ {
secondbit = id; secondbit = id;
bitstat[id-100] = 1; bitstat[id] = BTN_PRESSED;
ReDraw_Game_Button(id - 100); ReDraw_Game_Button(id);
count++; count++;
} }
} }
else else
{ {
firstbit = id; firstbit = id;
bitstat[id-100] = 1; bitstat[id] = BTN_PRESSED;
ReDraw_Game_Button(id - 100); ReDraw_Game_Button(id);
count++; count++;
} }
} }
@ -101,12 +104,10 @@ void main()
case evReDraw: case evReDraw:
sc.get(); sc.get();
DefineAndDrawWindow(215,100,CELL_SIZE+4*10 + 4 + 9,PANEL_Y+4+PANEL_H+skin_height, DefineAndDrawWindow(215,100,WIN_W + 9,WIN_H+4+skin_height,
0x34,0xC0C0C0,"Memory Blocks",0); 0x34,0xC0C0C0,"Memory Blocks",0);
GetProcessInfo(#Form, SelfInfo);
Draw_Panel(); Draw_Panel();
Draw_Game_Pole(); Draw_Game_Pole();
break;
} }
} }
@ -115,7 +116,7 @@ void NewGame()
int off; int off;
int i; int i;
FOR (i = 0; i < 60; i++) FOR (i = 0; i < COUNT; i++)
{ {
bitstat[i] = 0; bitstat[i] = 0;
bitpict[i] = 0; bitpict[i] = 0;
@ -123,81 +124,67 @@ void NewGame()
count = 0; count = 0;
firstbit = secondbit = 0x0BAD; firstbit = secondbit = 0x0BAD;
FOR (i = 0; i < 30; i++) FOR (i = 0; i < COUNT/2; i++)
{ {
do off = random(60); while (bitpict[off] != 0); do off = random(COUNT); while (bitpict[off] != 0);
bitpict[off] = i; bitpict[off] = i;
do off = random(60); while (bitpict[off] != 0); do off = random(COUNT); while (bitpict[off] != 0);
bitpict[off] = i; bitpict[off] = i;
} }
Draw_Game_Pole(); Draw_Game_Pole();
Draw_Panel(); Draw_Panel();
} }
void ReDraw_Game_Button(int id)
{
DefineButton(butonsx[id], butonsy[id], CELL_SIZE, CELL_SIZE, 100 + id + BT_HIDE, 0);
switch (bitstat[id])
{
case 0:
Draw_Block(butonsx[id], butonsy[id]);
break;
case 1:
Draw_Pressed_Block(butonsx[id], butonsy[id]);
img_draw stdcall(skin.image, butonsx[id]+6, butonsy[id]+6, 32, 32, 0, bitpict[id]*32);
BREAK;
case 2:
Draw_Open_Block(butonsx[id], butonsy[id]);
img_draw stdcall(skin.image, butonsx[id]+6, butonsy[id]+6, 32, 32, 0, bitpict[id]*32);
BREAK;
}
}
void Draw_Game_Pole() void Draw_Game_Pole()
{ {
int i; int i;
byte j; byte j;
for (j = 0; j < stolbcov; j++) for (i = 0; i < strok; i++) for (j = 0; j < COLS; j++) for (i = 0; i < ROWS; i++)
{ {
butonsx[j*strok+i] = CELL_SIZE+4 * j + 4; //save coordinates to avoid butonsx[j*ROWS+i] = CELL_SIZE+4 * j + 4; //save coordinates to avoid
butonsy[j*strok+i] = CELL_SIZE+4 * i + 4; //their recalculation after butonsy[j*ROWS+i] = CELL_SIZE+4 * i + 4; //their recalculation after
ReDraw_Game_Button(j*strok + i); ReDraw_Game_Button(j*ROWS + i);
} }
} }
void Draw_Block(dword x, y) void ReDraw_Game_Button(int id)
{ {
DrawRectangle(x, y, CELL_SIZE, CELL_SIZE, COLOR_CELL_BORDER);//border dword xx, yy;
DrawRectangle3D(x + 1, y + 1, CELL_SIZE-2, CELL_SIZE-2, 0xFFFFFF, 0xDEDEDE);//bump xx = butonsx[id];
DrawBar(x + 2, y + 2, CELL_SIZE-3, CELL_SIZE-3, 0xBDC7D6);//background yy = butonsy[id];
} DefineButton(xx, yy, CELL_SIZE, CELL_SIZE, 100 + BT_HIDE + id, 0);
DrawRectangle3D(xx, yy, CELL_SIZE, CELL_SIZE, 0x94AECE, 0x94AECE);//border
void Draw_Open_Block(dword x, y) switch (bitstat[id])
{ {
DrawRectangle(x, y, CELL_SIZE, CELL_SIZE, COLOR_CELL_BORDER);//border case BTN_CLOSED:
DrawBar(x + 1, y + 1, CELL_SIZE-1, CELL_SIZE-1, COLOR_CELL_BG);//background DrawRectangle3D(xx + 1, yy + 1, CELL_SIZE-2, CELL_SIZE-2, 0xFFFFFF, 0xDEDEDE);//bump
} DrawBar(xx + 2, yy + 2, CELL_SIZE-3, CELL_SIZE-3, 0xBDC7D6);//background
break;
void Draw_Pressed_Block(dword x, y) case BTN_PRESSED:
{ DrawWideRectangle(xx + 1, yy + 1, CELL_SIZE-1, CELL_SIZE-1, 2, 0x94DB00);//border green
DrawRectangle(x, y, CELL_SIZE, CELL_SIZE, COLOR_CELL_BORDER);//border DrawBar(xx + 3, yy + 3, CELL_SIZE-5, CELL_SIZE-5, 0xFFFfff);//background
DrawWideRectangle(x + 1, y + 1, CELL_SIZE-1, CELL_SIZE-1, 2, 0x94DB00);//border green img_draw stdcall(skin.image, xx+6, yy+6, 32, 32, 0, bitpict[id]*32);
DrawBar(x + 3, y + 3, CELL_SIZE-5, CELL_SIZE-5, COLOR_CELL_BG);//background BREAK;
case BTN_OPEN:
DrawBar(xx+1, yy+1, CELL_SIZE-1, CELL_SIZE-1, 0xFFFfff);//background
img_draw stdcall(skin.image, xx+6, yy+6, 32, 32, 0, bitpict[id]*32);
}
} }
void Draw_Panel() void Draw_Panel()
{ {
DrawBar(0, PANEL_Y, Form.cwidth, 1, sc.work_dark); DrawBar(0, PANEL_Y, WIN_W, 1, sc.work_dark);
DrawBar(0, PANEL_Y+1, Form.cwidth, 1, sc.work_light); DrawBar(0, PANEL_Y+1, WIN_W, 1, sc.work_light);
DrawBar(0, PANEL_Y+2, Form.cwidth, PANEL_H-2, sc.work); DrawBar(0, PANEL_Y+2, WIN_W, PANEL_H-2, sc.work);
DrawStandartCaptButton(9, PANEL_Y+5, 5, LABEL_NEW_GAME); DefineButton(9, PANEL_Y+5, 102, 26, 5, sc.button);
WriteText(20, PANEL_Y+11, 0x90, sc.button_text, LABEL_NEW_GAME);
Draw_Count(); Draw_Count();
} }
void Draw_Count() void Draw_Count()
{ {
DrawBar(Form.cwidth-32,PANEL_Y + 12,30,12,sc.work); EDI = sc.work; //writing a number with bg
WriteNumber(Form.cwidth-32, PANEL_Y + 12, 0x90, sc.work_text, 3, count); WriteNumber(WIN_W-32, PANEL_Y + 12, 0xD0, sc.work_text, 3, count);
} }

View File

@ -10,17 +10,16 @@
// // // //
//===================================================// //===================================================//
dword pick_active = true; dword picked_color;
dword picked_color = 0; char picked_color_string[7];
char picked_color_string[11];
#define FORM_W 167 #define FORM_W 167
#define FORM_H 60 #define FORM_H 60
#define COLOR_BLOCK_SIZE 42 #define PICKED_SIZE 42
#define COLOR_BLOCK_PADDING FORM_H - COLOR_BLOCK_SIZE / 2 #define PICKED_PADDING FORM_H - PICKED_SIZE / 2
#define COLOR_BLOCK_X FORM_W - COLOR_BLOCK_SIZE - COLOR_BLOCK_PADDING #define PICKED_X FORM_W - PICKED_SIZE - PICKED_PADDING
#define BUTTON_ID_CLOSE 1 #define BUTTON_CLOSE 1
#define BUTTON_ID_COPY 2 #define BUTTON_COPY 2
#define BUTTON_ID_PICK 3 #define BUTTON_PICK 3
//===================================================// //===================================================//
// // // //
@ -30,11 +29,12 @@ char picked_color_string[11];
void main() void main()
{ {
bool pick_active = true;
int btn; int btn;
proc_info Form; proc_info Form;
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE); @SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE);
SetWindowLayerBehaviour(-1, ZPOS_ALWAYS_TOP); @SetWindowLayerBehaviour(-1, ZPOS_ALWAYS_TOP);
loop() switch(WaitEvent()) loop() switch(@WaitEvent())
{ {
case evMouse: case evMouse:
mouse.get(); mouse.get();
@ -48,15 +48,15 @@ void main()
break; break;
case evButton: case evButton:
btn = GetButtonID(); btn = @GetButtonID();
if (btn == BUTTON_ID_CLOSE) ExitProcess(); if (btn == BUTTON_CLOSE) ExitProcess();
if (btn == BUTTON_ID_COPY) EventCopyHex(); if (btn == BUTTON_COPY) EventCopyHex();
if (btn == BUTTON_ID_PICK) pick_active = true; if (btn == BUTTON_PICK) pick_active = true;
break; break;
case evKey: case evKey:
GetKeys(); key_scancode = @GetKeyScancode();
if (key_scancode == SCAN_CODE_ESC) ExitProcess(); if (key_scancode == SCAN_CODE_ESC) @ExitProcess();
if (key_scancode == SCAN_CODE_KEY_C) EventCopyHex(); if (key_scancode == SCAN_CODE_KEY_C) EventCopyHex();
break; break;
@ -74,8 +74,8 @@ void draw_window()
DrawRectangle3D(1, 1, FORM_W-2, FORM_H-2, 0xCCCccc, 0x888888); DrawRectangle3D(1, 1, FORM_W-2, FORM_H-2, 0xCCCccc, 0x888888);
DrawBar(2,2,FORM_W-3,FORM_H-3,0xFFFfff); DrawBar(2,2,FORM_W-3,FORM_H-3,0xFFFfff);
DrawRectangle(COLOR_BLOCK_X-2, COLOR_BLOCK_PADDING-2, COLOR_BLOCK_SIZE+3, COLOR_BLOCK_SIZE+3, 0xCBC6C5); DrawRectangle(PICKED_X-2, PICKED_PADDING-2, PICKED_SIZE+3, PICKED_SIZE+3, 0xCBC6C5);
DefineHiddenButton(COLOR_BLOCK_X-1, COLOR_BLOCK_PADDING-1, COLOR_BLOCK_SIZE+1, COLOR_BLOCK_SIZE+1, BUTTON_ID_PICK); DefineHiddenButton(PICKED_X-1, PICKED_PADDING-1, PICKED_SIZE+1, PICKED_SIZE+1, BUTTON_PICK);
DrawCopyButton(67, 11, 35, 14); DrawCopyButton(67, 11, 35, 14);
@ -86,8 +86,8 @@ void draw_window()
void str2col(dword buf, number) void str2col(dword buf, number)
{ {
byte s; byte s;
strlcpy(buf,"0x00000000",10); strlcpy(buf,"000000",6);
buf+=10; buf+=6;
while(number) while(number)
{ {
$dec buf $dec buf
@ -100,27 +100,26 @@ void str2col(dword buf, number)
void EventUpdateWindowContent() void EventUpdateWindowContent()
{ {
//sprintf(#picked_color_string, "%A", picked_color);
str2col(#picked_color_string, picked_color); str2col(#picked_color_string, picked_color);
rgb.DwordToRgb(picked_color); rgb.DwordToRgb(picked_color);
WriteTextWithBg(12,12, 0xD0, 0x000111, #picked_color_string+4, 0xFFFfff); WriteTextWithBg(12,12, 0xD0, 0x000111, #picked_color_string, 0xFFFfff);
WriteNumber(12,33, 0xD0, 0xff0000, 3, rgb.r); WriteNumber(12,33, 0xD0, 0xff0000, 3, rgb.r);
WriteNumber(44,33, 0xD0, 0x008000, 3, rgb.g); WriteNumber(44,33, 0xD0, 0x008000, 3, rgb.g);
WriteNumber(75,33, 0xD0, 0x0000ff, 3, rgb.b); WriteNumber(75,33, 0xD0, 0x0000ff, 3, rgb.b);
DrawBar(COLOR_BLOCK_X, COLOR_BLOCK_PADDING, COLOR_BLOCK_SIZE, COLOR_BLOCK_SIZE, picked_color); DrawBar(PICKED_X, PICKED_PADDING, PICKED_SIZE, PICKED_SIZE, picked_color);
} }
void DrawCopyButton(dword _x, _y, _w, _h) void DrawCopyButton(dword _x, _y, _w, _h)
{ {
DefineHiddenButton(_x+1, _y+1, _w-2, _h-2, BUTTON_ID_COPY); DefineHiddenButton(_x+1, _y+1, _w-2, _h-2, BUTTON_COPY);
DrawRectangle(_x, _y, _w, _h, 0x777777); DrawRectangle(_x, _y, _w, _h, 0x777777);
WriteText(_x+6, _h-8/2 + _y, 0x80, 0x555555, "Copy"); WriteText(_x+6, _h-8/2 + _y, 0x80, 0x555555, "Copy");
} }
void EventCopyHex() void EventCopyHex()
{ {
Clipboard__CopyText(#picked_color_string+4); Clipboard__CopyText(#picked_color_string);
} }

View File

@ -265,6 +265,7 @@ void EventIconClick(dword appid)
// //
// convert relative path to absolute "calc" => "/sys/calc" // convert relative path to absolute "calc" => "/sys/calc"
// convert short kolibrios path to full "/k/calc" => "/kolibrios/calc" // convert short kolibrios path to full "/k/calc" => "/kolibrios/calc"
// convert short kolibrios path to full "/kg/2048" => "/kolibrios/games/2048"
// other copy => as is // other copy => as is
if (ESBYTE[app_path]!='/') { if (ESBYTE[app_path]!='/') {
strcpy(#run_app_path, "/sys/"); strcpy(#run_app_path, "/sys/");
@ -273,6 +274,10 @@ void EventIconClick(dword appid)
strcpy(#run_app_path, "/kolibrios/"); strcpy(#run_app_path, "/kolibrios/");
app_path+=3; app_path+=3;
} }
else if (!strncmp(app_path, "/kg/",3)) {
strcpy(#run_app_path, "/kolibrios/games/");
app_path+=4;
}
strcat(#run_app_path, app_path); strcat(#run_app_path, app_path);
// }end // }end