Hexmap SDL Bindings Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
struct HexDisplaySDL; struct HexDisplaySDLClass; HexDisplaySDL* hex_display_sdl_new (HexGrid *grid, SDL_Surface *surface, const SDL_Rect *rect); void hex_display_sdl_set_grid (HexDisplaySDL *disp, HexGrid *grid); HexGrid* hex_display_sdl_get_grid (HexDisplaySDL *disp); void hex_display_sdl_center_hex (HexDisplaySDL *disp, guint x, guint y); #define HEX_DISPLAY_SDL_EVENT_MASK gboolean hex_display_sdl_handle_event (SDL_Event *event); |
"hex-event" gboolean user_function (HexDisplaySDL *hexdisplaysdl, gpointer arg1, gint arg2, gint arg3, gpointer user_data); |
A HexDisplaySDL holds a pointer to an SDL_Surface which displays a HexGrid. Since most of what it does is react to changes in HexGrid, once you've set the grid there's not much hexmap-specific functionallity.
HexDisplaySDL* hex_display_sdl_new (HexGrid *grid, SDL_Surface *surface, const SDL_Rect *rect); |
create a HexDisplaySDL
the HexGrid to display. Can be NULL
the SDL_Surface to display grid on
the area in surface to use. rect will be clipped to fit surface. If rect is NULL, all of surface will be used.
the newly created HexDisplaySDL
void hex_display_sdl_set_grid (HexDisplaySDL *disp, HexGrid *grid); |
set which HexGrid to display
the HexGrid to display. Can be NULL
HexGrid* hex_display_sdl_get_grid (HexDisplaySDL *disp); |
get the currently displayed HexGrid
the currently displayed HexGrid. Returns NULL if there is no grid
void hex_display_sdl_center_hex (HexDisplaySDL *disp, guint x, guint y); |
center the display on the hex (x, y)
the x coordinate of a hex
the y coordinate of a hex
#define HEX_DISPLAY_SDL_EVENT_MASK |
A mask which indicates which SDL events should be processed by hex_display_sdl_handle_event().
gboolean hex_display_sdl_handle_event (SDL_Event *event); |
Check if a mouse event happened inside any of the existing HexDisplaySDL instances, pass it to the HexObject handlers in the attached HexGrid if applicable.
Most ordinary users will not need to call this function, since it is called automatically by the polling structure set up by hex_sdl_init()/hex_sdl_run()/hex_sdl_quit().
An SDL_Event.
TRUE if the event was handled
gboolean user_function (HexDisplaySDL *hexdisplaysdl, gpointer arg1, gint arg2, gint arg3, gpointer user_data); |
An event has occured in the hex at (x, y). This function is called after HexObject::event is called for any HexObject in the hex.
the object which received the signal.
an SDL_Event
the x coordinate of the hex
the y coordinate of the hex
user data set when the signal handler was connected.
TRUE to stop propagation of the event