Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 13:48:08 +03:00
|
|
|
|
#include "kosSyst.h"
|
|
|
|
|
#include "KosFile.h"
|
|
|
|
|
#include "gfxdef.h"
|
|
|
|
|
#include "mainWnd.h"
|
|
|
|
|
#include "lang.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
RGB bmPMButton[] = {
|
|
|
|
|
0xCCCCCC, 0xCCCCCC, 0x000000, 0x000000, 0xCCCCCC, 0xCCCCCC,
|
|
|
|
|
0xCCCCCC, 0xCCCCCC, 0x000000, 0x000000, 0xCCCCCC, 0xCCCCCC,
|
|
|
|
|
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
|
|
|
|
|
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
|
|
|
|
|
0xCCCCCC, 0xCCCCCC, 0x000000, 0x000000, 0xCCCCCC, 0xCCCCCC,
|
|
|
|
|
0xCCCCCC, 0xCCCCCC, 0x000000, 0x000000, 0xCCCCCC, 0xCCCCCC,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#if LANG == RUS
|
2014-01-19 17:10:54 +04:00
|
|
|
|
char mainWndTitle[] = "PHARAON's CRYPT\0";
|
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 13:48:08 +03:00
|
|
|
|
char mainWndCopyright[] = "(C) MMVI by Rabid Rabbit";
|
2014-01-19 21:00:32 +04:00
|
|
|
|
char mainWndMenuStart[] = "Enter -<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
|
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 13:48:08 +03:00
|
|
|
|
char mainWndMenuLevel[] = "<EFBFBD><EFBFBD>砫<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0AEA2><EFBFBD> - %U";
|
|
|
|
|
#else
|
2014-01-19 21:00:32 +04:00
|
|
|
|
char mainWndTitle[] = "PHARAOH's CRYPT\0";
|
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 13:48:08 +03:00
|
|
|
|
char mainWndCopyright[] = "(C) MMVI by Rabid Rabbit";
|
2014-01-19 21:00:32 +04:00
|
|
|
|
char mainWndMenuStart[] = "Enter - Start game";
|
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 13:48:08 +03:00
|
|
|
|
char mainWndMenuLevel[] = "Starting level - %U";
|
|
|
|
|
#endif
|
|
|
|
|
//
|
|
|
|
|
CKosBitmap mainWndFace;
|
|
|
|
|
//
|
|
|
|
|
Word mcx, mcy;
|
|
|
|
|
|
|
|
|
|
#define BT_SIZE_X_MINUS 4
|
|
|
|
|
#define BT_SIZE_X_PLUS 5
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
int MainWndLoop()
|
|
|
|
|
{
|
|
|
|
|
Byte keyCode;
|
|
|
|
|
Dword buttonID;
|
|
|
|
|
int result;
|
|
|
|
|
static bool firstTime = true;
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
startGameLevel = maxGameLevel;
|
|
|
|
|
//
|
|
|
|
|
if ( firstTime )
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
mainWndFace.GetSize( mcx, mcy );
|
|
|
|
|
//
|
|
|
|
|
firstTime = false;
|
|
|
|
|
//
|
|
|
|
|
DrawMainWindow();
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
kos_ChangeWindow( -1, -1, mcx + 1, mcy + 21 );
|
|
|
|
|
//
|
|
|
|
|
for ( result = MW_NONE; result == MW_NONE; )
|
|
|
|
|
{
|
|
|
|
|
switch( kos_WaitForEvent() )
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
DrawMainWindow();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
if ( kos_GetKey( keyCode ) )
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
switch ( keyCode )
|
|
|
|
|
{
|
2014-01-19 21:00:32 +04:00
|
|
|
|
case 13: // enter
|
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 13:48:08 +03:00
|
|
|
|
result = MW_START_GAME;
|
|
|
|
|
break;
|
|
|
|
|
|
2014-01-19 21:00:32 +04:00
|
|
|
|
case 27: // escape
|
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 13:48:08 +03:00
|
|
|
|
result = MW_EXIT_APP;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
if ( kos_GetButtonID( buttonID ) )
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
switch ( buttonID )
|
|
|
|
|
{
|
|
|
|
|
//
|
2014-01-19 21:00:32 +04:00
|
|
|
|
case 1:
|
|
|
|
|
result = MW_EXIT_APP;
|
|
|
|
|
break;
|
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 13:48:08 +03:00
|
|
|
|
case BT_SIZE_X_MINUS:
|
|
|
|
|
if ( --startGameLevel < 1 )
|
|
|
|
|
startGameLevel = 1;
|
|
|
|
|
else
|
|
|
|
|
DrawMainWindow();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
case BT_SIZE_X_PLUS:
|
|
|
|
|
if ( ++startGameLevel > maxGameLevel )
|
|
|
|
|
startGameLevel = maxGameLevel;
|
|
|
|
|
else
|
|
|
|
|
DrawMainWindow();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
kos_DefineButton(
|
|
|
|
|
0, 0,
|
|
|
|
|
0, 0,
|
|
|
|
|
BT_SIZE_X_MINUS + 0x80000000,
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
//
|
|
|
|
|
kos_DefineButton(
|
|
|
|
|
0, 0,
|
|
|
|
|
0, 0,
|
|
|
|
|
BT_SIZE_X_PLUS + 0x80000000,
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
//
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1)
|
|
|
|
|
void DrawMainWindow()
|
|
|
|
|
{
|
|
|
|
|
char line[64];
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
kos_WindowRedrawStatus( WRS_BEGIN );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>
|
|
|
|
|
kos_DefineAndDrawWindow(
|
|
|
|
|
WNDLEFT, WNDTOP,
|
|
|
|
|
mcx + 1, mcy + 21,
|
2014-01-19 21:00:32 +04:00
|
|
|
|
0x54, 0x0, // Skinned fixed size window, dont fill working area, window has caption
|
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 13:48:08 +03:00
|
|
|
|
0, WNDHEADCOLOUR,
|
2014-01-19 17:10:54 +04:00
|
|
|
|
mainWndTitle
|
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 13:48:08 +03:00
|
|
|
|
);
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
2014-01-19 17:10:54 +04:00
|
|
|
|
kos_ChangeWindowCaption(mainWndTitle);
|
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 13:48:08 +03:00
|
|
|
|
mainWndFace.Draw( 1, 21 );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
kos_WriteTextToWindow(
|
|
|
|
|
8, 32,
|
|
|
|
|
0, 0x0,
|
|
|
|
|
mainWndMenuStart, sizeof(mainWndMenuStart)-1
|
|
|
|
|
);
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
sprintf( line, mainWndMenuLevel, startGameLevel);
|
|
|
|
|
kos_WriteTextToWindow(
|
|
|
|
|
8, 64,
|
|
|
|
|
0, 0x0,
|
|
|
|
|
line, strlen( line )
|
|
|
|
|
);
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
kos_DefineButton(
|
|
|
|
|
mcx - 29, 64,
|
|
|
|
|
12, 12,
|
|
|
|
|
BT_SIZE_X_MINUS,
|
|
|
|
|
0xCCCCCC
|
|
|
|
|
);
|
|
|
|
|
//
|
|
|
|
|
kos_PutImage( bmPMButton + 12, 6, 2, mcx - 29 + 3, 69 );
|
|
|
|
|
//
|
|
|
|
|
kos_DefineButton(
|
|
|
|
|
mcx - 16, 64,
|
|
|
|
|
12, 12,
|
|
|
|
|
BT_SIZE_X_PLUS,
|
|
|
|
|
0xCCCCCC
|
|
|
|
|
);
|
|
|
|
|
//
|
|
|
|
|
kos_PutImage( bmPMButton, 6, 6, mcx - 16 + 3, 67 );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
kos_WriteTextToWindow(
|
|
|
|
|
8, mcy - 16 + 21,
|
|
|
|
|
0, 0x000066,
|
|
|
|
|
mainWndCopyright, sizeof(mainWndCopyright)-1
|
|
|
|
|
);
|
|
|
|
|
//
|
|
|
|
|
kos_WindowRedrawStatus( WRS_END );
|
|
|
|
|
}
|