Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
First
Dan's changes
  • Loading branch information
etl12003 committed Apr 17, 2015
0 parents commit 9b8f678
Show file tree
Hide file tree
Showing 37 changed files with 530 additions and 0 deletions.
17 changes: 17 additions & 0 deletions LavaJava/.classpath
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="C:/Users/Dan DeMarco/Desktop/lib/natives"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="C:/Users/Erik/Desktop/Desktop/lib/jars/lwjgl.jar"/>
<classpathentry kind="lib" path="C:/Users/Erik/Desktop/Desktop/lib/jars/lwjgl_util.jar">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="C:/Users/Erik/Desktop/the game/fwd2102game417/LavaJava/LavaJava/natives"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Users/Erik/Desktop/Desktop/lib/jars/slick-util.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions LavaJava/.project
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>LavaJava</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions LavaJava/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
10 changes: 10 additions & 0 deletions LavaJava/bin/.gitignore
@@ -0,0 +1,10 @@
/BoundingBox.class
/ColidableObject.class
/Game.class
/GameStateManager.class
/Level1.class
/ObjectArray.class
/Player.class
/Wall.class
/helpers/
/res/
Binary file added LavaJava/natives/OpenAL32.dll
Binary file not shown.
Binary file added LavaJava/natives/OpenAL64.dll
Binary file not shown.
Binary file added LavaJava/natives/jinput-dx8.dll
Binary file not shown.
Binary file added LavaJava/natives/jinput-dx8_64.dll
Binary file not shown.
Binary file added LavaJava/natives/jinput-raw.dll
Binary file not shown.
Binary file added LavaJava/natives/jinput-raw_64.dll
Binary file not shown.
Binary file added LavaJava/natives/lwjgl.dll
Binary file not shown.
Binary file added LavaJava/natives/lwjgl64.dll
Binary file not shown.
53 changes: 53 additions & 0 deletions LavaJava/src/BoundingBox.java
@@ -0,0 +1,53 @@
import java.awt.Point;


public class BoundingBox {
private double x1, y1; // lower left
private double x2, y2; // upper right

public BoundingBox(double x1, double y1, double x2, double y2) {
this.x1 = Math.min(x1, x2);
this.x2 = Math.max(x1, x2);
this.y1 = Math.min(y1, y2);
this.y2 = Math.max(y1, y2);
}

public BoundingBox(Point p, Point q) {
this(p.x, p.y, q.x, q.y);
}

// random rectangle in unit square
public BoundingBox() {
this(new Point(), new Point());
}

// is Point p inside this BoundingBox?
public boolean contains(Point p) {
return (p.x >= x1 && p.x <= x2 && p.y >= y1 && p.y <= y2);
}

// does this BoundingBox r intersect s?
public boolean intersects(BoundingBox s) {
BoundingBox r = this;
return (r.x2 >= s.x1 && r.y2 >= s.y1 && s.x2 >= r.x1 && s.y2 >= r.y1);
}


// return the area
public double area() {
return (x2 - x1) * (y2 - y1);
}

// return the area
public String toString() {
return "[(" + x1 + ", " + y1 + ") (" + x2 + ", " + y2 + ")]";
}
public void setBoundingBox(double x1, double y1, double x2, double y2){
this.x1 = Math.min(x1, x2);
this.x2 = Math.max(x1, x2);
this.y1 = Math.min(y1, y2);
this.y2 = Math.max(y1, y2);
}


}
27 changes: 27 additions & 0 deletions LavaJava/src/ColidableObject.java
@@ -0,0 +1,27 @@

public abstract class ColidableObject {

public void init(){

}
public void render(){

}
public int x1(){
return 0;

}
public int x2(){
return 0;
}
public int y1(){
return 0;

}
public int y2(){
return 0;
}



}
31 changes: 31 additions & 0 deletions LavaJava/src/Game.java
@@ -0,0 +1,31 @@
import static helpers.Artist.SetUp;

import java.util.ArrayList;

import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;


public class Game {

public static void main(String[] args) {

SetUp(800, 600);
Level1 m = new Level1();

while(!Display.isCloseRequested()){
Display.setTitle("Bounding");
Display.update();
Display.sync(60);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
m.render();




}
Display.destroy();
}

}
18 changes: 18 additions & 0 deletions LavaJava/src/GameStateManager.java
@@ -0,0 +1,18 @@
import java.util.ArrayList;


public class GameStateManager {
private int currentState;
private ArrayList<GameState> states;
public static final int MENUSTATE = 0;

// add more state integers here

public GameStateManager() {
states = new ArrayList<GameState>();
states.add(new MenuState());

}


}
59 changes: 59 additions & 0 deletions LavaJava/src/Level1.java
@@ -0,0 +1,59 @@
import org.lwjgl.input.Mouse;
import org.newdawn.slick.opengl.Texture;
import static helpers.Artist.DrawQuadTex;

import static helpers.Artist.QuickLoadTexture;

public class Level1 {
Texture Background,blockers;
private String grass = "Grass64";
private String dirt = "Dirt64";
Player player = new Player(400,300);
ObjectArray w = new ObjectArray();
Wall w1 = new Wall(400,400);
ColidableObject x = new Wall(0, 0);

public Level1() {
init();
}
void init(){
Background = QuickLoadTexture(grass);
blockers = QuickLoadTexture(dirt);

}
void render(){
for (int i = 0; i < 800; i+= 64) {
for (int j = 0; j < 600; j+=64) {
DrawQuadTex(Background,i,j,64,64);
DrawQuadTex(blockers, 0, j, 64, 64);
}

}

for (int i = 0; i<w.size()-1; i++) {
w.getWall(i).render();

}

player.checkCollsionAndMove((Wall) w.getWall(0));
player.update();
player.render();
System.out.println(player.getMotionX() + " " + player.getMotionY());














}


}
26 changes: 26 additions & 0 deletions LavaJava/src/ObjectArray.java
@@ -0,0 +1,26 @@
import java.util.ArrayList;


public class ObjectArray {
ArrayList<ColidableObject> lvl1 = new ArrayList<ColidableObject>();
static int increment = 10;

public ObjectArray() {
for (int i = 0; i < 5; i++) {
lvl1.add(new Wall(200,increment));
increment+=64;
}
}

public int size(){
return lvl1.size();

}
public ColidableObject getWall(int i){
return lvl1.get(i);
}
public ArrayList<ColidableObject> returnList(){
return lvl1;
}

}

0 comments on commit 9b8f678

Please sign in to comment.