Code Reference - main.c¶
Defines
-
IMG_DIR
¶
-
LEXICA_EXT
¶
-
LEXICA_DIR
¶
-
ALPHA_EXT
¶
-
ALPHA_DIR
¶
-
HANDY_USE_UNSTABLE_API
¶
-
GDK_DISABLE_DEPRECATED
¶
-
GTK_DISABLE_DEPRECATED
¶
-
OPT
(T)¶
-
ROOT
¶
-
ROUND
(x)¶
Typedefs
Functions
-
void
free_board
(square_t ***board, int n)¶ Free the board array.
-
static void shutdown(GtkApplication *app ATTR_UNUSED, gpointer root)
Callback function ran when program ends - free everything.
-
static void quit_app(GSimpleAction *action ATTR_UNUSED, GVariant *parameter ATTR_UNUSED, gpointer app)
Ran when the ‘quit’ action is triggered, ends the main loop.
-
static void
clear_board
(square_t **board, int n)¶ Clear/initialise the board - run before a new game starts.
-
static gboolean
get_file
(const char *filename, char **buf, gsize *buflen)¶ Reads a file stored in DATADIR into a string.
-
static void
draw_tile
(cairo_t *cr, const char *letter, const char *lang, int x, int y, const config_t *config)¶ Render the tile image for the given letter.
-
static void
draw_text_in_square
(GtkWidget *widget, cairo_t *cr, const char *text, const PangoFontDescription *font, int x, int y, const config_t *config)¶ Render the text given, in the centre of the board square at the coordinates given.
-
static gboolean
draw_board_elements
(GtkWidget *widget, cairo_t *cr, gpointer root)¶ Draw elements within the board: gridlines, coloured squares, and labels.
-
static gchar **
list_langs
(void)¶ List available languages by searching the lexica directory.
-
static gchar **
list_modes_for_lang
(const gchar *lang)¶ List available game modes for the given language.
-
static gchar **
load_lexicon
(const gchar *lang, const gchar *lang_var, gint *w_num)¶ Load the given lexicon into an array of strings.
-
static letter_t *
load_alphabet
(const gchar *lang, const gchar *mode, gint *l_num)¶ Load the given alphabet into an array of letter_t.
-
static void show_prefs(GSimpleAction *action ATTR_UNUSED, GVariant *parameter ATTR_UNUSED, gpointer root)
A preference dialog, for the user to set the config.
-
static void show_about(GSimpleAction *action ATTR_UNUSED, GVariant *parameter ATTR_UNUSED, gpointer root)
A small ‘About’ dialog, with a description, license information and links.
-
static void
setup_window
(GtkApplication *app, gpointer root)¶ Set up thw window and draw the graphics.
-
static void setup_app(GtkApplication * app, gpointer root ATTR_UNUSED)
Set up the GtkApplication, create the app menu and the keyboard shortcuts.
-
int
main
(int argc, char **argv)¶ Main entry point: initialise libhandy, declare the GtkApplication, attach the callbacks and run the main loop.
-
struct
config_t
Record of all configuration data.
Public Members
-
gint
square_num
¶ Number of squares in a row/column.
-
gint
border_size
¶ Thickness of border within and around the board, in pixels.
-
gint
board_width
¶ Overall width of board, in pixels.
-
gint
tile_width
¶ Width of each tile, in pixels.
-
double
margin
¶ Margin around the board, as a proportion of window size.
-
GdkRGBA
font_colour
¶
-
GdkRGBA
border_colour
¶
-
GdkRGBA *
sq_colour
¶
-
gchar *
lang
¶ Current language used for word list.
-
gchar *
lang_var
¶ Current language variant, if applicable.
-
gchar *
mode
¶ Current mode, i.e. rule set.
-
gint
-
struct
letter_t
-
struct
lang_t
-
struct
root_t