704pages on
this wiki
Add New Page
Talk0 Share

FGL = Freeciv Graphics Layer

Uses SDL, OpenGL, libpng and freetype2.

Fonts in OpenGL is a nightmare. Here are our options as I see them:

- port GLFT to C ([1])
- port GLTT to C ([2])
- use polyfonts ([3])

.ini format Edit

FGL reads all information about how to display and format a particular GUI control (called a 'feature') from an .ini theme file. Each feature has its own section, named [feature_<name of feature>_<screenx>_<screeny>], for example [feature_mapview_1024_768] will give you info on the mapview in the 1024x768 screen resolution.

API Edit

/* These are window depths, to suggest which should
 * be drawn over which others. */
#define DEPTH_MIN               0
#define DEPTH_MAX               100

enum fgl_attribute {
  FGL_FPS,              /* frames per second */
  FGL_FULLSCREEN,       /* fullscreen mode or not */
  FGL_SWAP_CONTROL,     /* vertical refresh synchronization */
  FGL_DEBUG_MODE,       /* output fgl debug data to terminal */
  FGL_EDIT_MODE         /* TODO */

enum fgl_pattern {

typedef unsigned long fgl_color;
typedef GLint fgl_sprite;

struct fgl_feature;
struct fgl_pixmap {
  int w, h;
  unsigned char *pixels;

/* Specify name of theme file */
bool fgl_init(const char *datapath, const char *themefile);

/* TODO. Change theme while playing */
/* void fgl_reinit(const char *theme); */

/* Free stuff and quit. Garbage collect our images. */
void fgl_quit(void);

/* Main loop */
void fgl_main(void);

/* TODO. Save current setup as a new theme */
/* void fgl_save(const char *theme); */

/* A screen may have any number of features. A feature
 * can be anything that is specified in the configuration
 * file. */
struct fgl_feature *fgl_add_feature(const char *name);
void fgl_remove_feature(const char *name);

/* Various configuration options and hints */
void fgl_set_attribute(enum fgl_attribute, int value);
int fgl_get_attribute(enum fgl_attribute);

/* Load an image into an image buffer. */
struct fgl_pixmap *fgl_new_pixmap(const char *filename);
void fgl_free_pixmap(struct fgl_pixmap *gfx);

/* Create a texture sprite out of an existing image pixmap.  The
 * sprite will be stored in video memory as one or more power of
 * two size textures, padded with fully transparent pixels as
 * necessary. */
fgl_sprite fgl_sprite(struct fgl_pixmap *gfx, int x, int y,
                      int width, int height);

/* Drawing primitives ... unsure about this part of the API still - Per */
void fgl_rectangle(int x1, int y1, int x2, int y2,
                   fgl_color color, int width, fgl_pattern pattern);
void fgl_line(int x1, int y1, int x2, int y2,
              fgl_color color, int width, enum fgl_pattern pattern);
void fgl_pixmap(fgl_point pos, struct fgl_pixmap *gfx);
void fgl_drawing_end_func(void); /* private */

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki