#include <ggi/galloc.h>
struct ggiGA_ResourceProperties *ggiGAGetProperties
(ggiGA_resource_handle handle);
struct ggi_mode *ggiGAGetggiMode
(ggiGA_resource_handle handle);
struct ggi_directbuffer *ggiGAGetggiDB
(ggiGA_resource_handle handle);
int ggiGAClearProperties
(struct ggiGA_ResourceProperties *props);
These functions allow data contained in the resource with handle res to be accessed. What is given back is a pointer to a structure inside the resource, so modifying the contents will modify the resource/resource list, but care must be taken not to try to dereference this pointer after the list has been emptied.
ggiGAGetProperties gives back the current properties of the resource with the given handle.
ggiGAGetggiMode gives back the current mode of the resource of type GA_RT_FRAME with the given handle.
ggiGAGetggiDB gives back the current directbuffer structure of the resource of type GA_RT_FRAME with the given handle.
ggiGAClearProperties resets a properties structure's fields to default values.
ggiGAClearProperties returns 0 on success, or something else if you feed it NULL. The rest of the functions return a pointer to the requested data, or NULL if there is no such data with that handle.
Example 1. ggiGAGetProperties/ggiGAGetggiMode/ggiGAGetggiDB Example
ggi_visual_t vis; ggiGA_resource_list request, result; ggiGA_ResourceProperties props, *propsp; ggi_mode mode, *modep; ggi_directbuffer db, *dbp; ggiGA_resource_handle hnd, modehnd; ggiInit(); vis = ggiOpen(NULL); ggiGAAttach(vis); ggiCheckMode(vis, 640, 480, 640, 480, &mode); props.size.area.x = 300; props.size.area.y = 200; props.sub.tank.graphtype = GT_8BIT; db.type = GGI_DB_NORMAL; ggiGAAdd(&request, &props, GA_RT_SPRITE_SPRITE, &hnd); ggiGAAddMode(vis, &request, &mode, &db, &modehnd); propsp = ggiGetProperties(hnd); modep = ggiGetggiMode(request, modehnd); dbp = ggiGetggiDB(modehnd); if (!ggiGACheck(vis, request, NULL)) goto done; propsp->graphtype = GT_AUTO; if (!ggiGACheck(vis, request, NULL)) goto done; if (dbp->type != GGI_DB_NORMAL) goto fail; modep->visible.x = GGI_AUTO; modep->visible.y = GGI_AUTO; if (!ggiGACheck(vis, request, &request)) goto done; print("Check failed\n"); autopsy(request); goto fail; done: if (ggiGASet(vis, request, &result)) { print("Unexpected failure to Set\n"); autopsy(result); } /* [...] */ fail: ggiEmptyList(reqlist); ggiGADetach(vis); ggiGAExit(); ggiExit();