2012-06-16 19:59:51 +04:00
//Leency 10.10.2011, JustClicks v2.0, GPL
2013-06-02 09:26:24 +04:00
# include "lib\kolibri.h"
2012-06-16 19:59:51 +04:00
# include "lib\random.h"
# include "lib\boxes.txt"
system_colors sc ;
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2012-07-03 20:36:37 +04:00
int DIFFICULTY_LEVEL = 1 ; //<2F> <> -<2D> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD>
2012-06-16 19:59:51 +04:00
char * BOARD_SIZES [ ] = { " S " , " M " , " L " , 0 } ;
int DIFFICULTY_LEV_PARAMS [ ] = { 9 , 12 , 16 } ;
int BLOCKS_NUM ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <20> <20> <> Y
int BLOCKS_LEFT ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
int blocks_matrix [ 28 * 28 ] ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
# define USER_PANEL_HEIGHT 35
# define BLOCK_SIZE 21 //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
# define MARKED 7
# define DELETED_BLOCK 6
2013-02-25 17:24:59 +04:00
# define HEADER "Just Clicks v2.1"
2012-06-16 19:59:51 +04:00
2012-06-16 20:33:04 +04:00
# ifndef AUTOBUILD
# include "lang.h--"
# endif
2012-06-16 19:59:51 +04:00
# ifdef LANG_RUS
2013-06-02 09:26:24 +04:00
char NEW_GAME_TEXT [ ] = " <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> [F2] " ;
2012-06-16 19:59:51 +04:00
char REZULT_TEXT [ ] = " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> : " ;
2013-09-24 22:50:05 +04:00
# elif LANG_EST
char NEW_GAME_TEXT [ ] = " Uus m<> ng [F2] " ;
char REZULT_TEXT [ ] = " Tulemus: " ;
2012-06-16 19:59:51 +04:00
# else
2013-06-02 09:26:24 +04:00
char NEW_GAME_TEXT [ ] = " New Game [F2] " ;
2013-11-19 00:33:07 +04:00
char REZULT_TEXT [ ] = " Result: " ;
2012-06-16 19:59:51 +04:00
# endif
void main ( )
2013-06-02 09:26:24 +04:00
{
2012-06-16 19:59:51 +04:00
int key , id ;
2013-06-02 09:26:24 +04:00
2012-07-03 20:36:37 +04:00
BLOCKS_NUM = DIFFICULTY_LEV_PARAMS [ DIFFICULTY_LEVEL ] ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
new_game ( ) ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
loop ( )
2013-06-02 09:26:24 +04:00
switch ( WaitEvent ( ) )
2012-06-16 19:59:51 +04:00
{
case evButton :
2013-06-02 09:26:24 +04:00
id = GetButtonID ( ) ;
2012-06-16 19:59:51 +04:00
if ( id = = 1 ) ExitProcess ( ) ;
2013-07-07 16:33:16 +04:00
if ( id = = 2 ) | | ( id = = 3 ) goto _NEW_GAME_MARK ;
2012-06-16 19:59:51 +04:00
if ( id > = 100 )
{
if ( check_for_end ( ) ) break ; //<2F> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
move_blocks ( id - 100 ) ;
draw_field ( ) ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
draw_clicks_num ( ) ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
break ;
}
if ( id = = 10 ) //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD>
{
if ( DIFFICULTY_LEVEL < 2 ) DIFFICULTY_LEVEL + + ; else DIFFICULTY_LEVEL = 0 ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
BLOCKS_NUM = DIFFICULTY_LEV_PARAMS [ DIFFICULTY_LEVEL ] ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <20> <20> <> Y
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
new_game ( ) ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
MoveSize ( - 1 , - 1 , BLOCK_SIZE * BLOCKS_NUM + 9 , BLOCK_SIZE * BLOCKS_NUM + GetSkinWidth ( ) + 4 + USER_PANEL_HEIGHT ) ;
break ;
}
break ;
case evKey :
key = GetKey ( ) ;
if ( key = = 027 ) //Escape
ExitProcess ( ) ;
if ( key = = 051 ) //F2
{
_NEW_GAME_MARK :
new_game ( ) ;
draw_clicks_num ( ) ;
draw_field ( ) ;
}
break ;
case evReDraw :
draw_window ( ) ;
}
}
void move_blocks ( int button_id ) //<2F> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> , <20> <> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
{
int i , j ,
marked_num = 1 ,
old_marker = blocks_matrix [ button_id ] ,
restart ;
blocks_matrix [ button_id ] = MARKED ;
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
_RESTART_MARK :
restart = 0 ;
for ( i = 0 ; i < BLOCKS_NUM ; i + + )
for ( j = 0 ; j < BLOCKS_NUM ; j + + )
{
if ( blocks_matrix [ i * BLOCKS_NUM + j ] < > old_marker ) continue ; //<2F> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
if ( blocks_matrix [ i * BLOCKS_NUM + j ] = = MARKED ) continue ; //<2F> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> , <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
if ( j > 0 ) & & ( blocks_matrix [ i * BLOCKS_NUM + j - 1 ] = = MARKED ) blocks_matrix [ i * BLOCKS_NUM + j ] = MARKED ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
if ( i > 0 ) & & ( blocks_matrix [ i - 1 * BLOCKS_NUM + j ] = = MARKED ) blocks_matrix [ i * BLOCKS_NUM + j ] = MARKED ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
if ( j < BLOCKS_NUM - 1 ) & & ( blocks_matrix [ i * BLOCKS_NUM + j + 1 ] = = MARKED ) blocks_matrix [ i * BLOCKS_NUM + j ] = MARKED ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
if ( i < BLOCKS_NUM - 1 ) & & ( blocks_matrix [ i + 1 * BLOCKS_NUM + j ] = = MARKED ) blocks_matrix [ i * BLOCKS_NUM + j ] = MARKED ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
if ( blocks_matrix [ i * BLOCKS_NUM + j ] = = MARKED ) //<2F> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> , <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - <20> <> <EFBFBD> <20> <> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
{
restart = 1 ;
marked_num + + ;
}
}
if ( restart ) goto _RESTART_MARK ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
if ( marked_num = = 1 ) //<2F> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> , <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
{
blocks_matrix [ button_id ] = old_marker ;
return ;
}
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
_2_RESTART_MARK :
restart = 0 ;
for ( i = BLOCKS_NUM ; i > 0 ; i - - )
for ( j = BLOCKS_NUM ; j > = 0 ; j - - )
{
if ( blocks_matrix [ i * BLOCKS_NUM + j ] = = MARKED ) & & ( blocks_matrix [ i - 1 * BLOCKS_NUM + j ] < > blocks_matrix [ i * BLOCKS_NUM + j ] )
{
blocks_matrix [ i * BLOCKS_NUM + j ] > < blocks_matrix [ i - 1 * BLOCKS_NUM + j ] ;
restart = 1 ;
}
}
if ( restart ) goto _2_RESTART_MARK ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> , <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2013-06-02 09:26:24 +04:00
for ( i = 0 ; i < BLOCKS_NUM * BLOCKS_NUM ; i + + )
2012-06-16 19:59:51 +04:00
if ( blocks_matrix [ i ] = = MARKED )
blocks_matrix [ i ] = DELETED_BLOCK ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> , <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
restart = BLOCKS_NUM ; //<2F> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> :(
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
_3_RESTART_MARK :
for ( j = 0 ; j < BLOCKS_NUM - 1 ; j + + )
if ( blocks_matrix [ BLOCKS_NUM - 1 * BLOCKS_NUM + j ] = = DELETED_BLOCK )
{
for ( i = 0 ; i < BLOCKS_NUM ; i + + )
blocks_matrix [ i * BLOCKS_NUM + j ] > < blocks_matrix [ i * BLOCKS_NUM + j + 1 ] ;
}
restart - - ;
if ( restart ) goto _3_RESTART_MARK ;
}
void draw_window ( )
{
2013-11-19 00:33:07 +04:00
int PANEL_Y ;
2012-06-16 19:59:51 +04:00
proc_info Form ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
sc . get ( ) ;
DefineAndDrawWindow ( 300 , 176 , BLOCK_SIZE * BLOCKS_NUM + 9 , BLOCK_SIZE * BLOCKS_NUM + GetSkinWidth ( ) + 4 + USER_PANEL_HEIGHT ,
2013-06-02 09:26:24 +04:00
0x74 , sc . work , 0 , 0 , HEADER ) ;
2012-06-16 19:59:51 +04:00
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
GetProcessInfo ( # Form , SelfInfo ) ;
if ( Form . status_window > 2 ) return ;
PANEL_Y = BLOCK_SIZE * BLOCKS_NUM ;
DrawBar ( 0 , PANEL_Y , PANEL_Y , USER_PANEL_HEIGHT , sc . work ) ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD>
DefineButton ( 10 , PANEL_Y + 7 , 13 * 6 + 6 , 20 , 2 , sc . work_button ) ;
WriteText ( 10 + 4 , PANEL_Y + 14 , 0x80 , sc . work_button_text , # NEW_GAME_TEXT , 0 ) ;
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> a <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
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 ) ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
draw_field ( ) ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
draw_clicks_num ( ) ;
}
int check_for_end ( )
{
int i , j , button_id ;
if ( ! BLOCKS_LEFT ) return 1 ; //epic win
for ( i = 0 ; i < BLOCKS_NUM ; i + + )
for ( j = 0 ; j < BLOCKS_NUM ; j + + )
{
button_id = blocks_matrix [ i * BLOCKS_NUM + j ] ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
if ( button_id = = DELETED_BLOCK ) continue ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
if ( j > 0 ) & & ( blocks_matrix [ i * BLOCKS_NUM + j - 1 ] = = button_id ) return 0 ;
if ( i > 0 ) & & ( blocks_matrix [ i - 1 * BLOCKS_NUM + j ] = = button_id ) return 0 ;
if ( j < BLOCKS_NUM - 1 ) & & ( blocks_matrix [ i * BLOCKS_NUM + j + 1 ] = = button_id ) return 0 ;
if ( i < BLOCKS_NUM - 1 ) & & ( blocks_matrix [ i + 1 * BLOCKS_NUM + j ] = = button_id ) return 0 ;
}
2013-06-02 09:26:24 +04:00
return 2 ;
2012-06-16 19:59:51 +04:00
}
void draw_clicks_num ( )
{
char rezult [ 15 ] ;
int i ;
int TEXT_Y = BLOCK_SIZE * BLOCKS_NUM + 14 ;
int TEXT_X = TEXT_Y / 2 + 48 ; //130;
BLOCKS_LEFT = 0 ;
2013-06-02 09:26:24 +04:00
for ( i = 0 ; i < BLOCKS_NUM * BLOCKS_NUM ; i + + )
if ( blocks_matrix [ i ] < > DELETED_BLOCK ) BLOCKS_LEFT + + ;
2012-06-17 02:41:20 +04:00
DrawBar ( TEXT_X , TEXT_Y , 18 , 9 , sc . work ) ;
2012-06-23 17:11:16 +04:00
WriteText ( TEXT_X , TEXT_Y , 0x80 , sc . work_text , IntToStr ( BLOCKS_LEFT ) , 0 ) ;
2012-06-16 19:59:51 +04:00
if ( check_for_end ( ) )
{
copystr ( # REZULT_TEXT , # rezult ) ;
copystr ( IntToStr ( BLOCKS_LEFT ) , # rezult + strlen ( # rezult ) ) ;
if ( check_for_end ( ) = = 1 ) copystr ( " Epic WIN!!1 " , # rezult ) ;
2013-07-07 16:33:16 +04:00
DrawFlatButton ( BLOCK_SIZE * BLOCKS_NUM / 2 - 70 , BLOCK_SIZE * BLOCKS_NUM / 2 - 20 , 140 , 40 , 3 , # rezult ) ;
2012-06-16 19:59:51 +04:00
}
}
void new_game ( )
{
int i ;
//<2F> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> , MARKED <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> ,
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> DELETED_BLOCK <20> <> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
for ( i = 0 ; i < BLOCKS_NUM * BLOCKS_NUM ; i + + )
blocks_matrix [ i ] = random ( 5 ) ;
2013-07-07 16:33:16 +04:00
DeleteButton ( 3 ) ;
2012-06-16 19:59:51 +04:00
}
void draw_field ( )
{
int i , j ;
int current_id ;
2013-06-02 09:26:24 +04:00
2012-06-16 19:59:51 +04:00
for ( i = 0 ; i < BLOCKS_NUM ; i + + )
for ( j = 0 ; j < BLOCKS_NUM ; j + + )
{
current_id = i * BLOCKS_NUM + j ;
DeleteButton ( current_id + 100 ) ;
if ( blocks_matrix [ current_id ] = = DELETED_BLOCK )
{
DrawBar ( j * BLOCK_SIZE , i * BLOCK_SIZE , BLOCK_SIZE , BLOCK_SIZE , 0xB2B4BF ) ;
}
else
{
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 ) ;
}
}
}
void DrawFlatButton ( dword x , y , width , height , id , text )
{
DrawRegion_3D ( x , y , width , height , sc . work_graph , sc . work_graph ) ;
DrawRegion_3D ( x + 1 , y + 1 , width - 2 , height - 2 , 0xFFFFFF , sc . work ) ;
DrawBar ( x + 2 , y + 2 , width - 3 , height - 3 , sc . work ) ;
IF ( id ) DefineButton ( x , y , width , height , id + BT_HIDE , sc . work ) ;
WriteText ( - strlen ( text ) * 6 + width / 2 + x + 1 , height / 2 - 3 + y , 0x80 , sc . work_text , text , 0 ) ;
}
2013-06-02 09:26:24 +04:00
stop :