This file documents Landlord's GTK+ support library.
struct ll_display;
Internal state for GTK+ support. This should currently be regarded as an opaque type even thought it is given in full in the header file.
void ll_gtkinit(struct ll_game *game,
const char *images);
Configure a game to use the GTK+ support library. This must be called before any other functions from this header, but after gtk_init.
void ll_gtkrepaint(struct ll_game *game);
Repaints everything that ever needs explicit repainting, even if it hasn't changed.
GtkWidget *ll_new_gtkforward(struct ll_game *game,
int width, int height);
Create a widget containing a forward view of the current character, of given pixel dimensions. An expose-event handler is automatically installed.
void ll_gtkrepaint_forward(struct ll_game *game);
Repaint the forward view. You will need to call this...
If there is no forward view widget, nothing is done.
GtkWidget *ll_new_gtkmap(struct ll_game *game,
int width, int height);
Create a widget containing a map view around the current character. An expose-event handler is automatically installed. This looks good in a demo but may not be appropriate in all real games.
void ll_gtkrepaint_map(struct ll_game *game);
Repaint the map. You will need to call this...
(You need to repaint the map after night in case the current character gets moved for some reason.)
If there is no map widget, nothing is done.
void ll_new_gtkrotate(struct ll_game *game,
GtkWidget **left,
GtkWidget **right);
void ll_gtkleft(GtkWidget *widget, gpointer data);
void ll_gtkright(GtkWidget *widget, gpointer data);
Create left/right rotation arrow widgets. When clicked these will adjust the direction of the current character and repaint the forward view. The other two functions are the callbacks used, for which data should be a pointer to the appropriate struct ll_game.
GtkWidget *ll_new_gtkmove(struct ll_game *game); void ll_gtkmove(GtkWidget *widget, gpointer data);
Create a forward movement arrow widget. When clicked this will move the current character forward if possible, and repaint as necessary. ll_gtkmove is the callback it uses, for which data should be a pointer to the appropriate struct ll_game.
GtkWidget *ll_new_gtkdirection(struct ll_game *game,
enum ll_direction d);
void (*const ll_gtkdirfuncs[])(GtkWidget *, gpointer);
Create a button with the name of direction d in it, which when pressed will turn the current character to face in that direction. The array provides easy access to the eight different callbacks this function uses.
GtkWidget *ll_new_gtknight(struct ll_game *game); void ll_gtknight(GtkWidget *widget, gpointer data);
Create a "night" button; and the callback it uses.
void ll_gtkreport(struct ll_game *game,
const char *msg);
Report a message in a dialog box.
Copyright © 2002 Richard Kettlewell
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA