home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / desklib / Examples / !SpriteTst / c / !RunImage next >
Encoding:
Text File  |  1994-03-05  |  3.0 KB  |  94 lines

  1.  
  2. #include "DeskLib:WimpSWIs.h"          /* Low-level WIMP commands         */
  3. #include "DeskLib:Window.h"            /* Window handling automation      */
  4. #include "DeskLib:Dialog.h"            /* High-level dialogue windows     */
  5. #include "DeskLib:DragASpr.h"          /* DragASprite veneers             */
  6. #include "DeskLib:Error.h"             /* Error despatcher                */
  7. #include "DeskLib:Event.h"             /* Event despatcher                */
  8. #include "DeskLib:EventMsg.h"          /* Wimp Message event dispatcher   */
  9. #include "DeskLib:File.h"              /* Low level file handling         */
  10. #include "DeskLib:GFX.h"               /* Graphics routines (GFX_Wait)    */
  11. #include "DeskLib:Handler.h"           /* Default/example event handlers  */
  12. #include "DeskLib:Hourglass.h"         /* Hourglass module interfaces     */
  13. #include "DeskLib:Icon.h"              /* Icon handling automation        */
  14. #include "DeskLib:Menu.h"              /* Menu create & show support      */
  15. #include "DeskLib:Msgs.h"              /* Message translation code        */
  16. #include "DeskLib:Pane.h"              /* Pane window handling            */
  17. #include "DeskLib:Resource.h"          /* Handles finding resource files  */
  18. #include "DeskLib:Screen.h"            /* Getting screen size info, etc   */
  19. #include "DeskLib:Sound.h"             /* Sound System control            */
  20. #include "DeskLib:Template.h"          /* Template loading and caching    */
  21. #include "DeskLib:Sprite.h"
  22.  
  23. /*
  24.  * ANSI includes
  25.  *---------------
  26.  */
  27.  
  28. #include <stdio.h>
  29. #include <string.h>
  30.  
  31. BOOL quit = FALSE;
  32. window_handle window;
  33. char sblck[10240];
  34. char name [] ="ampy";
  35. sprite_areainfo *sblock = (sprite_areainfo *) sblck;
  36.  
  37. BOOL CloseWin(event_pollblock *, void *);
  38. BOOL Redraw(event_pollblock *, void *);
  39.  
  40. int main()
  41. {
  42.   Resource_Initialise("SpriteTest");
  43.   Event_Initialise("Sprite Test");
  44.   EventMsg_Initialise();
  45.   Screen_CacheModeInfo();
  46.   EventMsg_Claim(message_MODECHANGE, event_ANY, Handler_ModeChange, NULL);
  47.   Template_Initialise();
  48.   Template_LoadFile("Templates");
  49.   sblock->areasize = 10240;
  50.   sblock->numsprites = 0;
  51.   sblock->firstoffset = 16;
  52.   sblock->freeoffset = 16;
  53.   Sprite_Load((sprite_area)sblock, "<SpriteTest$Dir>.me_bw");
  54.   Event_Claim(event_CLOSE, event_ANY, event_ANY, CloseWin, NULL);
  55.   Event_Claim(event_REDRAW, event_ANY, event_ANY, Redraw, NULL);
  56.   Event_Claim(event_OPEN, event_ANY, event_ANY, Handler_OpenWindow, NULL);
  57.   window = Window_CreateAndShow("stest", 12, open_WHEREVER);
  58.  
  59.   while (!quit)
  60.     Event_Poll();
  61.  
  62.   return(0);
  63. }
  64.  
  65. BOOL CloseWin(event_pollblock *e, void *r)
  66. {
  67.   quit = TRUE;
  68.   return(TRUE);
  69. }
  70.  
  71. /* Sprite at 120,-340 */
  72.  
  73. BOOL Redraw(event_pollblock *e, void *r)
  74. {
  75.   window_redrawblock redraw;
  76.   BOOL more;
  77.   wimp_point c;
  78.  
  79.   c.x=120;
  80.   c.y=-320;
  81.  
  82.   redraw.window = e->data.openblock.window;
  83.   Wimp_RedrawWindow(&redraw, &more);
  84.  
  85.   while (more)
  86.   {
  87.     Sprite_WimpPlot((sprite_area)sblock, name, &c, (convert_block *)&redraw.rect,0);
  88.     Wimp_GetRectangle(&redraw, &more);
  89.   }
  90.  
  91.   return(TRUE);
  92. }
  93.  
  94.