p
This commit is contained in:
parent
be325c87c6
commit
1ded694712
9 changed files with 62 additions and 17 deletions
|
@ -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/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-4.0.0.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jna-platform-3.4.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"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,24 +1,61 @@
|
||||||
package mrdev023.game;
|
package mrdev023.game;
|
||||||
|
|
||||||
|
import static org.lwjgl.opengl.GL11.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
import mrdev023.game.gamestate.*;
|
import mrdev023.game.gamestate.*;
|
||||||
|
import mrdev023.gameEngine.*;
|
||||||
|
import mrdev023.math.*;
|
||||||
|
import mrdev023.rendering.gui.*;
|
||||||
|
import mrdev023.rendering.gui.action.*;
|
||||||
import mrdev023.world.*;
|
import mrdev023.world.*;
|
||||||
|
|
||||||
|
import org.lwjgl.input.*;
|
||||||
|
import org.lwjgl.opengl.*;
|
||||||
|
|
||||||
public class MainMenu implements GameInterface{
|
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 render() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
|
for(GUI gui : guiList){
|
||||||
|
gui.updateAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderGUI() {
|
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 void destroyGameState() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
|
@ -30,7 +67,15 @@ public class MainMenu implements GameInterface{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateKeyboard() {
|
public void updateKeyboard() {
|
||||||
|
while(Keyboard.next()){
|
||||||
|
if(Keyboard.getEventKeyState()){
|
||||||
|
if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE){
|
||||||
|
GameEngine.setRunning(false);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class SoloGame extends Game implements GameInterface{
|
||||||
float s = 1;
|
float s = 1;
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
|
glColor3f(1, 1, 1);
|
||||||
glLineWidth(2);
|
glLineWidth(2);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glVertex3f(x,y,z);
|
glVertex3f(x,y,z);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.concurrent.*;
|
||||||
import org.lwjgl.input.*;
|
import org.lwjgl.input.*;
|
||||||
import org.lwjgl.opengl.*;
|
import org.lwjgl.opengl.*;
|
||||||
|
|
||||||
|
import mrdev023.audio.*;
|
||||||
import mrdev023.game.*;
|
import mrdev023.game.*;
|
||||||
import mrdev023.game.gamestate.*;
|
import mrdev023.game.gamestate.*;
|
||||||
import mrdev023.main.*;
|
import mrdev023.main.*;
|
||||||
|
@ -32,6 +33,7 @@ public class GameEngine {
|
||||||
Display.setDisplayMode(new DisplayMode(width, height));
|
Display.setDisplayMode(new DisplayMode(width, height));
|
||||||
Display.setResizable(true);
|
Display.setResizable(true);
|
||||||
Display.create();
|
Display.create();
|
||||||
|
AudioManager.create();
|
||||||
Camera.initCamera();
|
Camera.initCamera();
|
||||||
Mouse.setGrabbed(true);
|
Mouse.setGrabbed(true);
|
||||||
gameState = GameState.MAIN_MENU;
|
gameState = GameState.MAIN_MENU;
|
||||||
|
@ -104,6 +106,7 @@ public class GameEngine {
|
||||||
|
|
||||||
public static void destroy(){
|
public static void destroy(){
|
||||||
gameState.destroyGameState();
|
gameState.destroyGameState();
|
||||||
|
AudioManager.destroy();
|
||||||
Display.destroy();
|
Display.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,8 @@ public class Color4f {
|
||||||
this.a = a;
|
this.a = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public java.awt.Color toAwtColor(){
|
||||||
|
return new java.awt.Color(r, g, g, a);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ public class Vector2f {
|
||||||
return new Vector2f(x,y);
|
return new Vector2f(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString(){
|
||||||
|
return x + " " + y;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@ import static org.lwjgl.util.glu.GLU.*;
|
||||||
import mrdev023.gameEngine.*;
|
import mrdev023.gameEngine.*;
|
||||||
import mrdev023.update.*;
|
import mrdev023.update.*;
|
||||||
|
|
||||||
|
import org.lwjgl.input.*;
|
||||||
import org.lwjgl.opengl.*;
|
import org.lwjgl.opengl.*;
|
||||||
import org.lwjgl.util.glu.*;
|
import org.lwjgl.util.glu.*;
|
||||||
|
|
||||||
|
@ -47,10 +48,10 @@ public class DisplayManager {
|
||||||
* @Info Definie le mode d'affichage pour le rendu en 2d
|
* @Info Definie le mode d'affichage pour le rendu en 2d
|
||||||
*/
|
*/
|
||||||
public static void preRender2D(){
|
public static void preRender2D(){
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
GLU.gluOrtho2D(0, Display.getDisplayMode().getWidth(), Display
|
glOrtho(0,Display.getDisplayMode().getWidth(),Display.getDisplayMode().getHeight(),0,-1,1);
|
||||||
.getDisplayMode().getHeight(), 0);
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,6 @@ public abstract class World {
|
||||||
this.seed= seed;
|
this.seed= seed;
|
||||||
this.octave = octave;
|
this.octave = octave;
|
||||||
this.amplitude = amplitude;
|
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;
|
public static long updateWorldTime = 0;
|
||||||
|
|
|
@ -38,7 +38,6 @@ public class Chunk {
|
||||||
|
|
||||||
public void createChunk(World world) {
|
public void createChunk(World world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
|
||||||
Main.addThread(new Generate(this, world),"Create Chunk");
|
Main.addThread(new Generate(this, world),"Create Chunk");
|
||||||
IsCurrentGenerate = true;
|
IsCurrentGenerate = true;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue