Package edu.mit.d54.plugins.test

Source Code of edu.mit.d54.plugins.test.TestPlugin

package edu.mit.d54.plugins.test;

import edu.mit.d54.Display2D;
import edu.mit.d54.DisplayPlugin;

/**
* This is an example plugin which will render a moving color spectrum on the display.
*/
public class TestPlugin extends DisplayPlugin
{
  private final double dt;
 
  public TestPlugin(Display2D display, double framerate) {
    super(display, framerate);
    dt=1./framerate;
  }

  private double time=0;
  @Override
  protected void loop() {
    Display2D display=getDisplay();
    time+=dt;
    for (int x=0; x<display.getWidth(); x++)
    {
      for (int y=0; y<display.getHeight(); y++)
      {
        display.setPixelHSB(x,y,(float)(x+y+time*3)/36.f, 1f, 1f);
      }
    }
  }
 
}
TOP

Related Classes of edu.mit.d54.plugins.test.TestPlugin

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.