Path: news1.icaen!news.uiowa.edu!NewsNG.Chicago.Qual.Net!nyd.news.ans.net!newsfeeds.ans.net!news.idt.net!netnews.com!howland.erols.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.INS.CWRU.Edu!cleveland.Freenet.Edu!fl332 From: fl332@cleveland.Freenet.Edu (John L. Graham) Newsgroups: comp.sys.apple2.programmer Subject: GSoft BASIC Toolbox Example Date: 7 Sep 1998 16:17:58 GMT Organization: Case Western Reserve University, Cleveland, OH (USA) Lines: 102 Message-ID: <6t10vn$dmr$1@pale-rider.INS.CWRU.Edu> Reply-To: fl332@cleveland.Freenet.Edu (John L. Graham) NNTP-Posting-Host: owl.ins.cwru.edu Xref: news1.icaen comp.sys.apple2.programmer:10195 This is one of my first tests of calling GSOS toolbox routines from GSoft BASIC. This little program uses several toolbox calls to draw a set of circles centered on the screen while simultaneously cycling through the color palette. Once all the circles are drawn another set of toolbox calls are used to redefine the color palette and cycle through the palette creating a simple animation effect. So far Gsoft has been a great way to explore the toolbox. -John ====================================================================== ! Dimension arrays & variables. DIM RECT_BOUNDS AS RECT ! Start QuickDraw II. HGR ! Draw a set of circles centered on the screen. COLOR% = 0 FOR RADIUS% = 0 TO 190 RECT_BOUNDS.H1 = 160 - RADIUS% RECT_BOUNDS.H2 = 160 + RADIUS% RECT_BOUNDS.V1 = 100 - RADIUS% RECT_BOUNDS.V2 = 100 + RADIUS% COLOR% = COLOR% + 1 IF COLOR% = 16 THEN COLOR% = 1 SET640COLOR (COLOR%) FRAMEOVAL (RECT_BOUNDS) NEXT ! Cycle the color palette. CALL CYCLE_PALETTE ! Change the color palette to a gray scale. FOR COLOR% = 1 TO 15 RED% = COLOR% * 256 GREEN% = COLOR% * 16 BLUE% = COLOR% RGB% = RED% + GREEN% + BLUE% SETCOLORENTRY (0, COLOR%, RGB%) NEXT ! Cycle the color palette. CALL CYCLE_PALETTE ! Change the color palette to a red scale. FOR COLOR% = 1 TO 15 RED% = COLOR% * 256 GREEN% = 0 BLUE% = 0 RGB% = RED% + GREEN% + BLUE% SETCOLORENTRY (0, COLOR%, RGB%) NEXT ! Cycle the color palette. CALL CYCLE_PALETTE ! Change the color palette to a green scale. FOR COLOR% = 1 TO 15 RED% = 0 GREEN% = COLOR% * 16 BLUE% = 0 RGB% = RED% + GREEN% + BLUE% SETCOLORENTRY (0, COLOR%, RGB%) NEXT ! Cycle the color palette. CALL CYCLE_PALETTE ! Change the color palette to a blue scale. FOR COLOR% = 1 TO 15 RED% = 0 GREEN% = 0 BLUE% = COLOR% RGB% = RED% + GREEN% + BLUE% SETCOLORENTRY (0, COLOR%, RGB%) NEXT ! Cycle the color palette. CALL CYCLE_PALETTE ! Get any key to end. GET KEY$ END ! +-------------+ ! | Subroutines | ! +-------------+ ! Cycle the color palette. SUB CYCLE_PALETTE FOR I% = 1 TO 190 FIRST% = GETCOLORENTRY (0, 1) FOR J% = 1 TO 14 COLOR% = GETCOLORENTRY (0, J% + 1) SETCOLORENTRY (0, J%, COLOR%) NEXT SETCOLORENTRY (0, 15, FIRST%) NEXT END SUB