Get or set the allocation state of a resource
Name
ggiGAGetType, ggiGASetType, ggiGAGetState, ggiGASetState : Get or set the allocation state of a resource
Synopsis
#include <ggi/galloc.h> enum ggiGA_resource_type ggiGAGetType(ggiGA_resource_handle handle); enum ggiGA_resource_type ggiGASetType(ggiGA_resource_handle handle, enum ggiGA_resource_type rt); enum ggiGA_resource_state ggiGAGetState(ggiGA_resource_handle handle); enum ggiGA_resource_state ggiGASetState(ggiGA_resource_handle handle, enum ggiGA_resource_state rs); #define ggiGAAddStateFlag(handle, flag) \ ggiGASetState(handle, ggiGAGetState(handle) | (flag)) #define ggiGARemoveStateFlag(handle, flag) \ ggiGASetState(handle, ggiGAGetState(handle) & ~(flag))
Description
ggiGAGetType and ggiGASetType allow setting/getting the resource's feature type.
ggiGAGetState and ggiGASetState allow setting/getting the resource's negotiation state. Don't set this field unless you really know what you are doing.
ggiGAAddStateFlag and ggiGARemoveStateFlag are convenient macros to add/remove flags.
Return value
ggiGAGetType and ggiGASetType return the feature type that was in the resource before the function was called.
Example
switch (ggiGAGetType(resource) & GA_RT_TYPE_MASK) { case GA_RT_WINDOW: /* We don't do windows. */ return; default: break; } switch (ggiGAGetType(resource)) { case GA_RT_SPRITE_SPRITE: /* [...] */ } ggiGAAddStateFlag(resource, GA_STATE_FLAG);