Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 125 → Rev 126

/programs/games/mine/trunk/draw.h--
1,7 → 1,7
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
Copyright (C) 2003, 2004 Ivan Poddubny
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
22,7 → 22,6
void draw_window()
// Ïðîöåäóðà îòðèñîâêè îêíà
{
mouse_disable();
 
sys_window_redraw(1);
sys_get_colors(#colors, 40);
33,7 → 32,7
sys_draw_window(EBX, ECX, 0x02CCCCCC, colors.w_grab | 0x80000000, colors.w_frames);
 
// LABEL
sys_write_text(8<<16+8, colors.w_grab_text | 0x10000000, "MeOS MineSweeper", 16);
sys_write_text(8<<16+8, colors.w_grab_text | 0x10000000, "MineSweeper", 11);
 
// <CLOSE> BUTTON (1)
EBX = xsize - 19; EBX = EBX<<16 + 12;
44,6 → 43,11
EBX = EBX << 16 + 20;
sys_draw_button(EBX, 25<<16+20, 911, clLightGray);
 
// <MAIN> BUTTON (1000)
// EBX = ncx * XPX; EBX += XST << 16;
// ECX = ncy * YPX; ECX += YST << 16;
// sys_draw_button(EBX, ECX, 1000, 0x60000000);
 
// <CHANGE MODE> BUTTON (1001)
sys_draw_button(10<<16+7, 23<<16+7, 1001, 0x118811);
 
65,7 → 69,6
draw_minesi(); // draw mines
draw_squares(); // draw field
 
mouse_enable();
}
 
dword num_colors[8]=
80,11 → 83,12
0x808080 // 8
};
 
 
// Îòðèñîâêà îäíîé êëåòêè
void draw_square(int x, y)
// Îòðèñîâêà îäíîé êëåòêè
{
int xl, xr, yt, yb;
dword tcolor = clBlack;
int xl, xr, yt, yb; // ñëåâà, ñïðàâà, ñâåðõó, ñíèçó
dword tcolor = clBlack; // öâåò çíà÷åíèÿ êëåòêè ïî óìîë÷àíèþ ÷åðíûé
byte tchar,tval;
 
xl = XPX * x + XST;
96,10 → 100,11
ECX = yt << 16 + yb - yt;
$inc ebx
$inc ecx
sys_draw_bar(EBX, ECX, clLightGray);
sys_draw_bar(EBX, ECX, clLightGray); // ðèñóåò çàêðàøåííûé ïðÿìîóãîëüíèê
 
if (!get_open(x, y))
{
// ðèñóåì ðàìêó
ECX = yt << 16 + yb - 1;
sys_draw_line(xl<<16+xl, ECX, clWhite);
EBX = xl << 16 + xr - 1;
125,13 → 130,9
else // get_open(x,y)==TRUE
{
tval = get_value(x, y);
IF (tval == 0)
IF (tval != 0)
{
//tcolor=clLightGray;
//tchar=' ';
GOTO NOCHAR;
}
ELSE IF (tval == MINE)
IF (tval == MINE)
{
tcolor = 0xee1111;
tchar = '*';
141,19 → 142,19
tchar = tval + '0';
tcolor = num_colors[tval-1];
}
 
EBX = xl + 5; EBX <<= 16; EBX += yt + 5;
sys_write_text(EBX, tcolor, #tchar, 1);
EBX += 0x00010000;
sys_write_text(EBX, ECX, EDX, ESI);
NOCHAR:
}
sys_draw_line(xl << 16 + xl, yt << 16 + yb, clDarkGray);
sys_draw_line(xl << 16 + xr, yt << 16 + yt, EDX);
}
}
 
 
// Òàéìåð
void draw_time()
// Òàéìåð
{
sys_draw_bar(XST<<16+25, 31<<16+10, 0xCCCCCC);
EBX = 0x00030000;
160,21 → 161,23
sys_write_number(EBX, time, XST<<16+32, 0x10ff0000);
}
 
 
// Èíäèêàòîð êîëè÷åñòâà íåðàññòàâëåííûõ ìèí
void draw_minesi()
// Èíäèêàòîð êîëè÷åñòâà íåðàññòàâëåííûõ ìèí
{
EBX = xsize - XST - 25;
$PUSH EBX
EBX = EBX << 16 + 25;
sys_draw_bar(EBX, 31<<16+12, 0xCCCCCC);
sys_draw_bar(EBX, 31<<16+10, 0xCCCCCC);
$POP EDX
EDX <<= 16; EDX += 30;
EDX <<= 16; EDX += 32;
EBX = 0x00030000;
sys_write_number(EBX, cmines, EDX, 0x10ff0000);
}
 
 
// Îòðèñîâêà ìèííîãî ïîëÿ
void draw_squares()
// Îòðèñîâêà ìèííîãî ïîëÿ
{
int x,y;