This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

board.c File Reference

Functions to manipulate the drawing_area where the board is drawn. More...

#include <stdlib.h>
#include <assert.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
#include "board.h"
#include "ui_common.h"
#include "ui.h"
#include "menu.h"

Go to the source code of this file.

Functions

void ui_make_human_move (byte *move, int *rmove)
void board_set_game_params ()
void board_set_cell (int x, int y, byte val)
void board_apply_refresh (byte *move, int *rmove)
void board_refresh_cell_real (int x, int y, int real_x, int real_y)
 Draws the square (x, y). On the board it is shown at (real_x, real_y).

void board_refresh_cell (int x, int y)
 A wrapper around board_refresh_cell_real() to take care of whether the board is flipped.

gboolean board_redraw (GtkWidget *widget, GdkEventExpose *event)
 Redraws the exposed area of the board.

void board_redraw_all ()
 Redraw the whole board.

void board_show ()
 Called when the game is unpaused.

void board_hide ()
 Hide the board when the game is paused.

void board_get_cell (GdkEventButton *event, int *row, int *col, int *pixel_x, int *pixel_y)
gint board_signal_handler (GtkWidget *widget, GdkEventButton *event, gpointer data)
 handles mouse clicks as well as key presses.

void board_free ()
 Free all malloc()d stuff.

gchar* board_get_filerank_label_str (int label, int idx)
gchar* board_get_file_label_str (int label, int idx)
gchar* board_get_rank_label_str (int label, int idx)
void board_color_init (char *color, GdkColor *gdkcolor, GdkGC **gc, GdkColormap *cmap, GtkWidget *board_area)
void board_init ()
 initialization of the board.


Variables

GtkWidget* board_rowbox_real = NULL
 for showing names of rows and columns.

GtkWidget * board_colbox_real = NULL
 for showing names of rows and columns.

GdkColor board_colors [6]
 Colors for the light squares, dark squares, lines.

GdkColor board_highlight_colors [3]
 Colors for highlighting.

GdkColor board_buttonize_colors [2]
 Colors for turning pixmaps into buttons.

GdkGC* board_gcs [3] = {NULL, NULL, NULL}
 gcs for light squares, dark squares and lines.

GdkGC* board_highlight_gcs [3] = {NULL, NULL, NULL}
 gcs for highlighting.

GdkGC* board_buttonize_gcs [3] = {NULL, NULL, NULL}
 gcs for drawing buttons.

GdkPixmap** pieces = NULL
 Images representing the pieces.

GdkBitmap** piece_masks = NULL
 Bitmaps to specify transparency for the pieces.

GdkPixmap* board_bgimage = NULL
 Backround image.

gboolean board_suspended = FALSE
 This is TRUE when the game is paused.

gboolean state_board_flipped = FALSE
 Is the board flipped (rotated 180 deg).

char board_default_colors [9] = {215, 215, 215, 215, 215, 215, 0, 0, 0}
 default background.

int cell_size
int num_pieces


Detailed Description

Functions to manipulate the drawing_area where the board is drawn.

Definition in file board.c.


Function Documentation

void board_apply_refresh ( byte * move,
int * rmove )
 

Definition at line 90 of file board.c.

void board_color_init ( char * color,
GdkColor * gdkcolor,
GdkGC ** gc,
GdkColormap * cmap,
GtkWidget * board_area ) [static]
 

Definition at line 502 of file board.c.

Referenced by board_init().

void board_free ( )
 

Free all malloc()d stuff.

Definition at line 427 of file board.c.

Referenced by ui_terminate_game().

void board_get_cell ( GdkEventButton * event,
int * row,
int * col,
int * pixel_x,
int * pixel_y ) [static]
 

Definition at line 317 of file board.c.

Referenced by board_signal_handler().

gchar* board_get_file_label_str ( int label,
int idx ) [static]
 

Definition at line 490 of file board.c.

gchar* board_get_filerank_label_str ( int label,
int idx ) [static]
 

Definition at line 476 of file board.c.

Referenced by board_get_file_label_str(), and board_get_rank_label_str().

gchar* board_get_rank_label_str ( int label,
int idx ) [static]
 

Definition at line 496 of file board.c.

void board_hide ( )
 

Hide the board when the game is paused.

Definition at line 306 of file board.c.

Referenced by menu_show_pause_dialog().

void board_init ( )
 

initialization of the board.

Definition at line 516 of file board.c.

Referenced by gui_init(), and ui_start_game().

gboolean board_redraw ( GtkWidget * widget,
GdkEventExpose * event )
 

Redraws the exposed area of the board.

Definition at line 267 of file board.c.

void board_redraw_all ( )
 

Redraw the whole board.

Definition at line 292 of file board.c.

Referenced by board_hide(), board_show(), menu_load_file(), and ui_start_game().

void board_refresh_cell ( int x,
int y )
 

A wrapper around board_refresh_cell_real() to take care of whether the board is flipped.

Definition at line 257 of file board.c.

void board_refresh_cell_real ( int x,
int y,
int real_x,
int real_y )
 

Draws the square (x, y). On the board it is shown at (real_x, real_y).

Definition at line 132 of file board.c.

Referenced by board_redraw(), and board_refresh_cell().

void board_set_cell ( int x,
int y,
byte val )
 

Definition at line 85 of file board.c.

void board_set_game_params ( )
 

Definition at line 79 of file board.c.

Referenced by ui_start_game().

void board_show ( )
 

Called when the game is unpaused.

Definition at line 298 of file board.c.

Referenced by menu_start_stop_game().

gint board_signal_handler ( GtkWidget * widget,
GdkEventButton * event,
gpointer data )
 

handles mouse clicks as well as key presses.

Definition at line 334 of file board.c.

void ui_make_human_move ( byte * move,
int * rmove )
 

Definition at line 454 of file ui.c.


Variable Documentation

GdkPixmap* board_bgimage = NULL [static]
 

Backround image.

Definition at line 64 of file board.c.

GdkColor board_buttonize_colors
 

Colors for turning pixmaps into buttons.

Definition at line 45 of file board.c.

GdkGC * board_buttonize_gcs = {NULL, NULL, NULL}
 

gcs for drawing buttons.

Definition at line 54 of file board.c.

GtkWidget * board_colbox_real = NULL [static]
 

for showing names of rows and columns.

Definition at line 36 of file board.c.

GdkColor board_colors
 

Colors for the light squares, dark squares, lines.

Definition at line 39 of file board.c.

char board_default_colors = {215, 215, 215, 215, 215, 215, 0, 0, 0}
 

default background.

Definition at line 73 of file board.c.

GdkGC * board_gcs = {NULL, NULL, NULL}
 

gcs for light squares, dark squares and lines.

Definition at line 48 of file board.c.

GdkColor board_highlight_colors
 

Colors for highlighting.

Definition at line 42 of file board.c.

GdkGC * board_highlight_gcs = {NULL, NULL, NULL}
 

gcs for highlighting.

Definition at line 51 of file board.c.

GtkWidget* board_rowbox_real = NULL [static]
 

for showing names of rows and columns.

Definition at line 36 of file board.c.

gboolean board_suspended = FALSE
 

This is TRUE when the game is paused.

Definition at line 67 of file board.c.

int cell_size [static]
 

Definition at line 75 of file board.c.

int num_pieces [static]
 

Definition at line 75 of file board.c.

GdkBitmap** piece_masks = NULL [static]
 

Bitmaps to specify transparency for the pieces.

Definition at line 61 of file board.c.

GdkPixmap** pieces = NULL [static]
 

Images representing the pieces.

Definition at line 57 of file board.c.

gboolean state_board_flipped = FALSE
 

Is the board flipped (rotated 180 deg).

Definition at line 70 of file board.c.