Skip to content

Commit

Permalink
Mise à jour vers une version plus récente de base (dont les pages s…
Browse files Browse the repository at this point in the history
…ont quelque peu modifiées)
  • Loading branch information
PolariTOON committed Jan 24, 2020
1 parent e6c6dae commit 9679868
Show file tree
Hide file tree
Showing 129 changed files with 866 additions and 550 deletions.
30 changes: 15 additions & 15 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
<classpath>
<classpathentry kind="src" path="src">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="cn-haxVplat/res/natives"/>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="tgd-grave-et/sys/x86"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="res"/>
<classpathentry kind="lib" path="lib/ibxm.jar"/>
<classpathentry kind="lib" path="lib/jinput.jar"/>
<classpathentry kind="lib" path="lib/jnlp.jar"/>
<classpathentry kind="lib" path="lib/jogg-0.0.7.jar"/>
<classpathentry kind="lib" path="lib/jorbis-0.0.15.jar"/>
<classpathentry kind="lib" path="lib/lwjgl_util_applet.jar"/>
<classpathentry kind="lib" path="lib/lwjgl_util.jar"/>
<classpathentry kind="lib" path="lib/lwjgl.jar"/>
<classpathentry kind="lib" path="lib/natives-linux.jar"/>
<classpathentry kind="lib" path="lib/natives-mac.jar"/>
<classpathentry kind="lib" path="lib/natives-windows.jar"/>
<classpathentry kind="lib" path="lib/slick-examples.jar"/>
<classpathentry kind="lib" path="lib/slick.jar"/>
<classpathentry kind="lib" path="lib/tinylinepp.jar"/>
<classpathentry kind="lib" path="lib/common/ibxm.jar"/>
<classpathentry kind="lib" path="lib/common/jnlp.jar"/>
<classpathentry kind="lib" path="lib/common/jogg-0.0.7.jar"/>
<classpathentry kind="lib" path="lib/common/jorbis-0.0.15.jar"/>
<classpathentry kind="lib" path="lib/common/natives-linux.jar"/>
<classpathentry kind="lib" path="lib/common/natives-mac.jar"/>
<classpathentry kind="lib" path="lib/common/natives-windows.jar"/>
<classpathentry kind="lib" path="lib/common/slick-examples.jar"/>
<classpathentry kind="lib" path="lib/common/slick.jar"/>
<classpathentry kind="lib" path="lib/common/tinylinepp.jar"/>
<classpathentry kind="lib" path="lib/x86/jinput.jar"/>
<classpathentry kind="lib" path="lib/x86/lwjgl_util_applet.jar"/>
<classpathentry kind="lib" path="lib/x86/lwjgl_util.jar"/>
<classpathentry kind="lib" path="lib/x86/lwjgl.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/bin
/out
/tmp
/zip
/.idea
*.iml
*.log
*.zip
/*.idea
/*.iml
.DS_Store
Thumbs.db
2 changes: 1 addition & 1 deletion .project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>cn-haxVplatMulti</name>
<name>tgd-grave-et</name>
<comment></comment>
<projects>
</projects>
Expand Down
Binary file added lib/arm/jinput.jar
Binary file not shown.
Binary file added lib/arm/lwjgl.jar
Binary file not shown.
Binary file added lib/arm/lwjgl_util.jar
Binary file not shown.
Binary file added lib/arm/lwjgl_util_applet.jar
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
55 changes: 55 additions & 0 deletions make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@echo off
setlocal

if "%1"=="" (
echo Autostart
GOTO autostart
) else (
echo Parsing
GOTO loop
)

:autostart
if not exist "bin" (
echo Build
mkdir "bin"
javac -d bin -cp src;res;lib\common\*;lib\x86\* src\Main.java
)
goto RUN

:loop
if x%1 equ x goto done
goto checkParam

:paramError
echo %1 n'est pas une option valide
echo Usage: make.bat [build^|run^|clean...]
goto next

:next
shift /1
goto loop

:checkParam
if "%1" equ "build" goto BUILD
if "%1" equ "clean" goto CLEAN
if "%1" equ "run" goto RUN
goto paramError

:BUILD
echo Build
if not exist "bin" mkdir "bin"
javac -d bin -cp src;res;lib\common\*;lib\x86\* src\Main.java
GOTO next

:CLEAN
echo Clean
rmdir /Q /S bin
GOTO next

:RUN
echo Run
java -Djava.library.path=sys\x86 -cp bin;res;lib\common\*;lib\x86\* Main
GOTO next

:done
45 changes: 33 additions & 12 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
build:
mkdir -p bin
javac -d bin -cp src:res:lib/* src/Main.java
javac -d bin -cp src:res:lib/common/*:lib/x86/* src/Main.java

run:
java -cp bin:res:lib/* -Djava.library.path=res/natives Main
java -Djava.library.path=sys/x86 -cp bin:res:lib/common/*:lib/x86/* Main

run-arm:
java -Djava.library.path=sys/arm -cp bin:res:lib/common/*:lib/arm/* Main

archive:
$(eval NAME := $(shell basename $(CURDIR)))
mkdir -p tmp
mkdir -p tmp/x86
mkdir -p tmp/arm
jar cfm tmp/x86/$(NAME).jar .mf -C bin . -C res .
cp tmp/x86/$(NAME).jar tmp/arm/$(NAME).jar
cp sys/x86/* tmp/x86
cp sys/arm/* tmp/arm
cp lib/common/* tmp/x86
cp lib/common/* tmp/arm
cp lib/arm/* tmp/arm
cp lib/x86/* tmp/x86
echo "#/bin/sh\njava -Djava.library.path=. -jar $(NAME).jar" > tmp/x86/$(NAME).sh
cp tmp/x86/$(NAME).sh tmp/arm/$(NAME).sh
echo "java -Djava.library.path=. -jar $(NAME).jar" > tmp/x86/$(NAME).bat
chmod u+x tmp/x86/$(NAME).sh
chmod u+x tmp/arm/$(NAME).sh
chmod u+x tmp/x86/$(NAME).bat
mkdir -p zip
cp res/natives/* zip
cp lib/* zip
jar cfm zip/main.jar .mf -C bin . -C res .
echo "#/bin/sh\njava -Djava.library.path=. -jar main.jar" > zip/main.sh
echo "java -Djava.library.path=. -jar main.jar" > zip/main.bat
chmod u+x zip/main.sh
chmod u+x zip/main.bat
zip main.zip zip/*
cd tmp/x86; zip ../../zip/$(NAME)-x86.zip *
cd tmp/arm; zip ../../zip/$(NAME)-arm.zip *

exec:
java -Djava.library.path=zip -jar zip/main.jar
$(eval NAME := $(shell basename $(CURDIR)))
java -Djava.library.path=tmp/x86 -jar tmp/x86/$(NAME).jar

exec-arm:
$(eval NAME := $(shell basename $(CURDIR)))
java -Djava.library.path=tmp/arm -jar tmp/arm/$(NAME).jar

clean:
rm -r -f bin/*
rm -r -f tmp/*
rm -r -f zip/*

.PHONY: build run archive exec clean
.PHONY: build run run-arm archive exec exec-arm clean
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added res/images/icon.png
Binary file modified res/images/logo.png
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 29 additions & 22 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -1,62 +1,69 @@
import java.awt.DisplayMode;
import java.awt.GraphicsEnvironment;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

import app.AppLoader;

public final class Main {

public static final void main (String [] arguments) throws SlickException {
String title = "CN-20-10";
public static final void main(String[] arguments) throws SlickException {
String title = "Grave-ET";
int width = 1280;
int height = 720;
boolean fullscreen = false;
String request = "Voulez-vous jouer en plein écran ?";
String [] options = {
String[] options = new String[] {
"Oui",
"Non"
};
int returnValue = JOptionPane.showOptionDialog (
null,
JFrame frame = new JFrame();
frame.setIconImage(AppLoader.loadIcon("/images/icon.png").getImage());
int returnValue = JOptionPane.showOptionDialog(
frame,
request,
title,
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options [0]
options[0]
);
frame.dispose();
if (returnValue == -1) {
return;
}
if (returnValue == 0) {
DisplayMode display = GraphicsEnvironment.getLocalGraphicsEnvironment ().getDefaultScreenDevice ().getDisplayMode ();
width = display.getWidth ();
height = display.getHeight ();
DisplayMode display = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode();
width = display.getWidth();
height = display.getHeight();
fullscreen = true;
}
StateBasedGame game = new StateBasedGame (title) {
StateBasedGame game = new StateBasedGame(title) {

@Override
public void initStatesList (GameContainer container) {
this.addState (new pages.Welcome (0));
this.addState (new pages.Choice (1));
this.addState (new pages.Pause (2));
this.addState (new graveEt.World (3));
this.addState (new pages.Death (4));
this.addState (new pages.Rules (5));
public void initStatesList(GameContainer container) {
this.addState(new pages.Welcome(0));
this.addState(new pages.Choice(1));
this.addState(new pages.Pause(2));
this.addState(new pages.Rules(3));
this.addState(new pages.Death(4));
this.addState(new games.graveEt.World(5));
}

};
AppGameContainer container = new AppGameContainer (game, width, height, fullscreen);
container.setTargetFrameRate (60);
container.setVSync (true);
container.setShowFPS (false);
container.start ();
AppGameContainer container = new AppGameContainer(game, width, height, fullscreen);
container.setTargetFrameRate(60);
container.setVSync(true);
container.setShowFPS(false);
container.setIcon(AppLoader.resolve("/images/icon.png"));
container.start();
}

}
54 changes: 27 additions & 27 deletions src/app/AppAudio.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,69 +11,69 @@ public class AppAudio implements Audio {
private String filename;
private Audio resource;

public AppAudio (String filename, InputStream stream) throws Exception {
public AppAudio(String filename, InputStream stream) throws Exception {
try {
this.resource = SoundStore.get ().getOgg (stream);
this.resource = SoundStore.get().getOgg(stream);
} catch (Exception error) {}
if (this.resource == null) {
try {
this.resource = SoundStore.get ().getWAV (stream);
this.resource = SoundStore.get().getWAV(stream);
} catch (Exception error) {}
}
if (this.resource == null) {
try {
this.resource = SoundStore.get ().getAIF (stream);
this.resource = SoundStore.get().getAIF(stream);
} catch (Exception error) {}
}
if (this.resource == null) {
this.resource = SoundStore.get ().getMOD (stream);
this.resource = SoundStore.get().getMOD(stream);
}
this.setFilename (filename);
this.setFilename(filename);
}

public AppAudio (String filename) {
this.resource = new NullAudio ();
this.setFilename (filename);
public AppAudio(String filename) {
this.resource = new NullAudio();
this.setFilename(filename);
}

private void setFilename (String filename) {
private void setFilename(String filename) {
this.filename = filename;
}

public String getFilename () {
public String getFilename() {
return this.filename;
}

public int getBufferID () {
return this.resource.getBufferID ();
public int getBufferID() {
return this.resource.getBufferID();
}

public float getPosition () {
return this.resource.getPosition ();
public float getPosition() {
return this.resource.getPosition();
}

public boolean isPlaying () {
return this.resource.isPlaying ();
public boolean isPlaying() {
return this.resource.isPlaying();
}

public int playAsMusic (float pitch, float gain, boolean loop) {
return this.resource.playAsMusic (pitch, gain, loop);
public int playAsMusic(float pitch, float gain, boolean loop) {
return this.resource.playAsMusic(pitch, gain, loop);
}

public int playAsSoundEffect (float pitch, float gain, boolean loop) {
return this.resource.playAsSoundEffect (pitch, gain, loop);
public int playAsSoundEffect(float pitch, float gain, boolean loop) {
return this.resource.playAsSoundEffect(pitch, gain, loop);
}

public int playAsSoundEffect (float pitch, float gain, boolean loop, float x, float y, float z) {
return this.resource.playAsSoundEffect (pitch, gain, loop, x, y, z);
public int playAsSoundEffect(float pitch, float gain, boolean loop, float x, float y, float z) {
return this.resource.playAsSoundEffect(pitch, gain, loop, x, y, z);
}

public boolean setPosition (float position) {
return this.resource.setPosition (position);
public boolean setPosition(float position) {
return this.resource.setPosition(position);
}

public void stop () {
this.resource.stop ();
public void stop() {
this.resource.stop();
}

}
Loading

0 comments on commit 9679868

Please sign in to comment.