home *** CD-ROM | disk | FTP | other *** search
- MODULE 'intuition/intuition','intuition/screens','graphics/modeid','utility/tagitem'
-
- CONST W=320,H=240
-
- PROC main()
- DEF flist:PTR TO flare
- flist:=[
- FL_Linear , 50.0, 0.00,1.0,1.0,1.0,
- FL_Power , 60.0, 0.00,0.0,0.3,1.0,
- FL_Circle , 30.0,-0.10,0.1,0.1,0.1,
- FL_Circle , 10.0, 0.20,0.1,0.1,0.1,
- FL_Circle , 34.0, 0.25,0.1,0.1,0.1,
- FL_Circle , 20.0, 0.30,0.1,0.1,0.1,
- FL_Circle , 14.0, 0.40,0.1,0.1,0.1,
- FL_Power , 2.0, 0.47,0.2,0.7,1.0,
- FL_Circle , 4.0, 0.55,0.1,0.1,0.1,
- FL_Circle , 26.0, 0.60,0.1,0.1,0.1,
- FL_Circle , 12.0, 0.70,0.1,0.1,0.1,
- FL_Circle , 16.0, 0.85,0.1,0.1,0.1,
- FL_Circle ,100.0, 1.00,0.1,0.1,0.1,
- FL_Circle ,200.0, 1.50,0.1,0.1,0.1,
- FL_Last]:flare
- PrintF('Flare by MarK 28.12.1999\n')
- PrintF('Press:\n\tLMB to change light position\n\tany key for exit\n')
- IF Preview(flist)
- // Render(flist)
- ENDIF
- ENDPROC
-
- //
- // currently is used only FL_Last, everything else is for flare rendering, but it is
- // not done yet.
- //
- ENUM FL_Last,
- FL_Linear,
- FL_Power,
- FL_Circle,
- FL_Ring,
- FL_FadeRing
-
- OBJECT flare
- type:LONG, // type of the flare (see FL... above)
- size:FLOAT, // size of the flare
- pos:FLOAT, // position on the flare line (0=light, 1.0=opposite the light)
- r:FLOAT, // colour of the flare
- g:FLOAT,
- b:FLOAT
-
- PROC Preview(flist:PTR TO flare)(LONG)
- DEF s:PTR TO Screen,w:PTR TO Window,m:PTR TO IntuiMessage,end=FALSE,r=FALSE
- IF s:=OpenScreenTags(NIL,
- SA_Width,W,
- SA_Height,H,
- SA_Depth,1,
- // SA_DisplayID,VGALORESDBL_KEY,
- SA_Colors,[0,0,0,0,1,15,15,15,-1]:WORD,
- TAG_END)
- IF w:=OpenWindowTags(NIL,
- WA_Width,W,
- WA_Height,H,
- WA_CustomScreen,s,
- WA_IDCMP,IDCMP_MOUSEBUTTONS|IDCMP_VANILLAKEY,
- WA_Flags,WFLG_RMBTRAP|WFLG_ACTIVATE|WFLG_BORDERLESS,
- TAG_END)
- SetAPen(w.RPort,1)
- DrawFlare(w.RPort,flist,w.MouseX,w.MouseY)
-
- WHILE WaitPort(w.UserPort)
- IF m:=GetMsg(w.UserPort)
- IF m.Class=IDCMP_MOUSEBUTTONS
- IF m.Code=SELECTDOWN
- SetRast(w.RPort,0)
- DrawFlare(w.RPort,flist,w.MouseX,w.MouseY)
- ELSEIF m.Code=MENUDOWN
- r:=TRUE
- end:=TRUE
- ENDIF
- ELSE
- end:=TRUE
- ENDIF
- ReplyMsg(m)
- ENDIF
- EXITIF end=TRUE
- ENDWHILE
-
- // WaitPort(w.UserPort)
- CloseWindow(w)
- ELSE PrintF('Unable to open window!\n')
- CloseScreen(s)
- ELSE PrintF('Unable to open screen!\n')
- ENDPROC r
-
- PROC DrawFlare(rp,flist:PTR TO flare,mx:FLOAT,my:FLOAT)
- DEFF cx,cy,dx,dy,x,y
- cx:=W/2
- cy:=H/2
- dx:=cx-mx
- dy:=cy-my
- REPEAT
- x:=-dx*(flist.pos*2.0-1.0)
- y:=-dy*(flist.pos*2.0-1.0)
- // PrintF('x=$\z\h[8]\ny=$\z\h[8]\n',x,y)
- DrawEllipse(rp,x+cx,y+cy,flist.size/2,flist.size/2)
- flist[]++
- UNTIL flist.type=FL_Last
- ENDPROC
-