Get a pointer to properties in a LibGAlloc request list

Name

ggiGAGetProperties, ggiGAGetGGIMode, ggiGAGetGGIDB : Get a pointer to properties in a LibGAlloc request list

Synopsis

#include <ggi/galloc.h>

struct ggiGA_resource_props *ggiGAGetProperties(ggiGA_resource_handle handle);
ggi_mode *ggiGAGetGGIMode(ggiGA_resource_handle handle);

ggi_directbuffer *ggiGAGetGGIDB(ggiGA_resource_handle handle);

Description

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.

Return value

All three functions return a pointer to the requested data, or 'NULL' if there is no such data with that handle.

Example

      ggi_visual_t vis;
      ggiGA_resource_list request, result;
      ggiGA_resource_props 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 = ggiGAGetGGIMode(request, modehnd);
      dbp = ggiGAGetGGIDB(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;
      printf("Check failed\n");
      autopsy(request);
      goto fail;

done:
      if (ggiGASet(vis, request, &result)) {
              printf("Unexpected failure to Set\n");
              autopsy(result);
      }
      /* [...] */
fail:
      ggiDestroyList(reqlist);
      ggiGADetach(vis);
      ggiGAExit();
      ggiExit();