Add Ant compatibility

This commit is contained in:
MrDev023 2016-09-15 13:10:11 +02:00
parent 55fcb82edd
commit 84f1dca031
24 changed files with 375 additions and 348 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
bin/*
.project
.classpath
*.jar

3
.travis.yml Normal file
View file

@ -0,0 +1,3 @@
language: java
jdk:
- oraclejdk8

View file

@ -1,4 +1,8 @@
# First-Game-Lighting
Compile status: ![Status](https://travis-ci.org/mrdev023/First-Game-Lighting.svg?branch=master)
Ce projet est seulement a projet utiliser pour apprendre le forward rendering pour ensuite l'integrer dans mon moteur de jeu qui
sera conçus avec ces derniere technologie pour ensuite faire des jeux avec celui-ci.
![Image](https://pbs.twimg.com/media/Cc3DuwnWIAII5Zw.jpg:large)

38
build.xml Normal file
View file

@ -0,0 +1,38 @@
<project name="lwjgl-examples">
<property file="build.properties" />
<property name="src.dir" value="src" />
<property name="build.dir" value="bin"/>
<property name="lwjgl_jars.dir" value="./libs/"/>
<property name="lwjgl_natives.dir" value="./libs/"/>
<property name="build.sysclasspath" value="last"/>
<path id="my_cp">
<fileset dir="${lwjgl_jars.dir}" includes="lwjgl.jar"/>
</path>
<target name="compile">
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="my_cp"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="test" depends="compile">
<!--
fork="true" seems to be absolutely
necessary for the setting of java.library.path
to be effective.-->
<java fork="true" classname="fr/technicalgames/Main">
<classpath>
<path refid="my_cp"/>
<path location="${build.dir}"/>
</classpath>
<sysproperty key="java.library.path"
value="${lwjgl_natives.dir}"/>
</java>
</target>
</project>

BIN
libs/OpenAL.dll Normal file

Binary file not shown.

BIN
libs/OpenAL32.dll Normal file

Binary file not shown.

BIN
libs/glfw.dll Normal file

Binary file not shown.

BIN
libs/glfw32.dll Normal file

Binary file not shown.

BIN
libs/jemalloc.dll Normal file

Binary file not shown.

BIN
libs/jemalloc32.dll Normal file

Binary file not shown.

BIN
libs/libglfw.dylib Normal file

Binary file not shown.

BIN
libs/libglfw.so Normal file

Binary file not shown.

BIN
libs/libjemalloc.dylib Normal file

Binary file not shown.

BIN
libs/libjemalloc.so Normal file

Binary file not shown.

BIN
libs/liblwjgl.dylib Normal file

Binary file not shown.

BIN
libs/liblwjgl.so Normal file

Binary file not shown.

BIN
libs/libopenal.dylib Normal file

Binary file not shown.

BIN
libs/libopenal.so Normal file

Binary file not shown.

BIN
libs/lwjgl.dll Normal file

Binary file not shown.

BIN
libs/lwjgl32.dll Normal file

Binary file not shown.

View file

@ -42,7 +42,7 @@ public class Main {
};
// glfwSetErrorCallback(errorCallback);
if(glfwInit() != GL11.GL_TRUE)throw new Exception("GLFW not init");
if(glfwInit())throw new Exception("GLFW not init");
glfwDefaultWindowHints();
glfwWindowHint(GLFW_VISIBLE, GL11.GL_FALSE);
glfwWindowHint(GLFW_RESIZABLE, GL11.GL_FALSE);
@ -75,7 +75,7 @@ public class Main {
Camera.transform();
//------------------------------------------------------------------------------------
while(glfwWindowShouldClose(windowID) == GL11.GL_FALSE){
while(glfwWindowShouldClose(windowID)){
if(System.currentTimeMillis() - previousTicks >= 1000/60){//Update TICKS
glfwPollEvents();

View file

@ -1,9 +1,8 @@
package fr.technicalgames.audio;
import static org.lwjgl.openal.AL.createCapabilities;
import static org.lwjgl.openal.AL10.*;
import static org.lwjgl.openal.ALC10.*;
import static org.lwjgl.openal.ALC11.*;
import static org.lwjgl.openal.ALUtil.*;
import static org.lwjgl.stb.STBVorbis.*;
import static org.lwjgl.system.MemoryUtil.*;
@ -19,13 +18,13 @@ import org.lwjgl.openal.*;
import org.lwjgl.stb.STBVorbisInfo;
public abstract class Audio {
public class Audio {
//Variables global
//------------------------------------------------------
public static ALDevice device;
public static long device;
public static ALCCapabilities caps;
public static ALContext context;
public static long context;
public static final int INITIAL_STATE = 4113,PAUSED_STATE = 4115,STOPPED_STATE = 4116,PLAYING_STATE = 4114;
//------------------------------------------------------
@ -39,31 +38,17 @@ public abstract class Audio {
//Fonction global
//------------------------------------------------------
public static void create(){
device = ALDevice.create(null);
if ( device == null )
throw new IllegalStateException("Failed to open the default device.");
caps = device.getCapabilities();
System.out.println("---------------------------- Create Audio Device -------------------------------------");
System.out.println("OpenALC10: " + caps.OpenALC10);
System.out.println("OpenALC11: " + caps.OpenALC11);
System.out.println("caps.ALC_EXT_EFX = " + caps.ALC_EXT_EFX);
device = alcOpenDevice((ByteBuffer)null);
ALCCapabilities deviceCaps = ALC.createCapabilities(device);
String defaultDeviceSpecifier = alcGetString(0L, ALC_DEFAULT_DEVICE_SPECIFIER);
System.out.println("Default device: " + defaultDeviceSpecifier);
context = ALContext.create(device);
System.out.println("ALC_FREQUENCY: " + alcGetInteger(device.address(), ALC_FREQUENCY) + "Hz");
System.out.println("ALC_REFRESH: " + alcGetInteger(device.address(), ALC_REFRESH) + "Hz");
System.out.println("ALC_SYNC: " + (alcGetInteger(device.address(), ALC_SYNC) == ALC_TRUE));
System.out.println("ALC_MONO_SOURCES: " + alcGetInteger(device.address(), ALC_MONO_SOURCES));
System.out.println("ALC_STEREO_SOURCES: " + alcGetInteger(device.address(), ALC_STEREO_SOURCES));
System.out.println("---------------------------------------------------------------------------------------");
context = alcCreateContext(device, (IntBuffer)null);
alcMakeContextCurrent(context);
createCapabilities(deviceCaps);
}
public static void destroy(){
context.destroy();
device.destroy();
alcCloseDevice(device);
alcDestroyContext(context);
}
//------------------------------------------------------
@ -86,7 +71,6 @@ public abstract class Audio {
throw new Exception("Format not supported !");
}
alSourcei(source, AL_BUFFER, buffer);
checkALError();
int size = alGetBufferi(buffer,AL_SIZE);
int bits = alGetBufferi(buffer, AL_BITS);
int channels = alGetBufferi(buffer, AL_CHANNELS);
@ -193,20 +177,17 @@ public abstract class Audio {
stb_vorbis_seek_start(decoder);
int lengthSamples = stb_vorbis_stream_length_in_samples(decoder);
ByteBuffer pcm = BufferUtils.createByteBuffer(lengthSamples * 2 * channels);
ShortBuffer pcm = BufferUtils.createShortBuffer(lengthSamples * channels);
stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm, lengthSamples);
stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm);
stb_vorbis_close(decoder);
buffer = alGenBuffers();
checkALError();
source = alGenSources();
checkALError();
if(channels == 1)alBufferData(buffer, AL_FORMAT_MONO16, pcm, info.sample_rate());
else alBufferData(buffer, AL_FORMAT_STEREO16, pcm, info.sample_rate());
checkALError();
}
public void playSound(){

View file

@ -93,8 +93,8 @@ public class Input{
}
public static void destroy(){
mousePos.release();
scroll.release();
mousePos.free();
scroll.free();
}
public static void scroll(long window, double xoffset, double yoffset) {

View file

@ -51,7 +51,7 @@ public class Camera {
if(Input.isKey(GLFW.GLFW_KEY_SPACE)){
pos.y += speed;
}
if(Input.isKeyDown(GLFW_KEY_ESCAPE))glfwSetWindowShouldClose(Main.windowID, GL11.GL_TRUE);
if(Input.isKeyDown(GLFW_KEY_ESCAPE))glfwSetWindowShouldClose(Main.windowID, true);
if(Input.isButtonDown(0))glfwSetInputMode(Main.windowID, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
if(Input.isButtonDown(1))glfwSetInputMode(Main.windowID, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
}