06-16-2024, 02:26 PM
(This post was last modified: 06-16-2024, 02:30 PM by TerryRitchie.)
Instead of drawing the circles over and over again I converted that into a light source image.
(you can remove that PCOPY 0, 1. That was another approach I was playing with, forgot to delete line)
(you can remove that PCOPY 0, 1. That was another approach I was playing with, forgot to delete line)
Code: (Select All)
SCREEN _NEWIMAGE(1000, 700, 32)
'draw a background
FOR x = 0 TO _WIDTH STEP 25
FOR y = 0 TO _HEIGHT STEP 25
LINE (x, y)-STEP(25, 25), _RGBA(RND * 255, RND * 255, RND * 255, 150), BF
NEXT
NEXT
PCOPY 0, 1
'draw a light source
light& = _NEWIMAGE(900, 900, 32)
_DEST light&
FOR x = 0 TO 450 STEP .333
CIRCLE (449, 449), x, _RGBA(0, 0, 0, x / 1.9)
NEXT
_DEST 0
back& = _COPYIMAGE(_DISPLAY) 'image to use
work& = _COPYIMAGE(_DISPLAY) 'work screen
area& = _NEWIMAGE(600, 600, 32) 'faded area image
DO
'get mouse input
WHILE _MOUSEINPUT: WEND
mx = _MOUSEX: my = _MOUSEY
'point to the work screen
_DEST work&
'place background first
_PUTIMAGE (0, 0), back&
'place light source
_PUTIMAGE (mx - 450, my - 450), light&
'draw fadeout circle where mouse x/y is
'FOR x = 0 TO 450 STEP .333
' CIRCLE (mx, my), x, _RGBA(0, 0, 0, x / 1.9)
'NEXT
'put changed part of work screen into area&
_PUTIMAGE (0, 0), work&, area&, (mx - 300, my - 300)-(mx + 300, my + 300)
'go back to main screen
_DEST 0
'clear it
LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB(0, 0, 0), BF
'put faded area& onto screen
_PUTIMAGE (mx - 300, my - 300), area&
_DISPLAY
_LIMIT 30
LOOP UNTIL INKEY$ <> ""