OpenCores
URL https://opencores.org/ocsvn/layer2/layer2/trunk

Subversion Repositories layer2

[/] [layer2/] [trunk/] [sw/] [tennmino/] [view.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 idiolatrie
/******************************************************************************
2
 * Tennmino Version 0.1                                                       *
3
 ******************************************************************************
4
 * Copyright (C)2011  Mathias Hörtnagl <mathias.hoertnagl@gmail.com>          *
5
 *                                                                            *
6
 * This program is free software: you can redistribute it and/or modify       *
7
 * it under the terms of the GNU General Public License as published by       *
8
 * the Free Software Foundation, either version 3 of the License, or          *
9
 * (at your option) any later version.                                        *
10
 *                                                                            *
11
 * This program is distributed in the hope that it will be useful,            *
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
14
 * GNU General Public License for more details.                               *
15
 *                                                                            *
16
 * You should have received a copy of the GNU General Public License          *
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.      *
18
 ******************************************************************************/
19
#include "view.h"
20
 
21
/* Draw a vertical border line. The line width is 2 characters. */
22
void drawVerticalBorder(uchar x, uchar y, uchar h, uchar chr) {
23
   for(uchar i=y; i < h; i++) {
24
      gotoxy(x, i);
25
      putc(chr); putc(chr);
26
   }
27
}
28
 
29
/* Draw a horizontal border line. */
30
void drawHorizontalBorder(uchar x, uchar y, uchar w, uchar chr) {
31
   gotoxy(x, y);
32
   for(uchar i=0; i < w + 2; i++) {
33
      putc(chr);
34
   }
35
}
36
 
37
/* Draw the board. */
38
void drawBoard() {
39
 
40
   cls();
41
 
42
   drawVerticalBorder(BOARD_LEFT, 0, BOARD_HEIGHT, BORDER_FULL);
43
   drawVerticalBorder(BOARD_RIGHT, 0, BOARD_HEIGHT, BORDER_FULL);
44
   drawHorizontalBorder(
45
      BOARD_LEFT,
46
      BOARD_HEIGHT,
47
      BOARD_RIGHT - BOARD_LEFT,
48
      BORDER_FULL
49
   );
50
}
51
 
52
/* Game Over screen. */
53
void drawGameOver() {
54
 
55
   cls();
56
 
57
   gotoxy(45, 15);
58
   printf0("GAME OVER!");
59
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.