This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

tetris.c File Reference

#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <math.h>
#include <gdk/gdkkeysyms.h>
#include "game.h"
#include "aaball.h"

Go to the source code of this file.

Data Structures

struct  Tetris_state

Defines

#define TETRIS_CELL_SIZE   20
#define TETRIS_NUM_PIECES   31
#define TETRIS_BOARD_WID   10
#define TETRIS_BOARD_HEIT   22
#define TETRIS_EMPTY   0
#define TETRIS_BRICK_4   1
#define TETRIS_BRICK_22   2
#define TETRIS_BRICK_121A   3
#define TETRIS_BRICK_121B   4
#define TETRIS_BRICK_T   5
#define TETRIS_BRICK_LA   6
#define TETRIS_BRICK_LB   7
#define TETRIS_BRICK_INACTIVE   8
#define TETRIS_BRICK_DYING   9
#define TETRIS_BRICK_MASK   15
#define TETRIS_BRICK_MOTION_MASK   16

Functions

void tetris_init ()
void tetris_set_init_pos (Pos *pos)
char** tetris_get_pixmap (int idx, int color)
int tetris_getmove_kb (Pos *cur_pos, int key, Player glob_to_play, byte **move, int **)
int tetris_animate (Pos *pos, byte **movp)
ResultType tetris_who_won (Pos *pos, Player to_play, char **commp)
void* tetris_newstate (Pos *, byte *)
void tetris_free ()
int tetris_game_over (byte *board)
int tetris_fall (byte *pos, byte **movp, int height)

Variables

char tetris_colors [6] = {50, 50, 50, 50, 50, 50}
int* tetris_init_pos = NULL
Game Tetris
SCORE_FIELD tetris_score_fields [] = {SCORE_FIELD_USER, SCORE_FIELD_SCORE, SCORE_FIELD_DATE, SCORE_FIELD_NONE}
char* tetris_score_field_names [] = {"User", "Score", "Date", NULL}
int num_bricks = 0
int level = 1
int anim_time_left = 0
int anim_time_def = 0


Define Documentation

#define TETRIS_BOARD_HEIT   22
 

Definition at line 33 of file tetris.c.

#define TETRIS_BOARD_WID   10
 

Definition at line 32 of file tetris.c.

#define TETRIS_BRICK_121A   3
 

Definition at line 51 of file tetris.c.

#define TETRIS_BRICK_121B   4
 

Definition at line 52 of file tetris.c.

#define TETRIS_BRICK_22   2
 

Definition at line 50 of file tetris.c.

#define TETRIS_BRICK_4   1
 

Definition at line 49 of file tetris.c.

#define TETRIS_BRICK_DYING   9
 

Definition at line 57 of file tetris.c.

#define TETRIS_BRICK_INACTIVE   8
 

Definition at line 56 of file tetris.c.

#define TETRIS_BRICK_LA   6
 

Definition at line 54 of file tetris.c.

#define TETRIS_BRICK_LB   7
 

Definition at line 55 of file tetris.c.

#define TETRIS_BRICK_MASK   15
 

Definition at line 58 of file tetris.c.

#define TETRIS_BRICK_MOTION_MASK   16
 

Definition at line 59 of file tetris.c.

#define TETRIS_BRICK_T   5
 

Definition at line 53 of file tetris.c.

#define TETRIS_CELL_SIZE   20
 

Definition at line 29 of file tetris.c.

#define TETRIS_EMPTY   0
 

Definition at line 48 of file tetris.c.

#define TETRIS_NUM_PIECES   31
 

Definition at line 30 of file tetris.c.


Function Documentation

int tetris_animate ( Pos * pos,
byte ** movp ) [static]
 

Definition at line 199 of file tetris.c.

int tetris_fall ( byte * pos,
byte ** movp,
int height )
 

Definition at line 150 of file tetris.c.

Referenced by tetris_animate(), and tetris_getmove_kb().

void tetris_free ( ) [static]
 

Definition at line 106 of file tetris.c.

int tetris_game_over ( byte * board )
 

Definition at line 128 of file tetris.c.

Referenced by tetris_who_won().

char** tetris_get_pixmap ( int idx,
int color ) [static]
 

Definition at line 435 of file tetris.c.

int tetris_getmove_kb ( Pos * pos,
int key,
Player glob_to_play,
byte ** movp,
int ** rmovp ) [static]
 

Definition at line 311 of file tetris.c.

void tetris_init ( )
 

Definition at line 81 of file tetris.c.

void* tetris_newstate ( Pos * pos,
byte * move ) [static]
 

Definition at line 113 of file tetris.c.

void tetris_set_init_pos ( Pos * pos ) [static]
 

ResultType tetris_who_won ( Pos * pos,
Player to_play,
char ** commp ) [static]
 

Definition at line 138 of file tetris.c.


Variable Documentation

Game Tetris
 

Initial value:

 { TETRIS_CELL_SIZE, TETRIS_BOARD_WID, TETRIS_BOARD_HEIT, 
        TETRIS_NUM_PIECES,
        tetris_colors,  NULL, NULL, "Tetris", tetris_init}

Definition at line 41 of file tetris.c.

int anim_time_def = 0 [static]
 

Definition at line 79 of file tetris.c.

int anim_time_left = 0 [static]
 

Definition at line 78 of file tetris.c.

int level = 1 [static]
 

Definition at line 77 of file tetris.c.

int num_bricks = 0 [static]
 

Definition at line 76 of file tetris.c.

char tetris_colors[6] = {50, 50, 50, 50, 50, 50}
 

Definition at line 35 of file tetris.c.

int* tetris_init_pos = NULL
 

Definition at line 37 of file tetris.c.

char* tetris_score_field_names[] = {"User", "Score", "Date", NULL}
 

Definition at line 46 of file tetris.c.

SCORE_FIELD tetris_score_fields[] = {SCORE_FIELD_USER, SCORE_FIELD_SCORE, SCORE_FIELD_DATE, SCORE_FIELD_NONE}
 

Definition at line 45 of file tetris.c.