Android Open Source - DeathRally Rectangle






From Project

Back to project page DeathRally.

License

The source code is released under:

GNU General Public License

If you think the Android project DeathRally listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package project.gamedev.deathrally.game.graphics;
/*w  w  w.ja  v a 2 s.c  o m*/
import javax.microedition.khronos.opengles.GL10;

import android.util.Log;

public class Rectangle extends Mesh{
  private static final String TAG = Rectangle.class.getSimpleName();
  //Painting CCW but remember shapes are rotated 180 by default
  private final short indices[] = {0,2,1,0,3,2};
  
  public Rectangle(float px, float py, float width, float height){
    super(px,py,GL10.GL_TRIANGLES);
    float[] verticeList = {
        px-width/2,py+height/2,0.0f,
        px-width/2,py-height/2,0.0f,
        px+width/2,py-height/2,0.0f, 
        px+width/2,py+height/2,0.0f
    };

    setVertices(verticeList);
    setIndices(indices);
    Log.d(TAG, "Rectangle created successfully");
  }
}




Java Source Code List

project.gamedev.deathrally.MainActivity.java
project.gamedev.deathrally.game.DeathRallyGame.java
project.gamedev.deathrally.game.GameLoop.java
project.gamedev.deathrally.game.GameModel.java
project.gamedev.deathrally.game.MainGamePanel.java
project.gamedev.deathrally.game.constants.LevelName.java
project.gamedev.deathrally.game.controls.Joystick.java
project.gamedev.deathrally.game.graphics.Circle.java
project.gamedev.deathrally.game.graphics.Mesh.java
project.gamedev.deathrally.game.graphics.Rectangle.java
project.gamedev.deathrally.game.graphics.Triangle.java
project.gamedev.deathrally.game.model.CollisionEvent.java
project.gamedev.deathrally.game.model.Direction.java
project.gamedev.deathrally.game.model.Entity.java
project.gamedev.deathrally.game.model.GameAction.java
project.gamedev.deathrally.game.model.Hitbox.java
project.gamedev.deathrally.game.model.Level.java
project.gamedev.deathrally.game.model.MovableEntity.java
project.gamedev.deathrally.game.model.Player.java
project.gamedev.deathrally.game.model.Players.java
project.gamedev.deathrally.game.model.Position.java
project.gamedev.deathrally.game.model.Vector2D.java
project.gamedev.deathrally.game.model.VehicleName.java
project.gamedev.deathrally.game.model.VehicleType.java
project.gamedev.deathrally.game.model.Vehicle.java
project.gamedev.deathrally.game.view.GameRenderer.java
project.gamedev.deathrally.game.view.JoystickView.java
project.gamedev.deathrally.game.view.VisualEntity.java
project.gamedev.deathrally.game.view.VisualVehicle.java