home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3795 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: academy.bastad.se!news
  2. From: sten@academy.bastad.se (Sten Jansson)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Graphics with C
  5. Date: 24 Feb 1996 15:45:44 GMT
  6. Organization: Connection Bastad
  7. Message-ID: <1623.6628T957T1704@academy.bastad.se>
  8. References: <Dn83w3.1vv@uns.bris.ac.uk>
  9. NNTP-Posting-Host: academy.bastad.se
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=iso-8859-1
  12. Content-Transfer-Encoding: 8bit
  13. X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
  14.  
  15.  
  16. >I would like to know how to open a screen and how to plot and draw to it,
  17. >in different colours.  I have the commodore includes, but not ROM kernal
  18. >manuals.  I am using the freeware version of DICE, as supplied onm the
  19. >meeting pearls II CDROM, if this is important.  I am new to C programming,
  20. >but not to programming in general.
  21.  
  22. >Even if it is not possible to plot or draw, just knowing how to get the
  23. >address of the screen would be useful.  (I do not know the structure of
  24. >the RasterPort things).
  25.  
  26. There are 2 ways on V 37+.
  27.  
  28. 1 OpenScreen([pointer to a NewScreen structure]);
  29. This works with all system versions.
  30.  
  31. 2
  32.  struct TagItem scr_tags[] =
  33.     {
  34.       {SA_DisplayID, 0x00039020}, /*Multiscan 640*240*/
  35.       {SA_LikeWorkbench,1},       /*Same colours as WB*/
  36.       {TAG_DONE, NULL},
  37.  
  38.     };
  39.  
  40. my_screen = (struct Screen *) OpenScreenTagList(NULL, scr_tags);
  41.  
  42. The later is better because You can use diffrent resolutions & other
  43. stuff. This only works on V37+ so open intuition.library like this:
  44.  
  45.   IntuitionBase =  (struct IntuitionBase*)
  46.         OpenLibrary( "intuition.library", 37 );
  47.  
  48. When You have opended the screen You can use this to find out the
  49. adress: printf("%lx\n", [the pointer that the screen opening fuction
  50. returns]);
  51.  
  52. You can use a function called Draw() to draw lines.
  53. Syntax: Draw(struct *RastPort,X,Y);
  54. This draws a line from current cursor position to these coordinates.
  55. Use Move(struct *RastPort,X,Y); to move the cursor.
  56. U can ofcourse also draw lines directly on the screens bitmaps, but I
  57. wouldn'trecommend it. Hope that was some help, but U should get the Rom
  58. Kernal manuals.
  59.  
  60. /Sten
  61.  
  62.