Hexmap SDL Bindings Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
void (*HexDrawFuncSDL) (SDL_Surface *surface, SDL_Rect *dst_rect, HexData *data, SDL_Rect *src_rect); HexData* hex_data_new_from_sdl_surface (SDL_Surface *surface); HexOverlay* hex_overlay_new_from_sdl_surface (SDL_Surface *surface, gint x_offset, gint y_offset, guint hex_width); typedef HexSDLRegion; void hex_sdl_region_free (HexSDLRegion *region); HexSDLRegion* hex_get_region_from_width_sdl (guint width); G_CONST_RETURN HexSDLRegion* hex_get_region_from_width_cached_sdl (guint width); gboolean hex_sdl_region_intersect_rect (const HexSDLRegion *region, const SDL_Rect *rect); void hex_draw_data_sdl (SDL_Surface *surface, HexData *hex, gint x, gint y); void hex_draw_border_sdl (SDL_Surface *surface, Uint32 pixel_value, guint width, gint x, gint y, HexDirection dir); void hex_draw_list_sdl (SDL_Surface *surface, HexList *list, gint x, gint y); SDL_Surface* hex_grid_get_sdl_surface (HexGrid *grid, SDL_Surface *reference, gint x, gint y); struct HexEvent; |
void (*HexDrawFuncSDL) (SDL_Surface *surface, SDL_Rect *dst_rect, HexData *data, SDL_Rect *src_rect); |
The prototype for the draw function passed to hex_data_new().
The destination SDL_Surface
An SDL_Rect indicating the portion of surface to draw to. Only the x and y coordinates of this rect are used.
The source HexData
An SDL_Rect indication the portion of data to draw.
HexData* hex_data_new_from_sdl_surface (SDL_Surface *surface); |
Creates a new HexData from a SDL_Surface.
A SDL_Surface containing the data. This must have the aspect ratio given by HEX_HEIGHT().
a newly created HexData
HexOverlay* hex_overlay_new_from_sdl_surface (SDL_Surface *surface, 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.
A SDL_Surface which will span one or more hexes.
The offset in pixels from the top of the upper left hex to the top of the pixbuf
The offset in pixels from the left side of the upper left hex to the left side of the pixbuf
The width of the hexes that will be generated
a newly created HexOverlay
void hex_sdl_region_free (HexSDLRegion *region); |
free the region.
A HexSDLRegion.
HexSDLRegion* hex_get_region_from_width_sdl (guint width); |
get a hexagonal region
The width of the hex. Its height is given by HEX_HEIGHT().
a HexSDLRegion describing the area inside the hex
G_CONST_RETURN HexSDLRegion* hex_get_region_from_width_cached_sdl (guint width); |
Get a cached hexagonal region. If width is 0, the cache is flushed and NULL is returned.
The width of the hex. Its height is given by HEX_HEIGHT().
A HexSDLRegion describing the area inside the hex. This region is cached, and should not be altered by the calling routine. There is no need to destroy this region when you are through using it.
gboolean hex_sdl_region_intersect_rect (const HexSDLRegion *region, const SDL_Rect *rect); |
check if a rectangle and a region intersect
A HexSDLRegion.
An SDL_Rect.
TRUE if they intersect
void hex_draw_data_sdl (SDL_Surface *surface, HexData *hex, gint x, gint y); |
Draws the HexData to a GdkDrawable
the destination SDL_Surface
the HexData to draw
The x coordinate of the left corner of the HexData
The y coordinate of the top edge of the HexData
void hex_draw_border_sdl (SDL_Surface *surface, Uint32 pixel_value, guint width, gint x, gint y, HexDirection dir); |
Draws the border of a hex to a GdkDrawable using the foreground color.
the destination SDL_Surface
the pixel value for the color of the border
The width of the hex for which to draw a border. The height of the hex is given by HEX_HEIGHT().
The location of the top of the hex in surface.
The location of the left side of the hex in surface.
Which sides of the border to draw. To draw all sides, use HEX_DIRECTION_MASK.
void hex_draw_list_sdl (SDL_Surface *surface, HexList *list, gint x, gint y); |
Draws a HexList, with the lowest depth on the bottom and the highest on top (painter's algorithm).
a SDL_Surface to draw to
a HexList. An empty list can be specified by passing NULL.
the pixel location of the top of the hex
the pixel location of the left corner of the hex
SDL_Surface* hex_grid_get_sdl_surface (HexGrid *grid, SDL_Surface *reference, gint x, gint y); |
Gets a surface to which the tiles at location (x, y) are drawn. These surfaces are cached internally.
a HexGrid
a reference SDL_Surface used to set color depth, etc.
the x position of a hex
the y position of a hex
a SDL_Surface to which the tiles at location (x, y) are drawn
struct HexEvent { gint x, y; /* Pixel coordinates relative to grid */ SDL_Event *event; HexDisplaySDL *source; }; |
A structure containing an SDL_Event and the coordinates of the hex it happened in.
The x coordinate of the hex where the event happened.
The y coordinate of the hex where the event happened.
An SDL_Event
The HexDisplaySDL that received the event.