Package org.newdawn.slick.tests

Source Code of org.newdawn.slick.tests.LameTest

package org.newdawn.slick.tests;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Polygon;

/**
* Lame test
*
* @author kevin
*/
public class LameTest extends BasicGame {
  /** The poly being drawn */
  private Polygon poly = new Polygon();
  /** The image being textured */
  private Image image;
 
  /**
   * Create the test
   */
  public LameTest() {
    super("Lame Test");
  }
 
  /**
   * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
   */
  public void init(GameContainer container) throws SlickException {
    poly.addPoint(100, 100);
    poly.addPoint(120, 100);
    poly.addPoint(120, 120);
    poly.addPoint(100, 120);
 
    image = new Image("testdata/rocks.png");
  }

  /**
   * @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
   */
  public void update(GameContainer container, int delta) throws SlickException {
  }

  /**
   * @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
   */
  public void render(GameContainer container, Graphics g) throws SlickException {
    g.setColor(Color.white);
    g.texture(poly, image);
  }

  /**
   * Entry point to our test
   *
   * @param argv The arguments to pass into the test
   */
  public static void main(String[] argv) {
    try {
      AppGameContainer container = new AppGameContainer(new LameTest());
      container.setDisplayMode(800,600,false);
      container.start();
    } catch (SlickException e) {
      e.printStackTrace();
    }
  }
}
TOP

Related Classes of org.newdawn.slick.tests.LameTest

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.