home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d571 / gwin.lha / Gwin / Examples / gwin.manx.user.h < prev    next >
C/C++ Source or Header  |  1991-12-22  |  9KB  |  216 lines

  1. /*******************************************************/
  2. /*                                                     */
  3. /* GWIN INCLUDE FILE                                   */
  4. /*                                                     */
  5. /*******************************************************/
  6.  
  7. #include <exec/types.h>
  8. #include <graphics/gfxbase.h>
  9. #include <graphics/display.h>
  10. #include <graphics/regions.h>
  11. #include <graphics/gfx.h>
  12. #include <graphics/gfxmacros.h>
  13. #include <intuition/intuitionbase.h>
  14. #include <intuition/intuition.h>
  15. #include <stdio.h>
  16. #include <exec/memory.h>
  17. #include <hardware/custom.h>
  18. #include <hardware/dmabits.h>
  19. #include <libraries/dos.h>
  20. #include <libraries/diskfont.h>
  21. #include <devices/audio.h>
  22. #include <math.h>
  23.  
  24. #define SCR_MAX 1
  25. #define WIN_MAX 1
  26. #define MAXVECTORS 1000
  27. /* 640 x 400 / 8  (page 230 Mortimore) */
  28. #define RASTERSIZE 32000
  29.  
  30. #define USTART(a,b,c,d,e)  { if(!OpenGWINBase()) {                     \
  31.                                 printf("Can't open GWIN.library.\n");  \
  32.                                 printf("Exiting.\n");                  \
  33.                                 exit(1);                               \
  34.                              }                                         \
  35.                              G = ustart( (a),(b),(c),(d),(e) );        \
  36.                              GfxBase = G->GfxBase;                     \
  37.                              IntuitionBase = G->IntuitionBase;         \
  38.                              DiskfontBase = G->DiskfontBase;           \
  39.                              rport1 = G->rport1;                       \
  40.                              win[0] = G->win[0];                       \
  41.                              scr[0] = G->scr[0];                       }
  42.  
  43. #define UEND()             { uend(G);                                  \
  44.                              CloseGWINBase();                          }
  45. /*
  46.  
  47. extern short Enable_Abort;
  48.  
  49. */
  50.  
  51. /*******************************************************/
  52. /*                                                     */
  53. /* GLOBAL VARIABLES                                    */
  54. /*                                                     */
  55. /*******************************************************/
  56.  
  57. struct G_user_subset {
  58.    struct RastPort *rport1;
  59.    struct Window *win[WIN_MAX];
  60.    struct Screen *scr[SCR_MAX];
  61.  
  62.    struct GfxBase *GfxBase;
  63.    struct IntuitionBase *IntuitionBase;
  64.    struct DiskfontBase *DiskfontBase;
  65. } *G;
  66.  
  67. struct RastPort *rport1;
  68. struct Window *win[WIN_MAX];
  69. struct Screen *scr[SCR_MAX];
  70.  
  71. struct GfxBase *GfxBase;
  72. struct IntuitionBase *IntuitionBase;
  73. struct DiskfontBase *DiskfontBase;
  74.  
  75.  
  76. /*******************************************************/
  77. /*                                                     */
  78. /* STRUCTURE DEFINITIONS                               */
  79. /*                                                     */
  80. /*******************************************************/
  81.  
  82. struct G_user_subset *ustart(char *c, float x1, float x2,
  83.                                       float y1, float y2);
  84.  
  85. struct GWINBase *GWINBase = 0L;
  86.  
  87. BOOL OpenGWINBase()
  88. {
  89.         GWINBase=(struct GWINBase *)OpenLibrary("GWIN.library",1L);
  90.         if(GWINBase) {
  91.          return(TRUE);
  92.          }
  93.         else {
  94.          return(FALSE);
  95.          }
  96. }
  97.  
  98. void CloseGWINBase()
  99. {
  100.         if(GWINBase) CloseLibrary(GWINBase);
  101.         GWINBase=0L;
  102. }
  103.  
  104. struct uuevent {
  105.    ULONG event;
  106.    char key;
  107. } uuev;
  108.  
  109. /*******************************************************/
  110. /*                                                     */
  111. /* FUNCTION PROTOTYPES                                 */
  112. /*                                                     */
  113. /*******************************************************/
  114.  
  115. extern struct G_user_subset *ustart(char *c, float x1, float x2,
  116.                                                 float y1, float y2);
  117. extern int udarea(struct G_user_subset *G, float x1, float x2,
  118.                                            float y1, float y2);
  119. extern int uwindo(struct G_user_subset *G, float xmin, float xmax,
  120.                                            float ymin, float ymax);
  121. extern int uoutln(struct G_user_subset *G);
  122. extern int uerase(struct G_user_subset *G);
  123. extern int uflush(struct G_user_subset *G);
  124. extern int uwhere(struct G_user_subset *G, float *x, float *y);
  125. extern int uadjust(struct G_user_subset *G, float x, float y,
  126.                                             float *xa, float *ya);
  127. extern int urotate(struct G_user_subset *G, float x, float y, float theta);
  128. extern int ugrin(struct G_user_subset *G, float *x, float *y);
  129. extern int ugrinc(struct G_user_subset *G, float *x, float *y,
  130.                                         struct uuevent *uuev);
  131. extern int ugrinl(struct G_user_subset *G, float *x, float *y,
  132.                                          struct uuevent *uuev);
  133. extern int ugrina(struct G_user_subset *G, float *x, float *y,
  134.                                         struct uuevent *uuev);
  135. extern int uigrina(struct G_user_subset *G, int *ix,  int *iy,
  136.                                         struct uuevent *uuev);
  137. extern int uyorn(struct G_user_subset *G, char *bodytext,
  138.                  char *positivetext, char *negativetext, float width,
  139.                  float height);
  140. extern int uimove(struct G_user_subset *G, int ix, int iy);
  141. extern int uidraw(struct G_user_subset *G, int ix, int iy);
  142. extern int umove(struct G_user_subset *G, float x, float y);
  143. extern int udraw(struct G_user_subset *G, float x, float y);
  144. extern int urect(struct G_user_subset *G, float x1, float y1,
  145.                                           float x2, float y2);
  146. extern int uplygn(struct G_user_subset *G, float x, float y,
  147.                                            float n, float r);
  148. extern int ucrcle(struct G_user_subset *G, float x, float y, float r);
  149. extern int uamenu(struct G_user_subset *G, int gwinmenu0,
  150.                   int gwinmenu1, int gwinmenu2, char* text,
  151.                   char comchr, int mutex, USHORT flags, int (*routine)() );
  152.  
  153. extern int upset(struct G_user_subset *G, char *text, float value);
  154. extern int uset(struct G_user_subset *G, char *text);
  155. extern int usetrgb(struct G_user_subset *G, float colorindex,
  156.                    float redvalue, float greenvalue, float bluevalue);
  157. extern int ugetrgb(struct G_user_subset *G, float colorindex,
  158.                    float *redvalue, float *greenvalue, float *bluevalue);
  159. extern int ugetstring(struct G_user_subset *G, float x1, float y1,
  160.                       float width, char *text, char *prompt);
  161. extern int ufont(struct G_user_subset *G, char *name, float size);
  162. extern int uprint(struct G_user_subset *G, float x, float y, char *line);
  163. extern int uprnt1(struct G_user_subset *G, char *option, char *line);
  164.  
  165. extern int uprscr(struct G_user_subset *G);
  166. extern int usetcleanup(struct G_user_subset *G, int (*cleanup_routine)() );
  167. extern int uend(struct G_user_subset *G);
  168. extern int uzvtodconv(struct GR *G, float x, float y, float *xt, float *yt,
  169.                int *ix, int *iy);
  170. extern int uzdtovconv(struct GR *G,int ix, int iy, float *x, float *y);
  171.  
  172.  
  173. /*******************************************************/
  174. /*                                                     */
  175. /* PRAGMAS                                             */
  176. /*                                                     */
  177. /*******************************************************/
  178.  
  179. #pragma amicall(GWINBase, 0x1E, ustart(a0,d0,d1,d2,d3))
  180. #pragma amicall(GWINBase, 0x24, udarea(a0,d0,d1,d2,d3))
  181. #pragma amicall(GWINBase, 0x2A, uwindo(a0,d0,d1,d2,d3))
  182. #pragma amicall(GWINBase, 0x30, uoutln(a0))
  183. #pragma amicall(GWINBase, 0x36, uerase(a0))
  184. #pragma amicall(GWINBase, 0x3C, uflush(a0))
  185. #pragma amicall(GWINBase, 0x42, uwhere(a0,a1,a2))
  186. #pragma amicall(GWINBase, 0x48, uadjust(a0,d0,d1,a1,a2))
  187. #pragma amicall(GWINBase, 0x4E, urotate(a0,d0,d1,d2))
  188. #pragma amicall(GWINBase, 0x54, ugrin(a0,a1,a2))
  189. #pragma amicall(GWINBase, 0x5A, ugrinc(a0,a1,a2,a3))
  190. #pragma amicall(GWINBase, 0x60, ugrinl(a0,a1,a2,a3))
  191. #pragma amicall(GWINBase, 0x66, ugrina(a0,a1,a2,a3))
  192. #pragma amicall(GWINBase, 0x6C, uigrina(a0,a1,a2,a3))
  193. #pragma amicall(GWINBase, 0x72, uyorn(a0,a1,a2,a3,d0,d1))
  194. #pragma amicall(GWINBase, 0x78, uimove(a0,d0,d1))
  195. #pragma amicall(GWINBase, 0x7E, uidraw(a0,d0,d1))
  196. #pragma amicall(GWINBase, 0x84, umove(a0,d0,d1))
  197. #pragma amicall(GWINBase, 0x8A, udraw(a0,d0,d1))
  198. #pragma amicall(GWINBase, 0x90, urect(a0,d0,d1,d2,d3))
  199. #pragma amicall(GWINBase, 0x96, uplygn(a0,d0,d1,d2,d3))
  200. #pragma amicall(GWINBase, 0x9C, ucrcle(a0,d0,d1,d2))
  201. #pragma amicall(GWINBase, 0xA2, uamenu(a0,d0,d1,d2,a1,d3,d4,d5,a2))
  202. #pragma amicall(GWINBase, 0xA8, upset(a0,a1,d0))
  203. #pragma amicall(GWINBase, 0xAE, uset(a0,a1))
  204. #pragma amicall(GWINBase, 0xB4, usetrgb(a0,d0,d1,d2,d3))
  205. #pragma amicall(GWINBase, 0xBA, ugetrgb(a0,d0,a1,a2,a3))
  206. #pragma amicall(GWINBase, 0xC0, ugetstring(a0,d0,d1,d2,a1,a2))
  207. #pragma amicall(GWINBase, 0xC6, ufont(a0,a1,d0))
  208. #pragma amicall(GWINBase, 0xCC, uprint(a0,d0,d1,a1))
  209. #pragma amicall(GWINBase, 0xD2, uprnt1(a0,a1,a2))
  210. #pragma amicall(GWINBase, 0xD8, uprscr(a0))
  211. #pragma amicall(GWINBase, 0xDE, usetcleanup(a0,a1))
  212. #pragma amicall(GWINBase, 0xE4, uend(a0))
  213. #pragma amicall(GWINBase, 0xEA, uzvtodconv(a0,d0,d1,a1,a2,a3,a5))
  214. #pragma amicall(GWINBase, 0xF0, uzdtovconv(a0,d0,d1,a1,a2))
  215.  
  216.