| 209 | |
| 210 | |
| 211 | Pixmap * |
| 212 | GetObjectXpms(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 | |
| 242 | GetPixmaps(XDisplay *xd) |
no test coverage detected