Freeciv-3.3
Loading...
Searching...
No Matches
Functions | Variables
themespec.h File Reference
#include "log.h"
#include "options.h"
#include "themebackgrounds.h"
#include "themecolors.h"

Go to the source code of this file.

Functions

const char ** get_theme_list (void)
 
struct themetheme_read_toplevel (const char *theme_name)
 
void theme_free (struct theme *ftheme)
 
void theme_load_sprites (struct theme *t)
 
void theme_free_sprites (struct theme *t)
 
void themespec_try_read (const char *theme_name)
 
void themespec_reread (const char *theme_name)
 
struct spritetheme_lookup_sprite_tag_alt (struct theme *t, enum log_level level, const char *tag, const char *alt, const char *what, const char *name)
 
struct theme_color_systemtheme_get_color_system (const struct theme *t)
 
struct theme_background_systemtheme_get_background_system (const struct theme *t)
 
charthemespec_gfx_filename (const char *gfx_filename)
 
const chartheme_get_name (const struct theme *t)
 
const chartheme_font_filename (const struct theme *t)
 
int theme_default_font_size (const struct theme *t)
 

Variables

struct themeactive_theme
 

Function Documentation

◆ get_theme_list()

const char ** get_theme_list ( void  )

Returns a static list of themes available on the system by searching all data directories for files matching THEMESPEC_SUFFIX. The list is NULL-terminated.

Definition at line 200 of file themespec.c.

◆ theme_default_font_size()

int theme_default_font_size ( const struct theme t)

Return theme's default font size.

Definition at line 177 of file themespec.c.

Referenced by default_font_size().

◆ theme_font_filename()

const char * theme_font_filename ( const struct theme t)

Return the path within the data directories where the font file can be found. (It is left up to the GUI code to load and unload this file.)

Definition at line 169 of file themespec.c.

Referenced by load_font().

◆ theme_free()

void theme_free ( struct theme ftheme)

Free resources allocated for the theme.

Definition at line 317 of file themespec.c.

Referenced by get_theme_list(), gui_load_theme(), theme_read_toplevel(), themespec_try_read(), and ui_main().

◆ theme_free_sprites()

void theme_free_sprites ( struct theme t)

Free all sprites for the theme.

Definition at line 1065 of file themespec.c.

Referenced by theme_free(), and themespec_reread().

◆ theme_get_background_system()

struct theme_background_system * theme_get_background_system ( const struct theme t)

Return the theme's background system.

Definition at line 1114 of file themespec.c.

Referenced by theme_get_background().

◆ theme_get_color_system()

struct theme_color_system * theme_get_color_system ( const struct theme t)

Return the theme's color system.

Definition at line 1122 of file themespec.c.

Referenced by theme_get_color().

◆ theme_get_name()

const char * theme_get_name ( const struct theme t)

Return the name of the given theme.

Definition at line 160 of file themespec.c.

◆ theme_load_sprites()

void theme_load_sprites ( struct theme t)

Load the tiles; requires themespec_read_toplevel() called previously. Leads to tile_sprites being allocated and filled with pointers to sprites. Also sets up and populates sprite_hash, and calls func to initialize 'sprites' structure.

Definition at line 990 of file themespec.c.

Referenced by gui_load_theme(), and themespec_reread().

◆ theme_lookup_sprite_tag_alt()

struct sprite * theme_lookup_sprite_tag_alt ( struct theme t,
enum log_level  level,
const char tag,
const char alt,
const char what,
const char name 
)

Lookup sprite to match tag, or else to match alt if don't find, or else return NULL, and emit log message.

Definition at line 1000 of file themespec.c.

Referenced by tilespec_setup_city_gfx().

◆ theme_read_toplevel()

struct theme * theme_read_toplevel ( const char theme_name)

Finds and reads the toplevel themespec file based on given name. Sets global variables, including tile sizes and full names for intro files.

Definition at line 721 of file themespec.c.

Referenced by get_theme_list(), themespec_reread(), and themespec_try_read().

◆ themespec_gfx_filename()

char * themespec_gfx_filename ( const char gfx_filename)

Returns the correct name of the gfx file (with path and extension) Must be free'd when no longer used

Definition at line 690 of file themespec.c.

Referenced by theme_background_system_read().

◆ themespec_reread()

void themespec_reread ( const char new_theme_name)

Read a new themespec in from scratch.

Unlike the initial reading code, which reads pieces one at a time, this gets rid of the old data and reads in the new all at once. If the new theme fails to load the old theme may be reloaded; otherwise the client will exit. If a NULL name is given the current theme will be reread.

It will also call the necessary functions to redraw the graphics.

Definition at line 376 of file themespec.c.

◆ themespec_try_read()

void themespec_try_read ( const char theme_name)

Read a new themespec in when first starting the game.

Call this function with the (guessed) name of the theme, when starting the client.

Definition at line 334 of file themespec.c.

Referenced by gui_load_theme().

Variable Documentation

◆ active_theme

struct theme* active_theme
extern