clicks: small update, use scancode keys

git-svn-id: svn://kolibrios.org@6167 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-02-07 21:18:54 +00:00
parent 3e5852cee7
commit 0bf8ef743f
8 changed files with 72 additions and 49 deletions

View File

@ -89,8 +89,8 @@ void Draw_List()
} }
else else
{ {
DrawBar(0, yyy, list[active].w, list[active].item_h, system.color.grab_button); DrawBar(0, yyy, list[active].w, list[active].item_h, 0x94AECE);
if (i<list[active].count) WriteText(12,yyy+list[active].text_y,0x80,system.color.grab_button_text, #temp_filename); if (i<list[active].count) WriteText(12,yyy+list[active].text_y,0x80,0x000000, #temp_filename);
} }
} }
else else

View File

@ -2,10 +2,18 @@
#define INCLUDE_SYSTEM_H #define INCLUDE_SYSTEM_H
#print "[include <system.h>]\n" #print "[include <system.h>]\n"
:struct COLORS :struct COLORS {
{ dword
dword frame,grab,grab_button,grab_button_text,grab_text, nonset1,
work,work_button,work_button_text,work_text,work_graph; nonset2,
work_light,
work_dark,
nonset3,
work,
work_button,
work_button_text,
work_text,
work_graph;
void get(); void get();
}; };
@ -13,7 +21,7 @@
{ {
EAX = 48; EAX = 48;
EBX = 3; EBX = 3;
ECX = #frame; ECX = #nonset1;
EDX = 40; EDX = 40;
$int 0x40 $int 0x40
} }

View File

@ -7,7 +7,7 @@ system_colors sc;
//óðîâíè ñëîæíîñòè //óðîâíè ñëîæíîñòè
int DIFFICULTY_LEVEL=1; //ïî-óìîë÷àíèþ ñðåäíåå ïîëå int DIFFICULTY_LEVEL=1; //ïî-óìîë÷àíèþ ñðåäíåå ïîëå
char *BOARD_SIZES[]={ "S", "M", "L", 0 }; char *BOARD_SIZES[]={ "S\0", "M\0", "L\0", 0 };
int DIFFICULTY_LEV_PARAMS[]={ 9, 12, 16 }; int DIFFICULTY_LEV_PARAMS[]={ 9, 12, 16 };
int BLOCKS_NUM; //êîëè÷åñòâî êâàäðàòèêîâ ïî Õ è ïî Y int BLOCKS_NUM; //êîëè÷åñòâî êâàäðàòèêîâ ïî Õ è ïî Y
@ -18,14 +18,14 @@ int blocks_matrix[28*28]; //
#define BLOCK_SIZE 21 //ðàçìåð êâàäðàòèêà #define BLOCK_SIZE 21 //ðàçìåð êâàäðàòèêà
#define MARKED 7 #define MARKED 7
#define DELETED_BLOCK 6 #define DELETED_BLOCK 6
#define HEADER "Just Clicks v2.1" #define HEADER "Just Clicks v2.2"
#ifndef AUTOBUILD #ifndef AUTOBUILD
#include "lang.h--" #include "lang.h--"
#endif #endif
#ifdef LANG_RUS #ifdef LANG_RUS
char NEW_GAME_TEXT[]=" ‡ ­®¢® [F2]"; char NEW_GAME_TEXT[]="‡ ­®¢® [F2]";
char REZULT_TEXT[]="<EFBFBD>¥§ã«ìâ â: "; char REZULT_TEXT[]="<EFBFBD>¥§ã«ìâ â: ";
#elif LANG_EST #elif LANG_EST
char NEW_GAME_TEXT[]="Uus mäng [F2]"; char NEW_GAME_TEXT[]="Uus mäng [F2]";
@ -38,7 +38,7 @@ int blocks_matrix[28*28]; //
void main() void main()
{ {
int key, id; int key_scancode, id;
BLOCKS_NUM=DIFFICULTY_LEV_PARAMS[DIFFICULTY_LEVEL]; BLOCKS_NUM=DIFFICULTY_LEV_PARAMS[DIFFICULTY_LEVEL];
@ -75,10 +75,10 @@ void main()
} }
break; break;
case evKey: case evKey:
key = GetKey(); key_scancode = GetKeyScancode();
if (key==027) //Escape if (key_scancode==001) //Escape
ExitProcess(); ExitProcess();
if (key==051) //F2 if (key_scancode==060) //F2
{ {
_NEW_GAME_MARK: _NEW_GAME_MARK:
new_game(); new_game();
@ -181,14 +181,8 @@ void draw_window()
DrawBar(0,PANEL_Y, PANEL_Y, USER_PANEL_HEIGHT, sc.work); //ïàíåëü ñíèçó DrawBar(0,PANEL_Y, PANEL_Y, USER_PANEL_HEIGHT, sc.work); //ïàíåëü ñíèçó
//íîâàÿ èãðà DrawCaptButton(10, PANEL_Y+7, 90, 20, 2, sc.work_button, sc.work_button_text,#NEW_GAME_TEXT);
DefineButton(10,PANEL_Y+7, 13*6+6, 20, 2,sc.work_button); DrawCaptButton(105,PANEL_Y+7, 20, 20, 10,sc.work_button, sc.work_button_text,BOARD_SIZES[DIFFICULTY_LEVEL]);
WriteText(10+4,PANEL_Y+14,0x80,sc.work_button_text,#NEW_GAME_TEXT,0);
//êíîïî÷êa âûáîðà óðîâíÿ ñëîæíîñòè
DefineButton(95,PANEL_Y+7, 20,20, 10,sc.work_button);
WriteText(95+8,PANEL_Y+14,0x80,sc.work_button_text,BOARD_SIZES[DIFFICULTY_LEVEL],0);
draw_field(); draw_field();
@ -272,7 +266,7 @@ void draw_field()
else else
{ {
DefineButton(j*BLOCK_SIZE,i*BLOCK_SIZE,BLOCK_SIZE-1,BLOCK_SIZE-1, current_id+100+BT_HIDE,0); DefineButton(j*BLOCK_SIZE,i*BLOCK_SIZE,BLOCK_SIZE-1,BLOCK_SIZE-1, current_id+100+BT_HIDE,0);
PutImage(blocks_matrix[current_id]*1323+#img,21,21,j*BLOCK_SIZE,i*BLOCK_SIZE); PutImage(blocks_matrix[current_id]*1323+#block,21,21,j*BLOCK_SIZE,i*BLOCK_SIZE);
} }
} }
} }

View File

@ -1,8 +1,9 @@
del lang.h-- @del lang.h--
echo #define LANG_ENG 1 >lang.h-- @echo #define LANG_ENG 1 >lang.h--
..\C--\C-- clicks.c C-- clicks.c
del clicks @del clicks
rename clicks.com clicks @rename clicks.com clicks
del warning.txt @del warning.txt
del lang.h-- @del lang.h--
pause @pause
@kpack clicks

View File

@ -1,8 +1,9 @@
del lang.h-- @del lang.h--
echo #define LANG_RUS 1 >lang.h-- @echo #define LANG_RUS 1 >lang.h--
..\C--\C-- clicks.c c-- clicks.c
del clicks @pause
rename clicks.com clicks @del clicks
del warning.txt @rename clicks.com clicks
del lang.h-- @del warning.txt
pause @del lang.h--
@kpack clicks

View File

@ -1,4 +1,4 @@
unsigned char img[6615] = { unsigned char block[6615] = {
0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2,
0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2,
0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -45,8 +45,18 @@ inline fastcall void GetProcessInfo(dword EBX, ECX)
$int 0x40 $int 0x40
} }
struct system_colors{ struct system_colors {
dword frame,grab,grab_button,grab_button_text,grab_text,work,work_button,work_button_text,work_text,work_graph; dword
nonset1,
nonset2,
work_light,
work_dark,
nonset3,
work,
work_button,
work_button_text,
work_text,
work_graph;
void get(); void get();
}; };
@ -55,7 +65,7 @@ void system_colors::get()
$push ecx $push ecx
EAX = 48; EAX = 48;
EBX = 3; EBX = 3;
ECX = #frame; ECX = #nonset1;
EDX = 40; EDX = 40;
$int 0x40 $int 0x40
$pop ecx $pop ecx
@ -68,11 +78,12 @@ inline fastcall dword WaitEvent(){
$int 0x40 $int 0x40
} }
int GetKeyScancode()
inline fastcall word GetKey(){ {
EAX = 2; // just read it key from buffer $mov eax,2
$int 0x40 $int 0x40
EAX = EAX >> 8; $shr eax,16
return AL;
} }
inline fastcall word GetButtonID(){ inline fastcall word GetButtonID(){
@ -243,4 +254,12 @@ done:
$int 0x40 $int 0x40
$pop ecx $pop ecx
$pop ebx $pop ebx
} }
void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text)
{
if (id>0) DefineButton(x,y,w,h,id,color_b);
WriteText(-strlen(text)*6+w/2+x+1,h/2-3+y,0x80,color_t,text);
}