home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d536 / chemesthetics.lha / Chemesthetics / Source / Source.LZH / metalworx.c < prev    next >
C/C++ Source or Header  |  1991-03-13  |  2KB  |  56 lines

  1. #include <intuition/intuition.h>
  2. #include <libraries/arpbase.h>
  3. #include <exec/memory.h>
  4. #include <proto/exec.h>
  5. #include <proto/intuition.h>
  6.  
  7. #include "messages.h"
  8. #include "metalworx.h"
  9.  
  10. static struct Image Metalworx_Image =
  11. {
  12.   0, 0, metalworx_iff_width, metalworx_iff_height, metalworx_iff_num_planes,
  13.   (USHORT *)metalworx_iff_data, 0xF, 0, NULL
  14. };
  15.  
  16. static struct NewWindow Metalworx_window =
  17. {
  18.   -1, -1, metalworx_iff_width, metalworx_iff_height, 0, 0, MOUSEBUTTONS,
  19.   SIMPLE_REFRESH | BORDERLESS | GIMMEZEROZERO, NULL, NULL, NULL, NULL, NULL,
  20.   5, 5, -1, -1, CUSTOMSCREEN
  21. };
  22.  
  23. extern long conwin;
  24. extern int Nachricht(struct Window *);
  25. extern void WrConWin(long,char*);
  26.  
  27. int Metalworx(struct Screen *screen)
  28. {
  29.   USHORT *MetalBuffer=NULL;
  30.   struct Window *win;
  31.  
  32.   if(TypeOfMem(metalworx_iff_data) & MEMF_FAST)             /* Image-Daten im FastMem ? */
  33.   {                      /* dann ins ChipMem kopieren */
  34.     MetalBuffer=(USHORT *)AllocMem(sizeof(metalworx_iff_data),MEMF_CHIP|
  35.       MEMF_PUBLIC);
  36.     if(MetalBuffer==NULL)
  37.     {
  38.       WrConWin(conwin,NO_METAL_MEM);
  39.       return 1;
  40.     }
  41.     movmem(metalworx_iff_data,MetalBuffer,sizeof(metalworx_iff_data));
  42.     Metalworx_Image.ImageData=MetalBuffer;
  43.   }
  44.   Metalworx_window.Screen = screen;
  45.   Metalworx_window.LeftEdge = (640 - metalworx_iff_width) / 2;
  46.   Metalworx_window.TopEdge = (screen->Height - metalworx_iff_height) / 2;
  47.   if ((win = OpenWindow(&Metalworx_window)) == NULL)
  48.     return 1;
  49.   DrawImage(win->RPort, &Metalworx_Image, 0, 0);
  50.   Nachricht(win);
  51.   CloseWindowSafely(win,TRUE);
  52.   if(MetalBuffer)
  53.     FreeMem((UBYTE *)MetalBuffer,sizeof(metalworx_iff_data));
  54.   return 0;
  55. }
  56.