Hexmap Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#include <hexmap.h> struct HexOverlay; HexData* (*HexOverlayFunc) (gint x_offset, gint y_offset, guint hex_width, gpointer data); HexOverlay* hex_overlay_new (gint x_offset, gint y_offset, guint width, guint height, guint hex_width, HexOverlayFunc func, gpointer data); HexOverlay* hex_overlay_new_from_xpm_d (const gchar **xpm_d, gint x_offset, gint y_offset, guint hex_width); HexOverlay* hex_overlay_new_from_file (const gchar *filename, gint x_offset, gint y_offset, guint hex_width, GError **err); void hex_overlay_ref (HexOverlay *overlay); void hex_overlay_unref (HexOverlay *overlay); HexData* hex_overlay_get_hex (HexOverlay *overlay, gint x, gint y); |
struct HexOverlay { guint ref_count; gint x_offset; gint y_offset; guint width; guint height; guint hex_width; HexData ***data; }; |
A structure used for overlaying an image across many hexes
HexData* (*HexOverlayFunc) (gint x_offset, gint y_offset, guint hex_width, gpointer data); |
A function passed to hex_overlay_new() to create the individual hexes from the bulk image data.
The x offset of the hex within the image.
The y offset of the hex within the image.
The width of the hex.
The bulk image data.
A newly created HexData, or NULL if the image is completely transparent in this hex.
HexOverlay* hex_overlay_new (gint x_offset, gint y_offset, guint width, guint height, guint hex_width, HexOverlayFunc func, gpointer data); |
Creates a new HexOverlay
The offset from the upper left corner of the first hex to the left side of the image.
The offset from the upper left corner of the first hex to the top of the image.
The width of the image.
The height of the image.
The width of the HexData to be contained in the HexOverlay
A function which creates a HexData at a given position from the image data. This function may return NULL if the image is completely transparent at this hex.
The image data.
a newly created HexOverlay object
HexOverlay* hex_overlay_new_from_xpm_d (const gchar **xpm_d, gint x_offset, gint y_offset, guint hex_width); |
A HexOverlay is a means of placing an image on a HexGrid by breaking it into several HexData objects.
Some xpm data which will span one or more hexes.
The offset in pixels from the top of the upper left hex to the top of the xpm data.
The offset in pixels from the left side of the upper left hex to the left side of the xpm data.
The width of the hexes that will be generated.
a newly created HexOverlay
HexOverlay* hex_overlay_new_from_file (const gchar *filename, gint x_offset, gint y_offset, guint hex_width, GError **err); |
A HexOverlay is a means of placing an image on a HexGrid by breaking it into several HexData objects.
A file containing an image which will span one or more hexes.
The offset in pixels from the top of the upper left hex to the top of the xpm data.
The offset in pixels from the left side of the upper left hex to the left side of the xpm data.
The width of the hexes that will be generated.
A location to return errors generated while loading the file.
a newly created HexOverlay
void hex_overlay_ref (HexOverlay *overlay); |
Increments the reference count on a HexOverlay.
void hex_overlay_unref (HexOverlay *overlay); |
Decrements the reference count on a HexOverlay, and frees it if the count falls to zero.
HexData* hex_overlay_get_hex (HexOverlay *overlay, gint x, gint y); |
get a particular HexData from a HexOverlay
the x coordinate of the hex
the y coordinate of the hex
The HexData at the coordinate (x, y) in the HexOverlay. If no such HexData exists, returns NULL.