Basics 015

HYPE, HEllipse, HRect, HPath

import hype.*;

 This testfile demonstrates the recently added
 feature that lets you call H.add() and remove()
 to assign variables without needing to cast them.

 Be noted that the problems presented in this test
 file were only relevant in *Java Mode*, due to the
 language's strict typing.

 Instead of:

   HRect r = (HRect) H.add(new HRect());
 You can now do this:
   HRect r = H.add(new HRect());
 I simply made multiple add() and remove() methods
 for each drawable class in class H.
 Even though I have more than one of each of the
 aforementioned methods, this wouldn't cause an
 issue with JS Mode. All those functions would have
 just merged into the original H.add() and H.remove()
 functions, which would work just fine due to its
 weak typing.

void setup() {

 H.add( new HEllipse() )
  .stroke(#000000, 100)
  .loc(100, height/2)

 H.add( new HRect() )
  .stroke(#000000, 100)
  .loc(250, height/2)

 H.add( new HPath() )
  .star(5, 0.5, 90)
  .stroke(#000000, 100)
  .loc(400, height/2)

 H.add( new HPath(POLYGON) )
  .stroke(#000000, 100)

  Here's the list of classes that you no longer need to
  cast with H.add() and H.remove() as of build_21030531.0:
  - HCanvas
  - HEllipse
  - HGroup
  - HImage
  - HPath
  - HRect
  - HShape
  - HText
  If you created your own HDrawable class, then you'll still
  need to do the old casting thing.


void draw() {