mirror of
https://github.com/jeremysrand/apple2048.git
synced 2024-06-08 06:29:30 +00:00
Use textboxes for the tiles
This commit is contained in:
parent
0342f9a18c
commit
2e0a001c1c
42
apple2048.c
42
apple2048.c
|
@ -14,6 +14,9 @@
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define TILE_WIDTH 10
|
||||||
|
#define TILE_HEIGHT 5
|
||||||
|
|
||||||
void printInstructions(void)
|
void printInstructions(void)
|
||||||
{
|
{
|
||||||
int seed = 0;
|
int seed = 0;
|
||||||
|
@ -49,6 +52,8 @@ void printInstructions(void)
|
||||||
|
|
||||||
cgetc();
|
cgetc();
|
||||||
srand(seed);
|
srand(seed);
|
||||||
|
|
||||||
|
clrscr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,32 +62,21 @@ void printBoard(void)
|
||||||
tPos x;
|
tPos x;
|
||||||
tPos y;
|
tPos y;
|
||||||
|
|
||||||
clrscr();
|
|
||||||
|
|
||||||
for (y = 1; y <= BOARD_SIZE; y++) {
|
|
||||||
printf("+");
|
|
||||||
for (x = 1; x <= BOARD_SIZE; x++) {
|
|
||||||
printf("--------+");
|
|
||||||
}
|
|
||||||
printf("\n!");
|
|
||||||
for (x = 1; x <= BOARD_SIZE; x++) {
|
|
||||||
printf(" !");
|
|
||||||
}
|
|
||||||
printf("\n!");
|
|
||||||
for (x = 1; x <= BOARD_SIZE; x++) {
|
|
||||||
printf("%s!", tileStringForPos(x, y));
|
|
||||||
}
|
|
||||||
printf("\n!");
|
|
||||||
for (x = 1; x <= BOARD_SIZE; x++) {
|
|
||||||
printf(" !");
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
printf("+");
|
|
||||||
for (x = 1; x <= BOARD_SIZE; x++) {
|
for (x = 1; x <= BOARD_SIZE; x++) {
|
||||||
printf("--------+");
|
for (y = 1; y <= BOARD_SIZE; y++) {
|
||||||
|
textframexy((x - 1) * TILE_WIDTH,
|
||||||
|
(y - 1) * TILE_HEIGHT,
|
||||||
|
TILE_WIDTH,
|
||||||
|
TILE_HEIGHT,
|
||||||
|
TEXTFRAME_WIDE);
|
||||||
|
cputsxy((x - 1) * TILE_WIDTH + 1,
|
||||||
|
(y - 1) * TILE_HEIGHT + 2,
|
||||||
|
tileStringForPos(x, y));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
printf("\n\nCURRENT SCORE: %ld\nTRY TO GET THE %ld TILE!", currentScore(),
|
|
||||||
|
gotoxy(0,20);
|
||||||
|
printf("CURRENT SCORE: %ld\nTRY TO GET THE %ld TILE!", currentScore(),
|
||||||
nextTarget());
|
nextTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user