Main Page | Modules | Namespace List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

tetris.c File Reference

#include "fun.h"
#include <misc.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

Defines

#define KEY_QUIT   1
#define KEY_QUIT   1
#define KEY_CW   2
#define KEY_CCW   3
#define KEY_RIGHT   4
#define KEY_LEFT   5
#define KEY_UP   6
#define KEY_DOWN   7
#define SCN_WID   15
#define SCN_HT   20
#define DIR_UP   { 0, -1 }
#define DIR_DN   { 0, +1 }
#define DIR_LT   { -1, 0 }
#define DIR_RT   { +1, 0 }
#define DIR_UP2   { 0, -2 }
#define DIR_DN2   { 0, +2 }
#define DIR_LT2   { -2, 0 }
#define DIR_RT2   { +2, 0 }
#define COLOR_BLACK   0
#define COLOR_RED   1
#define COLOR_GREEN   2
#define COLOR_YELLOW   3
#define COLOR_BLUE   4
#define COLOR_MAGENTA   5
#define COLOR_CYAN   6
#define COLOR_WHITE   7

Functions

void refresh (void)
void blockDraw (char XPos, char YPos, unsigned Color)
char blockHit (char XPos, char YPos)
void shapeDraw (unsigned XPos, unsigned YPos, char WhichShape)
void shapeErase (unsigned XPos, unsigned YPos, char WhichShape)
char shapeHit (unsigned XPos, unsigned YPos, char WhichShape)
void screenInit (void)
void collapse (void)
void start (void)
void end (void)
int getKey (void)
void FUN_Tetris (void)

Variables

shape Shapes []
char Dirty [SCN_HT]
char Screen [SCN_WID][SCN_HT]

Define Documentation

#define COLOR_BLACK   0
 

#define COLOR_BLUE   4
 

#define COLOR_CYAN   6
 

#define COLOR_GREEN   2
 

#define COLOR_MAGENTA   5
 

#define COLOR_RED   1
 

#define COLOR_WHITE   7
 

#define COLOR_YELLOW   3
 

#define DIR_DN   { 0, +1 }
 

#define DIR_DN2   { 0, +2 }
 

#define DIR_LT   { -1, 0 }
 

#define DIR_LT2   { -2, 0 }
 

#define DIR_RT   { +1, 0 }
 

#define DIR_RT2   { +2, 0 }
 

#define DIR_UP   { 0, -1 }
 

#define DIR_UP2   { 0, -2 }
 

#define KEY_CCW   3
 

#define KEY_CW   2
 

#define KEY_DOWN   7
 

#define KEY_LEFT   5
 

#define KEY_QUIT   1
 

#define KEY_QUIT   1
 

#define KEY_RIGHT   4
 

#define KEY_UP   6
 

#define SCN_HT   20
 

#define SCN_WID   15
 


Function Documentation

void blockDraw char  XPos,
char  YPos,
unsigned  Color
 

char blockHit char  XPos,
char  YPos
 

void collapse void   ) 
 

void end void   ) 
 

void FUN_Tetris void   ) 
 

int getKey void   ) 
 

void refresh void   ) 
 

void screenInit void   ) 
 

void shapeDraw unsigned  XPos,
unsigned  YPos,
char  WhichShape
 

void shapeErase unsigned  XPos,
unsigned  YPos,
char  WhichShape
 

char shapeHit unsigned  XPos,
unsigned  YPos,
char  WhichShape
 

void start void   ) 
 


Variable Documentation

char Dirty[SCN_HT]
 

char Screen[SCN_WID][SCN_HT]
 

shape Shapes[]
 

Initial value:


{       { 0, 0, COLOR_BLUE, { DIR_UP, DIR_RT, DIR_DN, DIR_LT }},

        { 2, 2, COLOR_GREEN, { DIR_LT, DIR_RT, DIR_RT, DIR_RT }},
        { 1, 1, COLOR_GREEN, { DIR_UP, DIR_DN, DIR_DN, DIR_DN }},

        { 4, 4, COLOR_CYAN, { DIR_LT, DIR_RT, DIR_DN, DIR_RT }},
        { 3, 3, COLOR_CYAN, { DIR_UP, DIR_DN, DIR_LT, DIR_DN }},

        { 6, 6, COLOR_RED, { DIR_RT, DIR_LT, DIR_DN, DIR_LT }},
        { 5, 5, COLOR_RED, { DIR_UP, DIR_DN, DIR_RT, DIR_DN }},

        { 8, 10, COLOR_MAGENTA, { DIR_RT, DIR_LT, DIR_LT, DIR_UP }},
        { 9, 7, COLOR_MAGENTA, { DIR_UP, DIR_DN, DIR_DN, DIR_LT }},
        { 10, 8, COLOR_MAGENTA, { DIR_LT, DIR_RT, DIR_RT, DIR_DN }},
        { 7, 9, COLOR_MAGENTA, { DIR_DN, DIR_UP, DIR_UP, DIR_RT }},

        { 12, 14, COLOR_YELLOW, { DIR_RT, DIR_LT, DIR_LT, DIR_DN }},
        { 13, 11, COLOR_YELLOW, { DIR_UP, DIR_DN, DIR_DN, DIR_RT }},
        { 14, 12, COLOR_YELLOW, { DIR_LT, DIR_RT, DIR_RT, DIR_UP }},
        { 11, 13, COLOR_YELLOW, { DIR_DN, DIR_UP, DIR_UP, DIR_LT }},

        { 16, 18, COLOR_WHITE, { DIR_UP, DIR_DN, DIR_LT, DIR_RT2 }},
        { 17, 15, COLOR_WHITE, { DIR_LT, DIR_RT, DIR_UP, DIR_DN2 }},
        { 18, 16, COLOR_WHITE, { DIR_DN, DIR_UP, DIR_RT, DIR_LT2 }},
        { 15, 17, COLOR_WHITE, { DIR_RT, DIR_LT, DIR_DN, DIR_UP2 }}}


Generated on Thu Mar 2 16:11:28 2006 for VDK Blacksheep by  doxygen 1.4.1