mousetrap_create | creates a new mousetrap with an internally generated id |
mousetrap_create_with_id | creates a mousetrap with the given id |
mousetrap_destroy | reclaim the resources used by a mousetrap |
mousetrap_get_my_id | returns the integer id used by this mousetrap |
mousetrap_lookup_id | returns the integer id for the item at (x, y) |
mousetrap_read_ids | returns a list with each unique id read from the specified rectangle in the mousetrap |
mousetrap_blit | copies one mousetrap into another |
mousetrap_copy_rect | copy a rectangle from a mousetrap |
mousetrap_copy_rect_with_id | copy a rectangle from a mousetrap with the given id |
mousetrap_dump_compressed | prints a textual representation of the compressed mousetrap |
mousetrap_dump_uncompressed | prints a mousetrap's data in an uncompressed format. |
mousetrap_get_next_id | returns the next unused integer identifier, could overflow |
mousetrap_id_list_destroy | frees memory used by an integer list. |
Name |
Top |
Synopsis
#include <mousetrap/mousetrap.h> mousetrap_t * mousetrap_create(mt_source_t source_type, unsigned int source_flags, void *source);
Supported Flags:
The flags depend on the type of source that is used. Consult the supported sources section for documentation.
Name |
Top |
#include <mousetrap/mousetrap.h> mousetrap_t * mousetrap_create_with_id(mt_source_t source_type, unsigned int source_flags, void *source, unsigned int id);Returns a new mousetrap based on the information in source with the specified id. Returns NULL on failure.
Supported Flags:
The flags depend on the type of source that is used. Consult the supported sources section for documentation.
Name |
Top |
#include <mousetrap/mousetrap.h> void mousetrap_destroy(mousetrap_t *trap);
Name |
Top |
#include <mousetrap/mousetrap.h> unsigned int mousetrap_get_my_id(mousetrap_t *trap);
Name |
Top |
#include <mousetrap/mousetrap.h> unsigned int mousetrap_lookup_id(mousetrap_t *trap, int x, int y);
Name |
Top |
#include <mousetrap/mousetrap.h> mt_id_list_t * mousetrap_read_ids(mousetrap_t *trap, int x, int y, int width, int height);
The return list's memory can be cleaned up by mousetrap_id_list_destroy.
I'd like a more graceful way to handle this. Solutions would be appreciated.
Name
|
Top |
#include <mousetrap/mousetrap.h> int mousetrap_blit(mousetrap_t *dest, mousetrap_t *src, int x, int y, unsigned in t flags);Copies the mousetrap in src into dest with the upper left corner of src at (x, y) in dest. This permanently alters dest. src is clipped to the boundary of dest. Returns 0 for failure or 1 for success.
Supported Flags:
If MT_NO_TRANSPARENCY is set, the blit copies transparent areas directly into dest (thus making that part of dest transparent). If MT_NO_TRANSPARENCY is not set, transparency support is enabled and gets applied.
Name |
Top |
#include <mousetrap/mousetrap.h> mousetrap_t * mousetrap_copy_rect(mousetrap_t *trap, int x, int y, int width, int height);
Name |
Top |
#include <mousetrap/mousetrap.h> mousetrap_t * mousetrap_copy_rect(mousetrap_t *trap, int x, int y, int width, int height, unsigned int id);
Name |
Top |
#include <mousetrap/mousetrap.h> void mousetrap_dump_compressed(mousetrap_t *trap);
Name |
Top |
#include <mousetrap/mousetrap.h> void mousetrap_dump_uncompressed(mousetrap_t *trap);
Name |
Top |
#include <mousetrap/mousetrap.h> unsigned int mousetrap_get_next_id();
It will overflow when ID is greater than an unsigned int can hold. This is one of the things I'd like a better solution for.
Name |
Top |
#include <mousetrap/mousetrap.h> void mousetrap_id_list_destroy(mt_id_list_t *list);