1
0
Fork 0
This commit is contained in:
MrDev023 2015-07-22 09:58:00 +02:00
parent be325c87c6
commit 1ded694712
9 changed files with 62 additions and 17 deletions

View file

@ -7,5 +7,6 @@
<classpathentry kind="lib" path="lib/affinity-1.6.jar" sourcepath="lib/affinity-1.6-sources.jar"/>
<classpathentry kind="lib" path="lib/jna-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/jna-platform-3.4.0.jar"/>
<classpathentry kind="lib" path="lib/slick.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,24 +1,61 @@
package mrdev023.game;
import static org.lwjgl.opengl.GL11.*;
import java.util.*;
import mrdev023.game.gamestate.*;
import mrdev023.gameEngine.*;
import mrdev023.math.*;
import mrdev023.rendering.gui.*;
import mrdev023.rendering.gui.action.*;
import mrdev023.world.*;
import org.lwjgl.input.*;
import org.lwjgl.opengl.*;
public class MainMenu implements GameInterface{
public ArrayList<GUI> guiList = new ArrayList<GUI>();
public MainMenu(){
GUI button = new ButtonGUI("SOLO",Display.getDisplayMode().getWidth()/2 - 100,Display.getDisplayMode().getHeight()/2 - 80,200,60);
button.setAction(new Action() {
public void manageAction(int action) {
if(action == GUI.CLICKED)GameEngine.changeGameState(GameState.SOLO_GAME);
}
public void hover(Vector2f position) {}
});
guiList.add(button);
guiList.add(new LabelGUI("Test Voxel v0.1", Display.getDisplayMode().getWidth()/2 - 100, Display.getDisplayMode().getHeight()/2 - 300, 200, 100));
}
public void render() {
}
public void update() {
for(GUI gui : guiList){
gui.updateAction();
}
}
public void renderGUI() {
glColor3f(0,0,0);
glPointSize(5);
glBegin(GL_POINTS);
glVertex2f(Mouse.getX(),Display.getDisplayMode().getHeight() - Mouse.getY());
glEnd();
for(GUI gui : guiList){
gui.render();
}
}
public void destroyGameState() {
}
public World getWorld() {
@ -30,7 +67,15 @@ public class MainMenu implements GameInterface{
}
public void updateKeyboard() {
while(Keyboard.next()){
if(Keyboard.getEventKeyState()){
if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE){
GameEngine.setRunning(false);
}
}else{
}
}
}
}

View file

@ -65,6 +65,7 @@ public class SoloGame extends Game implements GameInterface{
float s = 1;
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glDisable(GL_CULL_FACE);
glColor3f(1, 1, 1);
glLineWidth(2);
glBegin(GL_QUADS);
glVertex3f(x,y,z);

View file

@ -5,6 +5,7 @@ import java.util.concurrent.*;
import org.lwjgl.input.*;
import org.lwjgl.opengl.*;
import mrdev023.audio.*;
import mrdev023.game.*;
import mrdev023.game.gamestate.*;
import mrdev023.main.*;
@ -32,6 +33,7 @@ public class GameEngine {
Display.setDisplayMode(new DisplayMode(width, height));
Display.setResizable(true);
Display.create();
AudioManager.create();
Camera.initCamera();
Mouse.setGrabbed(true);
gameState = GameState.MAIN_MENU;
@ -104,6 +106,7 @@ public class GameEngine {
public static void destroy(){
gameState.destroyGameState();
AudioManager.destroy();
Display.destroy();
}

View file

@ -100,6 +100,8 @@ public class Color4f {
this.a = a;
}
public java.awt.Color toAwtColor(){
return new java.awt.Color(r, g, g, a);
}
}

View file

@ -30,6 +30,8 @@ public class Vector2f {
return new Vector2f(x,y);
}
public String toString(){
return x + " " + y;
}
}

View file

@ -4,6 +4,7 @@ import static org.lwjgl.util.glu.GLU.*;
import mrdev023.gameEngine.*;
import mrdev023.update.*;
import org.lwjgl.input.*;
import org.lwjgl.opengl.*;
import org.lwjgl.util.glu.*;
@ -47,10 +48,10 @@ public class DisplayManager {
* @Info Definie le mode d'affichage pour le rendu en 2d
*/
public static void preRender2D(){
glDisable(GL_CULL_FACE);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
GLU.gluOrtho2D(0, Display.getDisplayMode().getWidth(), Display
.getDisplayMode().getHeight(), 0);
glOrtho(0,Display.getDisplayMode().getWidth(),Display.getDisplayMode().getHeight(),0,-1,1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}

View file

@ -23,15 +23,6 @@ public abstract class World {
this.seed= seed;
this.octave = octave;
this.amplitude = amplitude;
for(int x = 0;x < SIZE;x++){
for(int y = 0;y < HEIGHT;y++){
for(int z = 0;z < SIZE;z++){
Chunk ch = new Chunk(x,y,z,this);
chunks.add(ch);
}
}
}
for(Chunk ch : chunks)ch.createChunk(this);
}
public static long updateWorldTime = 0;

View file

@ -38,7 +38,6 @@ public class Chunk {
public void createChunk(World world) {
this.world = world;
Main.addThread(new Generate(this, world),"Create Chunk");
IsCurrentGenerate = true;
}