Subversion Repositories Kolibri OS

Rev

Rev 7089 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7089 Rev 7096
Line 9... Line 9...
9
	void set_color();
9
	void set_color();
10
	dword get_color();
10
	dword get_color();
11
	dword get_image();
11
	dword get_image();
12
	void draw_cell();
12
	void draw_cell();
13
	void draw_all_cells();
13
	void draw_all_cells();
-
 
14
	void move();
14
} colors;
15
} colors;
Line 15... Line 16...
15
 
16
 
16
void _colors::set_default_values()
17
void _colors::set_default_values()
17
{
18
{
Line 26... Line 27...
26
	set_color(1,1, 0x66b2ff);
27
	set_color(1,1, 0x66b2ff);
27
}
28
}
Line 28... Line 29...
28
 
29
 
29
void _colors::set_color(int _r, _c, _color)
30
void _colors::set_color(int _r, _c, _color)
30
{
-
 
31
	debugval("_r", _r);
-
 
32
	debugval("_c", _c);
31
{
33
	mas[MAX_COLORS*_r + _c] = _color;
32
	mas[MAX_COLORS*_r + _c] = _color;
Line 34... Line 33...
34
}
33
}
35
 
34
 
Line 60... Line 59...
60
	return image;
59
	return image;
61
}
60
}
Line 62... Line 61...
62
 
61
 
63
void _colors::draw_cell(int _x, _y, _color)
62
void _colors::draw_cell(int _x, _y, _color)
64
{
63
{
65
	DrawRectangle(_x, _y, cell_size, cell_size, 0xA7B2BA);
64
	//DrawRectangle(_x, _y, cell_size, cell_size, system.color.work_graph);
-
 
65
	//DrawBar(_x+1, _y+1, cell_size-1, cell_size-1, _color);
66
	DrawBar(_x+1, _y+1, cell_size-1, cell_size-1, _color);
66
	DrawBar(_x, _y, cell_size, cell_size, _color);
Line 67... Line 67...
67
}
67
}
68
 
68
 
69
void _colors::draw_all_cells()
69
void _colors::draw_all_cells()
Line 73... Line 73...
73
	for (r = 0; r < rows; r++)
73
	for (r = 0; r < rows; r++)
74
	{
74
	{
75
		for (c = 0; c < columns; c++)
75
		for (c = 0; c < columns; c++)
76
		{
76
		{
77
			draw_cell(c*cell_size + x, r*cell_size + y, get_color(r, c));
77
			draw_cell(c*cell_size + x, r*cell_size + y, get_color(r, c));
78
			DefineHiddenButton(c*cell_size + x, r*cell_size + y, cell_size, cell_size, r*columns+c+300);
78
			DefineHiddenButton(c*cell_size + x, r*cell_size + y, cell_size, cell_size, r*columns+c+300+BT_NOFRAME);
79
		}
79
		}
80
	}
80
	}
81
}
81
}
Line -... Line 82...
-
 
82
 
-
 
83
enum {
-
 
84
	DIRECTION_LEFT,
-
 
85
	DIRECTION_RIGHT,
-
 
86
	DIRECTION_UP,
-
 
87
	DIRECTION_DOWN
-
 
88
};
-
 
89
void _colors::move(int direction)
-
 
90
{
-
 
91
	int r, c;
-
 
92
	dword first_element_data;
-
 
93
 
-
 
94
	if (direction == DIRECTION_LEFT)
-
 
95
	{
-
 
96
		for (r = 0; r < rows; r++)
-
 
97
		{
-
 
98
			first_element_data = get_color(r, 0);
-
 
99
			for (c = 0; c < columns-1; c++) set_color(r, c, get_color(r, c+1));
-
 
100
			set_color(r, columns-1, first_element_data);
-
 
101
		}		
-
 
102
	}
-
 
103
	if (direction == DIRECTION_RIGHT)
-
 
104
	{
-
 
105
		for (r = 0; r < rows; r++)
-
 
106
		{
-
 
107
			first_element_data = get_color(r, columns-1);
-
 
108
			for (c = columns-1; c > 0; c--) set_color(r, c, get_color(r, c-1));
-
 
109
			set_color(r, 0, first_element_data);
-
 
110
		}		
-
 
111
	}
-
 
112
 
-
 
113
	draw_all_cells();