MCPcopy Create free account
hub / github.com/SimHacker/micropolis / GetObjectXpms

Function GetObjectXpms

micropolis-activity/src/sim/g_setup.c:211–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209
210
211Pixmap *
212GetObjectXpms(XDisplay *xd, int id, int frames)
213{
214 int i;
215 Pixmap *pixmaps = (Pixmap *)ckalloc(2 * frames * sizeof (Pixmap));
216 XpmAttributes attributes;
217 char name[256];
218
219 attributes.visual = Tk_DefaultVisual(xd->screen);
220 attributes.colormap = Tk_DefaultColormap(xd->screen);
221 attributes.depth = Tk_DefaultDepth(xd->screen);
222 attributes.valuemask = XpmVisual | XpmColormap | XpmDepth;
223
224 for (i = 0; i < frames; i++) {
225 sprintf(name, "%s/images/obj%d-%d.xpm", HomeDir, id, i);
226 if (XpmReadFileToPixmap(xd->dpy,
227 RootWindowOfScreen(xd->screen),
228 name,
229 &pixmaps[i + i], &pixmaps[i + i + 1],
230 &attributes) < 0) {
231 fprintf(stderr,
232 "Uh oh, Micropolis couldn't read the pixmap file \"%s\".\n",
233 name);
234 sim_exit(1); // Just sets tkMustExit and ExitReturn
235 return NULL;
236 }
237 }
238 return (pixmaps);
239}
240
241
242GetPixmaps(XDisplay *xd)

Callers 1

g_setup.cFile · 0.85

Calls 3

Tk_DefaultVisualFunction · 0.85
Tk_DefaultColormapFunction · 0.85
Tk_DefaultDepthFunction · 0.85

Tested by

no test coverage detected