Graphics mode

Post Reply
Dr zayus
Posts: 25
Joined: Sat Dec 14, 2013 10:47 pm

Graphics mode

Post by Dr zayus »

Why does this switch out of graphics mode when building sprite--code follows:

option base 1
option angle degrees
option sprite pos central
graphics clear 1,1,1
graphics
gosub Spiralx
gosub DisplaySpiral
end

Spiralx:
cx=42!cy=46
option angle radians
draw alpha 1
sprite "spiral" begin 2*cx,2*cy
draw to cx,cy
draw color 1,0,0
draw size 4
shadow on
a=.02
for t = 0 to (6.28 * 5) step .008
x =a*t * cos(t)
y = a*t * sin(t)
draw line to cx+x ,cy+y
a=(a+.0004)
next t
sprite end
return

DisplaySpiral:
sprite "spiral" show
for i = 1 to 360
sprite "spiral" at 400,400 angle i
pause .2
next i
return

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Graphics mode

Post by Mr. Kibernetik »

There is only one graphics mode. So smart BASIC does not "switch out" of it - graphics mode switches to drawing sprite with command SPRITE BEGIN and then returns to main graphics window with command SPRITE END.

Dr zayus
Posts: 25
Joined: Sat Dec 14, 2013 10:47 pm

Re: Graphics mode

Post by Dr zayus »

I guess I mean it seems to switch to text view to draw sprite and then as you say switches back to graphics window when reaching sprite end.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Graphics mode

Post by Mr. Kibernetik »

So why do you think it goes to text view to draw sprite?

Dr zayus
Posts: 25
Joined: Sat Dec 14, 2013 10:47 pm

Re: Graphics mode

Post by Dr zayus »

When program runs graphics window starts out all white
Then when sprite starts to build, view changes to the papyrus view then
When sprite end is reached window goes back to white with sprite on it

Why does the papyrus view show when draw command starts??

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Graphics mode

Post by Mr. Kibernetik »

At first you clean main graphics window to white with GRAPHICS CLEAR command.
Then you switch to main graphics view with GRAPHICS command - you see white background.
Then you begin drawing sprite, this switches graphics view to fresh and clean graphics window - you see papyrus background of empty graphics window.
Then you end drawing sprite, this switches graphics view back to main graphics window.

Dr zayus
Posts: 25
Joined: Sat Dec 14, 2013 10:47 pm

Re: Graphics mode

Post by Dr zayus »

I see--- thanks.

Post Reply