archive‎ > ‎2016‎ > ‎Notice 2016‎ > ‎

On your 2nd assignment

posted Aug 11, 2016, 12:18 AM by Yonggeun Kim   [ updated Aug 11, 2016, 12:53 AM by Yonggeun Kim ]
Dear all, 

If you are having a problem to complete your 2nd assignment please watch the tutorial video below first.

After watching these videos you will learn the fundamental concepts on OOP(Object-Oriented Programming). The reason why this is important is that 99% of  libraries for processing are based on the this OOP concept as well as other computer programming language. 

Simply put controlP5 is another OOP-based library for processing to add UI components on your sketch. 

This means if know how the library organized based on OOP methodology you will learn how to use them for your own code. 

Briefing again, your goal is to add more than 5 controlP5 UI component onto your first assignment based on the code below. The code is from the Accessing Controllers section on the library github page with author's explanation.

    import controlP5.*;
    ControlP5 cp5;

    void setup() {
      size(400, 400);
      cp5 = new ControlP5(this);
      cp5.addSlider("mySlider").setPosition(20, 20).setSize(200, 20);

    void draw() {
      // cp5.getController returns a Controller object
      Controller c = cp5.getController("mySlider");

      // cp5.get here returns a Slider object
      Slider slider = cp5.get(Slider.class, "mySlider");
      println(slider.getMin(), slider.getMax());

While you're add the code from the imported library, here ControlP5, you need to know the property sand functionalities structured by author. To access the reference for this information please visit the package reference.

Don't forget updating your current github repo address next to your name on the student page. 

Enjoy coding and good luck. 

Yonggeun Kim