feat: ajout de la fenêtre des options, suppression de la génération des pixmaps colorés (rouges), gestion des préférences.
This commit is contained in:
parent
f3f98d564f
commit
eefe31b17a
|
@ -61,6 +61,8 @@ public Menu(int tilesizex,int tilesizey) {
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Caméra pour tilemap:"+(tilesizex*size)+"x"+(tilesizey*size));
|
Gdx.app.debug(getClass().getSimpleName(),"Caméra pour tilemap:"+(tilesizex*size)+"x"+(tilesizey*size));
|
||||||
decx=-102f;
|
decx=-102f;
|
||||||
decy=-20f;
|
decy=-20f;
|
||||||
|
if (AssetLoader.ratio==1.44f)
|
||||||
|
decy-=24;
|
||||||
camera.translate(decx,decy);
|
camera.translate(decx,decy);
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Décalage:"+decx+"x"+decy);
|
Gdx.app.debug(getClass().getSimpleName(),"Décalage:"+decx+"x"+decy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Preferences;
|
import com.badlogic.gdx.Preferences;
|
||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.assets.loaders.SkinLoader;
|
import com.badlogic.gdx.assets.loaders.SkinLoader;
|
||||||
|
import com.badlogic.gdx.assets.loaders.TextureLoader;
|
||||||
import com.badlogic.gdx.audio.Music;
|
import com.badlogic.gdx.audio.Music;
|
||||||
import com.badlogic.gdx.audio.Sound;
|
import com.badlogic.gdx.audio.Sound;
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
|
@ -52,9 +53,10 @@ import fr.evolving.automata.Positiver_I;
|
||||||
import fr.evolving.automata.Positiver_II;
|
import fr.evolving.automata.Positiver_II;
|
||||||
import fr.evolving.automata.Positiver_III;
|
import fr.evolving.automata.Positiver_III;
|
||||||
import fr.evolving.automata.Transmuter;
|
import fr.evolving.automata.Transmuter;
|
||||||
|
import fr.evolving.screens.GameScreen;
|
||||||
|
|
||||||
public class AssetLoader {
|
public class AssetLoader {
|
||||||
public static Skin Skin_level;
|
public static Skin Skin_level,Skin_ui;
|
||||||
public static TextureAtlas Atlas_level;
|
public static TextureAtlas Atlas_level;
|
||||||
public static Texture Texture_fond;
|
public static Texture Texture_fond;
|
||||||
public static Texture Texture_fond2;
|
public static Texture Texture_fond2;
|
||||||
|
@ -66,8 +68,6 @@ public class AssetLoader {
|
||||||
public static String[] Typenames;
|
public static String[] Typenames;
|
||||||
public static int height;
|
public static int height;
|
||||||
public static float ratio;
|
public static float ratio;
|
||||||
public static boolean stretch=false;
|
|
||||||
public static Preferences prefs;
|
|
||||||
public static ScalingViewport viewport;
|
public static ScalingViewport viewport;
|
||||||
public static OrthographicCamera Camera;
|
public static OrthographicCamera Camera;
|
||||||
private static Texture emptyT;
|
private static Texture emptyT;
|
||||||
|
@ -79,63 +79,42 @@ public class AssetLoader {
|
||||||
public static Array<Transmuter> allTransmuter;
|
public static Array<Transmuter> allTransmuter;
|
||||||
public static TooltipManager Tooltipmanager;
|
public static TooltipManager Tooltipmanager;
|
||||||
public static I18NBundle french,usa,language;
|
public static I18NBundle french,usa,language;
|
||||||
|
public static TextureFilter quality;
|
||||||
public static void addstyle(TextureAtlas Atlas_level,String Name) {
|
|
||||||
AtlasRegion AnAtlasRegion = Atlas_level.findRegion(Name);
|
|
||||||
if (AnAtlasRegion==null) return;
|
|
||||||
TextureData ATextureData = AnAtlasRegion.getTexture().getTextureData();
|
|
||||||
ATextureData.prepare();
|
|
||||||
Pixmap Pixmap_Ori=ATextureData.consumePixmap();
|
|
||||||
Pixmap Pixmap_Over=new Pixmap(AnAtlasRegion.getRegionWidth(), AnAtlasRegion.getRegionHeight(), Pixmap.Format.RGBA8888);
|
|
||||||
Pixmap Pixmap_Disable=new Pixmap(AnAtlasRegion.getRegionWidth(), AnAtlasRegion.getRegionHeight(), Pixmap.Format.RGBA8888);
|
|
||||||
Pixmap Pixmap_Down=new Pixmap(AnAtlasRegion.getRegionWidth(), AnAtlasRegion.getRegionHeight(), Pixmap.Format.RGBA8888);
|
|
||||||
Color acolor;
|
|
||||||
for(int x=0; x < AnAtlasRegion.getRegionWidth(); x++)
|
|
||||||
{
|
|
||||||
for(int y =0; y < AnAtlasRegion.getRegionHeight(); y++)
|
|
||||||
{
|
|
||||||
acolor= new Color(Pixmap_Ori.getPixel(AnAtlasRegion.getRegionX()+x, AnAtlasRegion.getRegionY()+y));
|
|
||||||
Pixmap_Down.drawPixel(x, y,Color.rgba8888(acolor.a,0f,0f,acolor.a));
|
|
||||||
Pixmap_Disable.drawPixel(x, y, Color.rgba8888(acolor.r*0.352f,acolor.g*0.352f,acolor.b*0.352f,acolor.a));
|
|
||||||
Pixmap_Over.drawPixel(x, y, Color.rgba8888(acolor.r,acolor.g*0.2f,acolor.b*0.2f,acolor.a));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Atlas_level.addRegion(Name+"_disabled", new TextureRegion(new Texture(Pixmap_Disable)));
|
|
||||||
Atlas_level.addRegion(Name+"_over", new TextureRegion(new Texture(Pixmap_Over)));
|
|
||||||
Atlas_level.addRegion(Name+"_down", new TextureRegion(new Texture(Pixmap_Down)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void loadall() {
|
public static void loadall() {
|
||||||
|
TextureLoader.TextureParameter params = new TextureLoader.TextureParameter();
|
||||||
|
params.minFilter = quality;
|
||||||
|
params.magFilter = quality;
|
||||||
|
params.genMipMaps=(quality==TextureFilter.MipMap);
|
||||||
Gdx.app.debug("AssetLoader","Initialisation du asset manager");
|
Gdx.app.debug("AssetLoader","Initialisation du asset manager");
|
||||||
manager = new AssetManager();
|
manager = new AssetManager();
|
||||||
Gdx.app.debug("AssetLoader","Initialisation du chargement des éléments multimédia");
|
Gdx.app.debug("AssetLoader","Initialisation du chargement des éléments multimédia");
|
||||||
manager.load("textures/level.pack", TextureAtlas.class);
|
manager.load("textures/level.pack", TextureAtlas.class);
|
||||||
manager.load("pictures/fond.png", Texture.class);
|
manager.load("textures/ui.pack", TextureAtlas.class);
|
||||||
manager.load("pictures/fond2.png", Texture.class);
|
manager.load("pictures/fond.png", Texture.class,params);
|
||||||
|
manager.load("pictures/fond2.png", Texture.class,params);
|
||||||
manager.load("musics/intro.mp3", Music.class);
|
manager.load("musics/intro.mp3", Music.class);
|
||||||
|
manager.load("textures/level.json", Skin.class, new SkinLoader.SkinParameter("textures/level.pack"));
|
||||||
|
manager.load("textures/ui.json", Skin.class, new SkinLoader.SkinParameter("textures/ui.pack"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void finishall() {
|
public static void finishall() {
|
||||||
Gdx.app.debug("AssetLoader","Ajout des textures disabled,over et down");
|
Gdx.app.debug("AssetLoader","Attente fin chargement...");
|
||||||
Atlas_level = manager.get("textures/level.pack");
|
|
||||||
if (manager.isLoaded("textures/level.pack")) {
|
|
||||||
for(String toload: new String[]{"leveler0","leveler1","leveler2","leveler3","leveler4","arrows","arrows2","exit2","cout","tech","cycle","temp","nrj","rayon","logo2"})
|
|
||||||
addstyle(Atlas_level,toload);
|
|
||||||
}
|
|
||||||
Gdx.app.debug("AssetLoader","Chargement des skins et attente fin chargement");
|
|
||||||
manager.load("textures/level.json", Skin.class, new SkinLoader.SkinParameter("textures/level.pack"));
|
|
||||||
manager.finishLoading();
|
manager.finishLoading();
|
||||||
Gdx.app.debug("AssetLoader","Affectation des éléments multimédia");
|
Gdx.app.debug("AssetLoader","Affectation des éléments multimédia");
|
||||||
|
Atlas_level = manager.get("textures/level.pack");
|
||||||
intro = manager.get("musics/intro.mp3");
|
intro = manager.get("musics/intro.mp3");
|
||||||
Texture_fond = manager.get("pictures/fond.png");
|
Texture_fond = manager.get("pictures/fond.png");
|
||||||
Texture_fond.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
|
Texture_fond.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
|
||||||
|
Texture_fond.setFilter(quality, quality);
|
||||||
Texture_fond2 = manager.get("pictures/fond2.png");
|
Texture_fond2 = manager.get("pictures/fond2.png");
|
||||||
Texture_fond2.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
|
Texture_fond2.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
|
||||||
|
Texture_fond2.setFilter(quality, quality);
|
||||||
Skin_level = manager.get("textures/level.json");
|
Skin_level = manager.get("textures/level.json");
|
||||||
Skin_level.addRegions(Atlas_level);
|
Skin_ui = manager.get("textures/ui.json");
|
||||||
Gdx.app.debug("AssetLoader","Definition des constantes");
|
Gdx.app.debug("AssetLoader","Definition des constantes");
|
||||||
Levelcolors=new Color[5];
|
Levelcolors=new Color[5];
|
||||||
Levelcolors=new Color[]{AssetLoader.Skin_level.getColor("world1"),AssetLoader.Skin_level.getColor("world2"),AssetLoader.Skin_level.getColor("world3"),AssetLoader.Skin_level.getColor("world4"),AssetLoader.Skin_level.getColor("world5")};
|
Levelcolors=new Color[]{AssetLoader.Skin_level.getColor("world0"),AssetLoader.Skin_level.getColor("world1"),AssetLoader.Skin_level.getColor("world2"),AssetLoader.Skin_level.getColor("world3"),AssetLoader.Skin_level.getColor("world4")};
|
||||||
Typecolors=new Color[13];
|
Typecolors=new Color[13];
|
||||||
Typecolors=new Color[]{new Color(0,0,1f,1),new Color(0,0.6f,0,1),new Color(0.196f,0.803f,0.196f,1),new Color(0.5f,0.5f,0.5f,1),new Color(0.8f,0.8f,0.8f,1),new Color(0.6f,0,0,1),new Color(1f,0,0,1),new Color(0,0,0.6f,1),new Color(0,0,0.6f,1),new Color(0,0,0.6f,1),new Color(0,0,0.6f,1),new Color(0.294f,0.466f,0.615f,1),new Color(0.478f,0.192f,0.098f,1)};
|
Typecolors=new Color[]{new Color(0,0,1f,1),new Color(0,0.6f,0,1),new Color(0.196f,0.803f,0.196f,1),new Color(0.5f,0.5f,0.5f,1),new Color(0.8f,0.8f,0.8f,1),new Color(0.6f,0,0,1),new Color(1f,0,0,1),new Color(0,0,0.6f,1),new Color(0,0,0.6f,1),new Color(0,0,0.6f,1),new Color(0,0,0.6f,1),new Color(0.294f,0.466f,0.615f,1),new Color(0.478f,0.192f,0.098f,1)};
|
||||||
Typenames=new String[13];
|
Typenames=new String[13];
|
||||||
|
@ -143,7 +122,9 @@ public class AssetLoader {
|
||||||
Gdx.app.debug("AssetLoader","Création des tiles...");
|
Gdx.app.debug("AssetLoader","Création des tiles...");
|
||||||
tileSet = new TiledMapTileSet();
|
tileSet = new TiledMapTileSet();
|
||||||
Array<TextureAtlas.AtlasRegion> allregions=Atlas_level.getRegions();
|
Array<TextureAtlas.AtlasRegion> allregions=Atlas_level.getRegions();
|
||||||
|
Gdx.app.debug("AssetLoader",allregions.size+" régions disponibles");
|
||||||
for (int i=0;i<allregions.size;i++) {
|
for (int i=0;i<allregions.size;i++) {
|
||||||
|
allregions.get(i).getTexture().setFilter(quality, quality);
|
||||||
if (allregions.get(i).name.startsWith("sprite")) {
|
if (allregions.get(i).name.startsWith("sprite")) {
|
||||||
if (allregions.get(i).name.contains("#"))
|
if (allregions.get(i).name.contains("#"))
|
||||||
{
|
{
|
||||||
|
@ -208,6 +189,9 @@ public class AssetLoader {
|
||||||
FileHandle baseFileHandle = Gdx.files.internal("i18n/messages/messages");
|
FileHandle baseFileHandle = Gdx.files.internal("i18n/messages/messages");
|
||||||
usa = I18NBundle.createBundle(baseFileHandle, new Locale("en"));
|
usa = I18NBundle.createBundle(baseFileHandle, new Locale("en"));
|
||||||
french = I18NBundle.createBundle(baseFileHandle, new Locale("fr"));
|
french = I18NBundle.createBundle(baseFileHandle, new Locale("fr"));
|
||||||
|
if (Preference.prefs.getBoolean("Language"))
|
||||||
|
language=french;
|
||||||
|
else
|
||||||
language=usa;
|
language=usa;
|
||||||
I18NBundle.setExceptionOnMissingKey(true);
|
I18NBundle.setExceptionOnMissingKey(true);
|
||||||
}
|
}
|
||||||
|
@ -220,14 +204,6 @@ public class AssetLoader {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int setpref() {
|
|
||||||
prefs = Gdx.app.getPreferences("WireWorld - Evolving Games");
|
|
||||||
if (prefs.contains("log"))
|
|
||||||
return prefs.getInteger("log");
|
|
||||||
else
|
|
||||||
return Gdx.app.LOG_INFO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
Gdx.app.debug("AssetLoader","Initialisation de la résolution virtuelle...");
|
Gdx.app.debug("AssetLoader","Initialisation de la résolution virtuelle...");
|
||||||
int realWidth=Gdx.graphics.getWidth();
|
int realWidth=Gdx.graphics.getWidth();
|
||||||
|
@ -247,7 +223,7 @@ public class AssetLoader {
|
||||||
Camera = new OrthographicCamera(width,height);
|
Camera = new OrthographicCamera(width,height);
|
||||||
Camera.position.set(width/2, height/2, 0);
|
Camera.position.set(width/2, height/2, 0);
|
||||||
Camera.update();
|
Camera.update();
|
||||||
if (stretch) {
|
if (Preference.prefs.getInteger("Adaptation")==1) {
|
||||||
viewport = new StretchViewport(width,height);
|
viewport = new StretchViewport(width,height);
|
||||||
Gdx.app.debug("AssetLoader","Adaptation d'écran maximale, 'Aspect-Ratio' non conservé.");
|
Gdx.app.debug("AssetLoader","Adaptation d'écran maximale, 'Aspect-Ratio' non conservé.");
|
||||||
}
|
}
|
||||||
|
@ -259,11 +235,15 @@ public class AssetLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
|
Gdx.app.debug("AssetLoader","Réglage de la qualité des textures");
|
||||||
|
quality=GameScreen.quality.values()[Preference.prefs.getInteger("Quality")].getQuality();
|
||||||
Gdx.app.debug("AssetLoader","Chargements des éléments minimalistes");
|
Gdx.app.debug("AssetLoader","Chargements des éléments minimalistes");
|
||||||
Texture_logo = new Texture(Gdx.files.internal("pictures/logo.png"));
|
Texture_logo = new Texture(Gdx.files.internal("pictures/logo.png"),quality==TextureFilter.MipMap);
|
||||||
Texture_logo.setFilter(TextureFilter.Linear,TextureFilter.Linear);
|
Texture_logo.setFilter(quality,quality);
|
||||||
emptyT=new Texture(Gdx.files.internal("pictures/empty.png"));
|
emptyT=new Texture(Gdx.files.internal("pictures/empty.png"),quality==TextureFilter.MipMap);
|
||||||
fullT=new Texture(Gdx.files.internal("pictures/full.png"));
|
emptyT.setFilter(quality,quality);
|
||||||
|
fullT=new Texture(Gdx.files.internal("pictures/full.png"),quality==TextureFilter.MipMap);
|
||||||
|
fullT.setFilter(quality,quality);
|
||||||
empty=new NinePatch(new TextureRegion(emptyT,24,24),8,8,8,8);
|
empty=new NinePatch(new TextureRegion(emptyT,24,24),8,8,8,8);
|
||||||
full=new NinePatch(new TextureRegion(fullT,24,24),8,8,8,8);
|
full=new NinePatch(new TextureRegion(fullT,24,24),8,8,8,8);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package fr.evolving.assets;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.Preferences;
|
||||||
|
|
||||||
|
public class Preference {
|
||||||
|
public static Preferences prefs;
|
||||||
|
|
||||||
|
public static int init() {
|
||||||
|
prefs = Gdx.app.getPreferences("WireWorld - Evolving Games");
|
||||||
|
//debug();
|
||||||
|
//test();
|
||||||
|
if (prefs.contains("log"))
|
||||||
|
return prefs.getInteger("log");
|
||||||
|
else
|
||||||
|
return Gdx.app.LOG_INFO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void debug() {
|
||||||
|
Preference.prefs.putInteger("ResolutionX", 1280);
|
||||||
|
Preference.prefs.putInteger("ResolutionY", 720);
|
||||||
|
Preference.prefs.putBoolean("Fullscreen", false);
|
||||||
|
Preference.prefs.putBoolean("VSync", false);
|
||||||
|
Preference.prefs.putInteger("log", Gdx.app.LOG_DEBUG);
|
||||||
|
Gdx.app.setLogLevel(Gdx.app.LOG_DEBUG);
|
||||||
|
Preference.prefs.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void test() {
|
||||||
|
Preference.prefs.putInteger("ResolutionX", 1920);
|
||||||
|
Preference.prefs.putInteger("ResolutionY", 1080);
|
||||||
|
Preference.prefs.putBoolean("Fullscreen", true);
|
||||||
|
Preference.prefs.putBoolean("VSync", true);
|
||||||
|
Preference.prefs.putInteger("log", Gdx.app.LOG_INFO);
|
||||||
|
Gdx.app.setLogLevel(Gdx.app.LOG_INFO);
|
||||||
|
Preference.prefs.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -552,8 +552,160 @@ public class SaveObject {
|
||||||
true,
|
true,
|
||||||
new int[][]{{}});
|
new int[][]{{}});
|
||||||
|
|
||||||
|
thelevels[18]=new Level(
|
||||||
|
2,
|
||||||
|
1,
|
||||||
|
"test",
|
||||||
|
"C'est un test.",
|
||||||
|
"e0",
|
||||||
|
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
new int[]{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
38f,
|
||||||
|
740f,
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
new Grid(20,20),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
"",
|
||||||
|
false,
|
||||||
|
new int[][]{{2, 2}});
|
||||||
|
|
||||||
|
thelevels[19]=new Level(
|
||||||
|
2,
|
||||||
|
2,
|
||||||
|
"test",
|
||||||
|
"C'est un test.",
|
||||||
|
"e0",
|
||||||
|
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
new int[]{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
238f,
|
||||||
|
340f,
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
new Grid(20,20),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
"",
|
||||||
|
false,
|
||||||
|
new int[][]{});
|
||||||
|
|
||||||
|
|
||||||
|
thelevels[20]=new Level(
|
||||||
|
3,
|
||||||
|
1,
|
||||||
|
"test",
|
||||||
|
"C'est un test.",
|
||||||
|
"e0",
|
||||||
|
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
new int[]{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
38f,
|
||||||
|
740f,
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
new Grid(20,20),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
"",
|
||||||
|
false,
|
||||||
|
new int[][]{{3, 2}});
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
thelevels[21]=new Level(
|
||||||
|
3,
|
||||||
|
2,
|
||||||
|
"test",
|
||||||
|
"C'est un test.",
|
||||||
|
"e0",
|
||||||
|
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
new int[]{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
438f,
|
||||||
|
540f,
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
new Grid(20,20),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
"",
|
||||||
|
false,
|
||||||
|
new int[][]{});
|
||||||
|
|
||||||
|
thelevels[22]=new Level(
|
||||||
|
4,
|
||||||
|
1,
|
||||||
|
"test",
|
||||||
|
"C'est un test.",
|
||||||
|
"e0",
|
||||||
|
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
new int[]{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
38f,
|
||||||
|
740f,
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
new Grid(20,20),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
"",
|
||||||
|
false,
|
||||||
|
new int[][]{{4, 2}});
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
thelevels[23]=new Level(
|
||||||
|
4,
|
||||||
|
2,
|
||||||
|
"test",
|
||||||
|
"C'est un test.",
|
||||||
|
"e0",
|
||||||
|
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
new int[]{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
238f,
|
||||||
|
640f,
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
new Grid(20,20),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
99999,
|
||||||
|
"",
|
||||||
|
false,
|
||||||
|
new int[][]{});
|
||||||
|
|
||||||
return thelevels;
|
return thelevels;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,21 +6,20 @@ import com.badlogic.gdx.Gdx;
|
||||||
import fr.evolving.screens.GameScreen;
|
import fr.evolving.screens.GameScreen;
|
||||||
import fr.evolving.screens.SplashScreen;
|
import fr.evolving.screens.SplashScreen;
|
||||||
import fr.evolving.assets.AssetLoader;
|
import fr.evolving.assets.AssetLoader;
|
||||||
|
import fr.evolving.assets.Preference;
|
||||||
|
|
||||||
public class main extends Game {
|
public class main extends Game {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
Gdx.app.setLogLevel(AssetLoader.setpref());
|
Gdx.app.setLogLevel(Preference.init());
|
||||||
debug();
|
|
||||||
//test();
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Récupération de la résolution des préférences.");
|
Gdx.app.debug(getClass().getSimpleName(), "Récupération de la résolution des préférences.");
|
||||||
if (AssetLoader.prefs.getInteger("ResolutionX")>0 && AssetLoader.prefs.getInteger("ResolutionY")>0) {
|
if (Preference.prefs.getInteger("ResolutionX")>0 && Preference.prefs.getInteger("ResolutionY")>0) {
|
||||||
try {
|
try {
|
||||||
int ResolutionX=AssetLoader.prefs.getInteger("ResolutionX");
|
int ResolutionX=Preference.prefs.getInteger("ResolutionX");
|
||||||
int ResolutionY=AssetLoader.prefs.getInteger("ResolutionY");
|
int ResolutionY=Preference.prefs.getInteger("ResolutionY");
|
||||||
boolean Fullscreen=AssetLoader.prefs.getBoolean("Fullscreen");
|
boolean Fullscreen=Preference.prefs.getBoolean("Fullscreen");
|
||||||
boolean VSync=AssetLoader.prefs.getBoolean("VSync");
|
boolean VSync=Preference.prefs.getBoolean("VSync");
|
||||||
Gdx.graphics.setDisplayMode(ResolutionX, ResolutionY, Fullscreen);
|
Gdx.graphics.setDisplayMode(ResolutionX, ResolutionY, Fullscreen);
|
||||||
Gdx.graphics.setVSync(VSync);
|
Gdx.graphics.setVSync(VSync);
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
|
@ -37,26 +36,6 @@ public class main extends Game {
|
||||||
setScreen(new SplashScreen(this));
|
setScreen(new SplashScreen(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debug() {
|
|
||||||
AssetLoader.prefs.putInteger("ResolutionX", 1280);
|
|
||||||
AssetLoader.prefs.putInteger("ResolutionY", 720);
|
|
||||||
AssetLoader.prefs.putBoolean("Fullscreen", false);
|
|
||||||
AssetLoader.prefs.putBoolean("VSync", false);
|
|
||||||
AssetLoader.prefs.putInteger("log", Gdx.app.LOG_DEBUG);
|
|
||||||
Gdx.app.setLogLevel(Gdx.app.LOG_DEBUG);
|
|
||||||
AssetLoader.prefs.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void test() {
|
|
||||||
AssetLoader.prefs.putInteger("ResolutionX", 1920);
|
|
||||||
AssetLoader.prefs.putInteger("ResolutionY", 1080);
|
|
||||||
AssetLoader.prefs.putBoolean("Fullscreen", true);
|
|
||||||
AssetLoader.prefs.putBoolean("VSync", true);
|
|
||||||
AssetLoader.prefs.putInteger("log", Gdx.app.LOG_INFO);
|
|
||||||
Gdx.app.setLogLevel(Gdx.app.LOG_INFO);
|
|
||||||
AssetLoader.prefs.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|
|
@ -13,8 +13,10 @@ import com.badlogic.gdx.Graphics.DisplayMode;
|
||||||
import com.badlogic.gdx.InputMultiplexer;
|
import com.badlogic.gdx.InputMultiplexer;
|
||||||
import com.badlogic.gdx.InputProcessor;
|
import com.badlogic.gdx.InputProcessor;
|
||||||
import com.badlogic.gdx.Screen;
|
import com.badlogic.gdx.Screen;
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
|
import com.badlogic.gdx.graphics.Texture.TextureFilter;
|
||||||
import com.badlogic.gdx.input.GestureDetector;
|
import com.badlogic.gdx.input.GestureDetector;
|
||||||
import com.badlogic.gdx.maps.MapLayers;
|
import com.badlogic.gdx.maps.MapLayers;
|
||||||
import com.badlogic.gdx.maps.MapProperties;
|
import com.badlogic.gdx.maps.MapProperties;
|
||||||
|
@ -29,16 +31,22 @@ import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
|
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Slider;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextArea;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextArea;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Tooltip;
|
import com.badlogic.gdx.scenes.scene2d.ui.Tooltip;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
|
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
@ -54,6 +62,7 @@ import fr.evolving.UI.ButtonLevel;
|
||||||
import fr.evolving.UI.Objectives;
|
import fr.evolving.UI.Objectives;
|
||||||
import fr.evolving.UI.TouchMaptiles;
|
import fr.evolving.UI.TouchMaptiles;
|
||||||
import fr.evolving.assets.AssetLoader;
|
import fr.evolving.assets.AssetLoader;
|
||||||
|
import fr.evolving.assets.Preference;
|
||||||
import fr.evolving.automata.Level;
|
import fr.evolving.automata.Level;
|
||||||
import fr.evolving.automata.Positiver_I;
|
import fr.evolving.automata.Positiver_I;
|
||||||
import fr.evolving.automata.Positiver_II;
|
import fr.evolving.automata.Positiver_II;
|
||||||
|
@ -75,8 +84,15 @@ public class GameScreen implements Screen {
|
||||||
private GameRenderer Renderer;
|
private GameRenderer Renderer;
|
||||||
private float runTime;
|
private float runTime;
|
||||||
public Level level;
|
public Level level;
|
||||||
|
private Window winOptions;
|
||||||
private ImageButton[] Barre;
|
private ImageButton[] Barre;
|
||||||
private ImageButton info_up_nrj,info_up_temp,info_up_rayon,info_up_cycle,info_up_nrjval,info_up_tempval,info_up_rayonval,info_up_cycleval;
|
private CheckBox SetSound,SetVsynch,SetFullscreen,SetAnimation,Settuto,Setdebog,Setrefresh;
|
||||||
|
private Slider SetEffectvolume,SetMusicvolume;
|
||||||
|
private TextButton Setcancel,Setsave;
|
||||||
|
private SelectBox<resolutions> selResolution;
|
||||||
|
private SelectBox<quality> selTexturequal;
|
||||||
|
private SelectBox<adaptation> selAdaptscreen;
|
||||||
|
private ImageButton Setflag,info_up_nrj,info_up_temp,info_up_rayon,info_up_cycle,info_up_nrjval,info_up_tempval,info_up_rayonval,info_up_cycleval,SetFlag;
|
||||||
private ImageTextButton cycle,temp,nrj,rayon,cout,tech,research,info_cout,info_tech,info_research,info_activation;
|
private ImageTextButton cycle,temp,nrj,rayon,cout,tech,research,info_cout,info_tech,info_research,info_activation;
|
||||||
private ImageTextButton[] Barre2;
|
private ImageTextButton[] Barre2;
|
||||||
String[] tocreate={"run","stop","speed","separator","move","zoomp","zoomm","infos","separator","raz","save","levels","tree","exits","separator","screen","sound","tuto","settings","separator","stat"};
|
String[] tocreate={"run","stop","speed","separator","move","zoomp","zoomm","infos","separator","raz","save","levels","tree","exits","separator","screen","sound","tuto","settings","separator","stat"};
|
||||||
|
@ -92,6 +108,68 @@ public class GameScreen implements Screen {
|
||||||
private TextArea info_desc,tooltip;
|
private TextArea info_desc,tooltip;
|
||||||
public boolean unroll,mapexit;
|
public boolean unroll,mapexit;
|
||||||
public enum calling{mouseover,mouseclick,mousedrag,longpress,tap,taptap,zoom,fling,pan,pinch};
|
public enum calling{mouseover,mouseclick,mousedrag,longpress,tap,taptap,zoom,fling,pan,pinch};
|
||||||
|
public enum quality{
|
||||||
|
Bas("Bas", TextureFilter.Nearest ),
|
||||||
|
Moyen("Moyen", TextureFilter.MipMap),
|
||||||
|
Eleve("Eleve", TextureFilter.Linear)
|
||||||
|
;
|
||||||
|
private final String text;
|
||||||
|
private final TextureFilter aquality;
|
||||||
|
private quality(final String text, TextureFilter aquality) {
|
||||||
|
this.text = text;
|
||||||
|
this.aquality=aquality;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
public TextureFilter getQuality() {
|
||||||
|
return this.aquality;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
public enum adaptation {
|
||||||
|
fit("Aspect conserve"),
|
||||||
|
fill("Remplissage")
|
||||||
|
;
|
||||||
|
private final String text;
|
||||||
|
private adaptation(final String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public enum resolutions{
|
||||||
|
r1024_768("XGA (1024x768) 4:3",1024,768),
|
||||||
|
r1280_720("720p (1280x720) 16:9",1280,720),
|
||||||
|
r1280_768("WXGA (1280x768) 5:3",1280,768),
|
||||||
|
r1280_1024("SXGA (1280x1024) 5:4",1280,1024),
|
||||||
|
r1400_1050("SXGA+ (1400x1050) 4:3",1400,1050),
|
||||||
|
r1680_1050("WSXGA (1680x1050) 16:10",1680,1050),
|
||||||
|
r1600_1200("UXGA (1600x1200) 4:3",1600,1200),
|
||||||
|
r1920_1080("1080p (1920x1080) 16:9",1920,1080),
|
||||||
|
r1920_1200("WUXGA (1920x1200) 16:10",1920,1200),
|
||||||
|
rmax("resolution Native",0,0)
|
||||||
|
;
|
||||||
|
private final String text;
|
||||||
|
private final int resx,resy;
|
||||||
|
private resolutions(final String text,int resx,int resy) {
|
||||||
|
this.text = text;
|
||||||
|
this.resx=resx;
|
||||||
|
this.resy=resy;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
public int getResolutionX() {
|
||||||
|
return resx;
|
||||||
|
}
|
||||||
|
public int getResolutionY() {
|
||||||
|
return resy;
|
||||||
|
}
|
||||||
|
}
|
||||||
GestureDetector gesturedetector;
|
GestureDetector gesturedetector;
|
||||||
|
|
||||||
// This is the constructor, not the class declaration
|
// This is the constructor, not the class declaration
|
||||||
|
@ -100,7 +178,7 @@ public class GameScreen implements Screen {
|
||||||
table = new HorizontalGroup();
|
table = new HorizontalGroup();
|
||||||
table.bottom().padLeft(5f).padBottom(8f).space(10f);
|
table.bottom().padLeft(5f).padBottom(8f).space(10f);
|
||||||
table2 = new VerticalGroup();
|
table2 = new VerticalGroup();
|
||||||
table2.setPosition(AssetLoader.width, AssetLoader.height*2/3);
|
table2.setPosition(AssetLoader.width, AssetLoader.height-360);
|
||||||
table2.right();
|
table2.right();
|
||||||
table2.space(10f);
|
table2.space(10f);
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Création des elements primordiaux du screen (stage, renderer, table, level, world)");
|
Gdx.app.debug(getClass().getSimpleName(),"Création des elements primordiaux du screen (stage, renderer, table, level, world)");
|
||||||
|
@ -522,8 +600,10 @@ public class GameScreen implements Screen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
|
stage.act();
|
||||||
runTime += delta;
|
runTime += delta;
|
||||||
world.update(delta);
|
world.update(delta);
|
||||||
|
if (Preference.prefs.getBoolean("Refresh"))
|
||||||
fpsLabel.setText(Gdx.graphics.getFramesPerSecond()+"FPS");
|
fpsLabel.setText(Gdx.graphics.getFramesPerSecond()+"FPS");
|
||||||
Renderer.render(delta, runTime,0);
|
Renderer.render(delta, runTime,0);
|
||||||
stage_menu.draw();
|
stage_menu.draw();
|
||||||
|
@ -542,6 +622,9 @@ public class GameScreen implements Screen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
|
Gdx.app.debug(getClass().getSimpleName(),"Création de la fenêtre d'option");
|
||||||
|
Table Optiontable=Createoption();
|
||||||
|
stage.addActor(winOptions);
|
||||||
Gdx.app.log("*****","Affichage du niveau.");
|
Gdx.app.log("*****","Affichage du niveau.");
|
||||||
for (int i=0;i<Barre2.length;i++)
|
for (int i=0;i<Barre2.length;i++)
|
||||||
table2.addActor(Barre2[i]);
|
table2.addActor(Barre2[i]);
|
||||||
|
@ -562,11 +645,12 @@ public class GameScreen implements Screen {
|
||||||
stage_info.addActor(info_cout);
|
stage_info.addActor(info_cout);
|
||||||
stage_info.addActor(info_desc);
|
stage_info.addActor(info_desc);
|
||||||
stage_menu.addActor(map);
|
stage_menu.addActor(map);
|
||||||
//stage_tooltip.addActor(tooltip);
|
stage_tooltip.addActor(tooltip);
|
||||||
stage.addActor(objectives);
|
stage.addActor(objectives);
|
||||||
stage.addActor(buttonlevel);
|
stage.addActor(buttonlevel);
|
||||||
stage.addActor(rayon);
|
stage.addActor(rayon);
|
||||||
stage.addActor(nrj);
|
stage.addActor(nrj);
|
||||||
|
if (Preference.prefs.getBoolean("Refresh"))
|
||||||
stage.addActor(fpsLabel);
|
stage.addActor(fpsLabel);
|
||||||
stage.addActor(temp);
|
stage.addActor(temp);
|
||||||
stage.addActor(cycle);
|
stage.addActor(cycle);
|
||||||
|
@ -667,6 +751,9 @@ public class GameScreen implements Screen {
|
||||||
((ImageButton)caller).setChecked(AssetLoader.Tooltipmanager.enabled);
|
((ImageButton)caller).setChecked(AssetLoader.Tooltipmanager.enabled);
|
||||||
}
|
}
|
||||||
else if (caller.getName()=="settings") {
|
else if (caller.getName()=="settings") {
|
||||||
|
winOptions.setVisible(!winOptions.isVisible());
|
||||||
|
if (winOptions.isVisible())
|
||||||
|
readpref();
|
||||||
}
|
}
|
||||||
else if (caller.getName()=="flag") {
|
else if (caller.getName()=="flag") {
|
||||||
if (AssetLoader.language.getLocale().getDisplayName().contains("français"))
|
if (AssetLoader.language.getLocale().getDisplayName().contains("français"))
|
||||||
|
@ -798,4 +885,171 @@ public class GameScreen implements Screen {
|
||||||
stage.dispose();
|
stage.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Table Createoption() {
|
||||||
|
Table layer = new Table();
|
||||||
|
winOptions = new Window("Options", AssetLoader.Skin_ui);
|
||||||
|
winOptions.add(SettingsVideo()).row();
|
||||||
|
winOptions.add(SettingsAudio()).row();
|
||||||
|
winOptions.add(SettingsOther()).row();
|
||||||
|
winOptions.add(SettingsButtons()).pad(10, 0, 10, 0);
|
||||||
|
winOptions.setColor(1, 1, 1, 0.8f);
|
||||||
|
winOptions.setVisible(false);
|
||||||
|
winOptions.pack();
|
||||||
|
winOptions.setPosition(100, 250);
|
||||||
|
return winOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readpref() {
|
||||||
|
SetFullscreen.setChecked(Preference.prefs.getBoolean("Fullscreen"));
|
||||||
|
SetSound.setChecked(Preference.prefs.getBoolean("Sound"));
|
||||||
|
Settuto.setChecked(Preference.prefs.getBoolean("Tutorial"));
|
||||||
|
SetVsynch.setChecked(Preference.prefs.getBoolean("VSync"));
|
||||||
|
Setrefresh.setChecked(Preference.prefs.getBoolean("Refresh"));
|
||||||
|
SetAnimation.setChecked(Preference.prefs.getBoolean("Animation"));
|
||||||
|
Setflag.setChecked(Preference.prefs.getBoolean("Language"));
|
||||||
|
SetEffectvolume.setValue(Preference.prefs.getFloat("Effect"));
|
||||||
|
SetMusicvolume.setValue(Preference.prefs.getFloat("Music"));
|
||||||
|
selResolution.setSelectedIndex(Preference.prefs.getInteger("Resolution"));
|
||||||
|
selAdaptscreen.setSelectedIndex(Preference.prefs.getInteger("Adaptation"));
|
||||||
|
selTexturequal.setSelectedIndex(Preference.prefs.getInteger("Quality"));
|
||||||
|
Setdebog.setChecked(Preference.prefs.getInteger("log")==Gdx.app.LOG_DEBUG);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writepref() {
|
||||||
|
Preference.prefs.putInteger("ResolutionX", selResolution.getSelected().getResolutionX());
|
||||||
|
Preference.prefs.putInteger("ResolutionY", selResolution.getSelected().getResolutionY());
|
||||||
|
Preference.prefs.putInteger("Resolution", selResolution.getSelectedIndex());
|
||||||
|
Preference.prefs.putBoolean("Fullscreen", SetFullscreen.isChecked());
|
||||||
|
Preference.prefs.putBoolean("Sound", SetSound.isChecked());
|
||||||
|
Preference.prefs.putBoolean("Tutorial", Settuto.isChecked());
|
||||||
|
Preference.prefs.putBoolean("VSync", SetVsynch.isChecked());
|
||||||
|
Preference.prefs.putBoolean("Refresh", Setrefresh.isChecked());
|
||||||
|
Preference.prefs.putBoolean("Animation", SetAnimation.isChecked());
|
||||||
|
Preference.prefs.putBoolean("Language", Setflag.isChecked());
|
||||||
|
Preference.prefs.putFloat("Effect", SetEffectvolume.getValue());
|
||||||
|
Preference.prefs.putFloat("Music", SetMusicvolume.getValue());
|
||||||
|
Preference.prefs.putInteger("Adaptation", selAdaptscreen.getSelectedIndex());
|
||||||
|
Preference.prefs.putInteger("Quality", selTexturequal.getSelectedIndex());
|
||||||
|
if (Setdebog.isChecked())
|
||||||
|
Preference.prefs.putInteger("log", Gdx.app.LOG_DEBUG);
|
||||||
|
else
|
||||||
|
Preference.prefs.putInteger("log", Gdx.app.LOG_INFO);
|
||||||
|
Preference.prefs.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Table SettingsOther() {
|
||||||
|
Table table = new Table();
|
||||||
|
table.pad(10, 10, 0, 10);
|
||||||
|
table.add(new Label("Divers", AssetLoader.Skin_level, "Fluoxetine-25", Color.ORANGE)).colspan(3);
|
||||||
|
table.row();
|
||||||
|
table.columnDefaults(0).padRight(10);
|
||||||
|
table.columnDefaults(1).padRight(10);
|
||||||
|
Settuto = new CheckBox("Activation du tutoriel", AssetLoader.Skin_ui);
|
||||||
|
table.add(Settuto).left();
|
||||||
|
table.row();
|
||||||
|
Setdebog = new CheckBox("Mode debugage", AssetLoader.Skin_ui);
|
||||||
|
table.add(Setdebog).left();
|
||||||
|
table.row();
|
||||||
|
Setrefresh = new CheckBox("Afficher le rafraichissement", AssetLoader.Skin_ui);
|
||||||
|
table.add(Setrefresh).left();
|
||||||
|
table.row();
|
||||||
|
table.add(new Label("Choix de la langue", AssetLoader.Skin_ui, "default-font", Color.WHITE)).left();
|
||||||
|
Setflag=new ImageButton(AssetLoader.Skin_level,"Setflag");
|
||||||
|
table.add(Setflag);
|
||||||
|
table.row();
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Table SettingsVideo() {
|
||||||
|
Table table = new Table();
|
||||||
|
table.pad(10, 10, 0, 10);
|
||||||
|
table.add(new Label("Video", AssetLoader.Skin_level, "Fluoxetine-25", Color.ORANGE)).colspan(3);
|
||||||
|
table.row();
|
||||||
|
table.columnDefaults(0).padRight(10);
|
||||||
|
table.columnDefaults(1).padRight(10);
|
||||||
|
|
||||||
|
SetVsynch = new CheckBox("Synchronisation verticale", AssetLoader.Skin_ui);
|
||||||
|
table.add(SetVsynch).left();
|
||||||
|
Table tablev1 = new Table();
|
||||||
|
tablev1.add(new Label("Resolution:", AssetLoader.Skin_ui, "default-font", Color.WHITE)).left().row();
|
||||||
|
selResolution = new SelectBox<resolutions>(AssetLoader.Skin_ui);
|
||||||
|
selResolution.setItems(resolutions.values());
|
||||||
|
tablev1.add(selResolution).left().row();
|
||||||
|
table.add(tablev1).left();
|
||||||
|
table.row();
|
||||||
|
|
||||||
|
SetFullscreen = new CheckBox("Plein ecran", AssetLoader.Skin_ui);
|
||||||
|
table.add(SetFullscreen).left();
|
||||||
|
Table tablev2 = new Table();
|
||||||
|
tablev2.add(new Label("Remplissage de l'ecran:", AssetLoader.Skin_ui, "default-font", Color.WHITE)).left().row();
|
||||||
|
selAdaptscreen = new SelectBox<adaptation>(AssetLoader.Skin_ui);
|
||||||
|
selAdaptscreen.setItems(adaptation.values());
|
||||||
|
tablev2.add(selAdaptscreen).left().row();
|
||||||
|
table.add(tablev2).left();
|
||||||
|
table.row();
|
||||||
|
|
||||||
|
Table tablev3 = new Table();
|
||||||
|
tablev3.add(new Label("Qualite des textures:", AssetLoader.Skin_ui, "default-font", Color.WHITE)).left().row();
|
||||||
|
SetAnimation = new CheckBox("Activer les animations", AssetLoader.Skin_ui);
|
||||||
|
table.add(SetAnimation).left();
|
||||||
|
selTexturequal = new SelectBox<quality>(AssetLoader.Skin_ui);
|
||||||
|
selTexturequal.setItems(quality.values());
|
||||||
|
tablev3.add(selTexturequal).left().row();
|
||||||
|
table.add(tablev3).left();
|
||||||
|
table.row();
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Table SettingsAudio() {
|
||||||
|
Table table = new Table();
|
||||||
|
table.pad(10, 10, 0, 10);
|
||||||
|
table.add(new Label("Audio", AssetLoader.Skin_level, "Fluoxetine-25", Color.ORANGE)).colspan(3);
|
||||||
|
table.row();
|
||||||
|
table.columnDefaults(0).padRight(10);
|
||||||
|
table.columnDefaults(1).padRight(10);
|
||||||
|
SetSound = new CheckBox("Activation du son", AssetLoader.Skin_ui);
|
||||||
|
table.add(SetSound).left();
|
||||||
|
table.row();
|
||||||
|
table.add(new Label("Volume des effets", AssetLoader.Skin_ui));
|
||||||
|
SetEffectvolume = new Slider(0.0f, 1.0f, 0.1f, false, AssetLoader.Skin_ui);
|
||||||
|
table.add(SetEffectvolume).left();
|
||||||
|
table.row();
|
||||||
|
table.add(new Label("Volume de la musiques", AssetLoader.Skin_ui));
|
||||||
|
SetMusicvolume = new Slider(0.0f, 1.0f, 0.1f, false, AssetLoader.Skin_ui);
|
||||||
|
table.add(SetMusicvolume).left();
|
||||||
|
table.row();
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onSaveClicked() {
|
||||||
|
winOptions.setVisible(false);
|
||||||
|
writepref();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onCancelClicked() {
|
||||||
|
winOptions.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Table SettingsButtons() {
|
||||||
|
Table table = new Table();
|
||||||
|
table.pad(10, 10, 0, 10);
|
||||||
|
Setsave = new TextButton("Save", AssetLoader.Skin_ui);
|
||||||
|
table.add(Setsave).padRight(30);
|
||||||
|
Setsave.addListener(new ChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
|
onSaveClicked();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Setcancel = new TextButton("Cancel", AssetLoader.Skin_ui);
|
||||||
|
table.add(Setcancel);
|
||||||
|
Setcancel.addListener(new ChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
|
onCancelClicked();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return table;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue