' Example of Graphics Functions
' In all supported modes
'
' Mode: 13 = VGA  320x200
'       14 = SVGA 640x480
'       15 = SVGA 800x600
'
' All these modes are 8-bit modes

Const yes = 1
Const no = 2

Screen 14

resx = getmaxx
resy = getmaxy

tryclip = no

if tryclip = 1 then
  t1 = resx >> 1
  t2 = resy >> 1
  t3 = t1 >> 1
  t4 = t2 >> 1
  setclip t1 - t3, t2 - 74, t1 + t3, t2 + t4
end if

; PSET Example

for y = 0 to resy
for x = 0 to resx
  pset x, y, 15
next x
next y
waitkey

; LINE Example

col = 0

for x = 0 to resx

   line x, 0, x , resy, col  

   col = col + 1
  
   if col = 248 then col = 0

next x

waitkey

; HLINE Example (Horizontal line)

col = 0
for y = 0 to resy
  hline 0, resx, y, col
  col = col + 1
  
  if col = 248 then col = 0
next y

waitkey

; FILLBOX Example

fillbox 0, 0, resx, resy, 15
waitkey

; VLINE Example (Vertical line)
col = 0

for x = 0 to resx
   VLINE 0, resy, x, 9  

   col = col + 1
  
   if col = 248 then col = 0
next x

waitkey

; BOX Example
x1 = 0
y1 = 0
x2 = resx
y2 = resy

t = timer
for i = 0 to 255
  box x1, y1, x2, y2, i
  x1 =+ 1
  x2 =- 1

  if y1 > resy SHR 1 then exit for

  y1 =+ 1
  y2 =- 1
next i
t2 = timer - t
waitkey
screen 0

print "Secs: " + str$(t2 / 100)
print "Hund: " + str$(t2 MOD 100)

end
