Chess User Interface With GTK 2.0

Modified 6-29-2004 by Brian Sanderson

Project Files

The following list contains a short description of these files, as well as links to them for convenient online viewing. You will need to download the tar file in order to get all of the necessary files.

FileDescription
chessgui.h
chessgui.cpp
The chessgui files provide the Graphical User Interface; you probably will not have to edit these files.
chess.h
chess.cpp
This is the GUI frontend that you will modify. It contains functions to access the GUI such as placing pieces, highlighting squares, dealing with user mouse clicks, etc.
chessinclude.h The chessinclude file gives you constants that will be useful to allow you to access the image files and colors used by the ChessGui.
messagebox.h
messagebox.cpp
inputbox.h
inputbox.cpp
buttonbox.h
buttonbox.cpp
Messagebox, inputbox, and buttonbox classes provide support for various simple dialog boxes. These functions are invoked using the Chess::messagebox, Chess::inputbox, and Chess::buttonbox functions.
makefile This example makefile has been included which will compile all the files provided. Please look through the makefile.
chess.tgz A compressed tar file containing all the above files. You will need to download this file into your chess project directory and extract it.

You will note that all the commands to the compiler which compile files that access the GUI have the following code after them:

`pkg-config gtkmm-2.0 --cflags` -Iimages

You will also note that the line in the makefile which creates the executable has the following options:

`pkg-config gtkmm-2.0 --libs`

This is essential to load the graphics libraries required. An example command to compile the Chess class would be:

g++ -c chess.cpp `pkg-config gtkmm-2.0 --cflags` -Iimages


The Graphical User Interface

As you can see, the interface is divided into 5 main sections:


Event-driven functions

The Chess class provides several event functions that allow you to get input from the user interface. These functions are event-driven, meaning that they are called only when the event happens. These functions are found in the chess.cpp file and you should change these functions to suit your design:

GUI Convenience functions

In addition to the event functions the Chess class also has some useful functions that you can call that are convenience functions from the chessgui.cpp file.

Piece and square manipulation functions

Several new piece and square convenience functions have been provided in the Chess class to reduce the difficulty of dealing with the lower level GUI functions:

Dialog box functions

Some other functions have been provided for you in the chess.h and chess.cpp files. They give you easy access to three kinds of dialog box:

These are the primary functions that you will need for interacting with the User Interface. There are other functions provided by the User Interface (for example, for supporting drag-and-drop movement of game pieces), however, you are not required to use them (although you are welcome to do so if you so desire).