Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

Commit

Permalink
Build-142: New features and physics.
Browse files Browse the repository at this point in the history
New Options Menu Background, New Slider for Menus, New Draw Distance
Selector, New Collision and Physics System.
  • Loading branch information
Guerra24 committed Dec 30, 2015
1 parent 01dfcf3 commit 815e709
Show file tree
Hide file tree
Showing 29 changed files with 369 additions and 89 deletions.
8 changes: 4 additions & 4 deletions assets/game/settings.conf
@@ -1,13 +1,13 @@
#Voxel Settings
#Mon Dec 28 20:22:57 CST 2015
#Wed Dec 30 17:22:27 CST 2015
UPS=30
VSYNC=false
useMotionBlur=false
useFXAA=false
DrawDistance=2
SettingsVersion=3
useVolumetricLight=true
useVolumetricLight=false
TESTXMOD=Hello Voxel
FPS=30
useDOF=false
useShadows=true
FPS=30
useShadows=false
Expand Up @@ -46,7 +46,7 @@ public class VoxelVariables {
public static final String apiVersion = "0.0.6";
public static final int apiVersionNum = 000006;
public static final String state = "ALPHA";
public static final int build = 141;
public static final int build = 142;
public static int FOV = 90;
public static int WIDTH = 1280;
public static int HEIGHT = 720;
Expand Down
Expand Up @@ -73,6 +73,7 @@ public void update(Voxel voxel, GlobalStates states, float delta) {
states.setState(states.getOldState());
}
}
gm.getMenuSystem().optionsMenu.update();
}

@Override
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/net/guerra24/voxel/client/menu/OptionsMenu.java
Expand Up @@ -36,19 +36,27 @@ public class OptionsMenu {
private Button shadowsButton;
private Button godraysButton;

private Slider slider;

private float xScale, yScale;

public OptionsMenu(GameResources gm) {
float width = VoxelVariables.WIDTH;
float height = VoxelVariables.HEIGHT;
yScale = height / 720f;
xScale = width / 1280f;
slider = new Slider(900 * xScale, 540 * yScale, 315 * xScale, 80 * yScale);
exitButton = new Button(new Vector2f(530 * xScale, 35 * yScale), new Vector2f(215 * xScale, 80 * yScale));
godraysButton = new Button(new Vector2f(32 * xScale, 560 * yScale), new Vector2f(215 * xScale, 80 * yScale));
shadowsButton = new Button(new Vector2f(32 * xScale, 460 * yScale), new Vector2f(215 * xScale, 80 * yScale));
dofButton = new Button(new Vector2f(32 * xScale, 360 * yScale), new Vector2f(215 * xScale, 80 * yScale));
}

public void update() {
slider.setPos(VoxelVariables.radius / 32f);
slider.update();
}

public void render() {
MenuRendering.renderWindow("Options", "Roboto-Bold", 20 * xScale, 20 * yScale, 1240 * xScale, 680 * yScale);
if (VoxelVariables.useVolumetricLight) {
Expand Down Expand Up @@ -80,8 +88,12 @@ public void render() {
}
MenuRendering.renderButton(null, "Back", "Roboto-Bold", 528 * xScale, 607 * yScale, 215 * xScale, 80 * yScale,
MenuRendering.rgba(255, 255, 255, 255, MenuRendering.colorA), exitButton.insideButton());
MenuRendering.renderLabel("Draw Distance: " + VoxelVariables.radius, "Roboto-Bold", 970 * xScale, 90 * yScale, 315 * xScale, 20 * yScale,
25f * yScale);
MenuRendering.renderLabel("Draw Distance: " + VoxelVariables.radius, "Roboto-Bold", 970 * xScale, 90 * yScale,
315 * xScale, 20 * yScale, 25f * yScale);
int r = (int) (slider.getPos() * 32f);
if (r < 2)
r = 2;
VoxelVariables.radius = r;
MenuRendering.renderSlider(VoxelVariables.radius / 32f, 900 * xScale, 100 * yScale, 315 * xScale, 80 * yScale);
}

Expand Down
33 changes: 33 additions & 0 deletions src/main/java/net/guerra24/voxel/client/menu/Slider.java
@@ -0,0 +1,33 @@
package net.guerra24.voxel.client.menu;

import net.guerra24.voxel.client.core.VoxelVariables;
import net.guerra24.voxel.client.input.Mouse;

public class Slider {

private float pos;
private float x, y, w, h;

public Slider(float x, float y, float w, float h) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
}

public void update() {
if (Mouse.getX() > x && Mouse.getX() < x + w && Mouse.getY() > y && Mouse.getY() < y + h
&& Mouse.isButtonDown(0)) {
pos = Mouse.getX() / w - 2.6f - 0.23f;
}
}

public void setPos(float pos) {
this.pos = pos;
}

public float getPos() {
return pos;
}

}
Expand Up @@ -51,9 +51,9 @@
import net.guerra24.voxel.client.sound.soundsystem.SoundSystemException;
import net.guerra24.voxel.client.sound.soundsystem.codecs.CodecJOgg;
import net.guerra24.voxel.client.util.Logger;
import net.guerra24.voxel.client.world.PhysicsSystem;
import net.guerra24.voxel.client.world.block.Block;
import net.guerra24.voxel.client.world.entities.Camera;
import net.guerra24.voxel.client.world.physics.PhysicsSystem;
import net.guerra24.voxel.universal.resources.UniversalResources;
import net.guerra24.voxel.universal.util.vector.Vector3f;

Expand Down
73 changes: 0 additions & 73 deletions src/main/java/net/guerra24/voxel/client/world/PhysicsSystem.java

This file was deleted.

Expand Up @@ -48,7 +48,7 @@
* @author Guerra24 <pablo230699@hotmail.com>
* @category World
*/
public abstract class Block {
public class Block {
/**
* Blocks Data
*/
Expand Down
Expand Up @@ -24,6 +24,8 @@

package net.guerra24.voxel.client.world.block;

import com.badlogic.gdx.math.collision.BoundingBox;

import net.guerra24.voxel.client.resources.models.WaterTile;
import net.guerra24.voxel.universal.util.vector.Vector3f;
import net.guerra24.voxel.universal.util.vector.Vector8f;
Expand All @@ -43,7 +45,9 @@ public abstract class IBlock {
public abstract Vector8f texCoordsRight();

public abstract Vector8f texCoordsLeft();


public abstract BoundingBox getBoundingBox(Vector3f pos);

/**
* Get the WaterTile of the Block
*
Expand Down
Expand Up @@ -24,6 +24,8 @@

package net.guerra24.voxel.client.world.block.types;

import com.badlogic.gdx.math.collision.BoundingBox;

import net.guerra24.voxel.client.resources.models.WaterTile;
import net.guerra24.voxel.client.world.block.BlockEntity;
import net.guerra24.voxel.client.world.block.IBlock;
Expand Down Expand Up @@ -82,4 +84,9 @@ public Vector8f texCoordsLeft() {
return null;
}

@Override
public BoundingBox getBoundingBox(Vector3f pos) {
return null;
}

}
Expand Up @@ -24,6 +24,9 @@

package net.guerra24.voxel.client.world.block.types;

import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.collision.BoundingBox;

import net.guerra24.voxel.client.resources.models.WaterTile;
import net.guerra24.voxel.client.world.block.BlockEntity;
import net.guerra24.voxel.client.world.block.BlocksResources;
Expand Down Expand Up @@ -82,4 +85,9 @@ public Vector8f texCoordsLeft() {
return BlocksResources.tessellatorTextureAtlas.getTextureCoords("DimOre");
}

@Override
public BoundingBox getBoundingBox(Vector3f pos) {
return new BoundingBox(new Vector3(pos.x, pos.y, pos.z), new Vector3(pos.x + 1, pos.y + 1, pos.z + 1));
}

}
Expand Up @@ -24,6 +24,9 @@

package net.guerra24.voxel.client.world.block.types;

import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.collision.BoundingBox;

import net.guerra24.voxel.client.resources.models.WaterTile;
import net.guerra24.voxel.client.world.block.BlockEntity;
import net.guerra24.voxel.client.world.block.BlocksResources;
Expand Down Expand Up @@ -83,4 +86,9 @@ public Vector8f texCoordsLeft() {
return BlocksResources.tessellatorTextureAtlas.getTextureCoords("Dirt");
}

@Override
public BoundingBox getBoundingBox(Vector3f pos) {
return new BoundingBox(new Vector3(pos.x, pos.y, pos.z), new Vector3(pos.x + 1, pos.y + 1, pos.z + 1));
}

}
Expand Up @@ -24,6 +24,9 @@

package net.guerra24.voxel.client.world.block.types;

import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.collision.BoundingBox;

import net.guerra24.voxel.client.resources.models.WaterTile;
import net.guerra24.voxel.client.world.block.BlockEntity;
import net.guerra24.voxel.client.world.block.BlocksResources;
Expand Down Expand Up @@ -83,4 +86,9 @@ public Vector8f texCoordsLeft() {
return BlocksResources.tessellatorTextureAtlas.getTextureCoords("Glass");
}

@Override
public BoundingBox getBoundingBox(Vector3f pos) {
return new BoundingBox(new Vector3(pos.x, pos.y, pos.z), new Vector3(pos.x + 1, pos.y + 1, pos.z + 1));
}

}
Expand Up @@ -24,6 +24,9 @@

package net.guerra24.voxel.client.world.block.types;

import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.collision.BoundingBox;

import net.guerra24.voxel.client.resources.models.WaterTile;
import net.guerra24.voxel.client.world.block.BlockEntity;
import net.guerra24.voxel.client.world.block.BlocksResources;
Expand Down Expand Up @@ -82,4 +85,9 @@ public Vector8f texCoordsRight() {
public Vector8f texCoordsLeft() {
return BlocksResources.tessellatorTextureAtlas.getTextureCoords("GoldOre");
}

@Override
public BoundingBox getBoundingBox(Vector3f pos) {
return new BoundingBox(new Vector3(pos.x, pos.y, pos.z), new Vector3(pos.x + 1, pos.y + 1, pos.z + 1));
}
}
Expand Up @@ -23,6 +23,9 @@

package net.guerra24.voxel.client.world.block.types;

import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.collision.BoundingBox;

import net.guerra24.voxel.client.resources.models.WaterTile;
import net.guerra24.voxel.client.world.block.BlockEntity;
import net.guerra24.voxel.client.world.block.BlocksResources;
Expand Down Expand Up @@ -82,4 +85,9 @@ public Vector8f texCoordsLeft() {
return BlocksResources.tessellatorTextureAtlas.getTextureCoords("GrassSide");
}

@Override
public BoundingBox getBoundingBox(Vector3f pos) {
return new BoundingBox(new Vector3(pos.x, pos.y, pos.z), new Vector3(pos.x + 1, pos.y + 1, pos.z + 1));
}

}
Expand Up @@ -24,6 +24,9 @@

package net.guerra24.voxel.client.world.block.types;

import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.collision.BoundingBox;

import net.guerra24.voxel.client.resources.models.WaterTile;
import net.guerra24.voxel.client.world.block.BlockEntity;
import net.guerra24.voxel.client.world.block.BlocksResources;
Expand Down Expand Up @@ -82,4 +85,9 @@ public Vector8f texCoordsRight() {
public Vector8f texCoordsLeft() {
return BlocksResources.tessellatorTextureAtlas.getTextureCoords("Ice");
}

@Override
public BoundingBox getBoundingBox(Vector3f pos) {
return new BoundingBox(new Vector3(pos.x, pos.y, pos.z), new Vector3(pos.x + 1, pos.y + 1, pos.z + 1));
}
}
Expand Up @@ -24,6 +24,9 @@

package net.guerra24.voxel.client.world.block.types;

import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.collision.BoundingBox;

import net.guerra24.voxel.client.resources.models.WaterTile;
import net.guerra24.voxel.client.world.block.BlockEntity;
import net.guerra24.voxel.client.world.block.BlocksResources;
Expand Down Expand Up @@ -82,4 +85,9 @@ public Vector8f texCoordsRight() {
public Vector8f texCoordsLeft() {
return BlocksResources.tessellatorTextureAtlas.getTextureCoords("Indes");
}

@Override
public BoundingBox getBoundingBox(Vector3f pos) {
return new BoundingBox(new Vector3(pos.x, pos.y, pos.z), new Vector3(pos.x + 1, pos.y + 1, pos.z + 1));
}
}

0 comments on commit 815e709

Please sign in to comment.