Random software
Random demo
  • Entry name:
    Draw a Cuboid
  • Category:
    Graphics
  • Publisher/Developer:
    Rosetta Code
  • Year:
    2021
  • Code:
    amarok
  • Programming language:
    Action!
Draw a Cuboid Draw a Cuboid
Listing 1
PROC DrawCuboid(CARD x,y BYTE w,h,d)
  BYTE wsize=[10],hsize=[10],dsize=[5]
  BYTE i

  FOR i=0 TO w
  DO
    Plot(x+i*wsize,y+h*hsize)
    DrawTo(x+i*wsize,y)
    DrawTo(x+i*wsize+d*dsize,y-d*dsize)
  OD
  FOR i=0 TO h
  DO
    Plot(x,y+i*hsize)
    DrawTo(x+w*wsize,y+i*hsize)
    DrawTo(x+w*wsize+d*dsize,y+i*hsize-d*dsize)
  OD
  FOR i=1 TO d
  DO
    Plot(x+i*dsize,y-i*dsize)
    DrawTo(x+w*wsize+i*dsize,y-i*dsize)
    DrawTo(x+w*wsize+i*dsize,y+h*hsize-i*dsize)
  OD
RETURN

PROC Main()
  BYTE CH=$02FC,COLOR1=$02C5,COLOR2=$02C6
  
  Graphics(8+16)
  COLOR1=$0C
  COLOR2=$02
  Color=1

  DrawCuboid(60,45,2,3,4)
  DrawCuboid(130,40,2,4,3)
  DrawCuboid(205,50,3,2,4)
  DrawCuboid(55,120,3,4,2)
  DrawCuboid(120,130,4,2,3)
  DrawCuboid(200,125,4,3,2)

  DO UNTIL CH#$FF OD
  CH=$FF
RETURN  

This is non-commercial site, its content is based on Atari 8-bit home computer contents and references.
If you feel your rights are violated by showing/using any part of contents of your product represented on this page, please contact me immediatelly so I can remove it!