feat: changement de place des élément du monde n°1 changement du placement des objets en général ajout de l'application du ratio quand usage d'écran 4/3 utilisation de bouton pour les éléments cout & tech mutualisation des textures atlas

This commit is contained in:
Nicolas Hordé 2015-06-18 02:58:50 +02:00
parent c1057f706d
commit 7c67731fc8
6 changed files with 52 additions and 49 deletions

View File

@ -34,10 +34,10 @@ public class ButtonLevel extends ImageTextButton {
Locked=AssetLoader.Skin_level.getAtlas().findRegion("locked"); Locked=AssetLoader.Skin_level.getAtlas().findRegion("locked");
} }
this.setColor(1f, 0.47f+(float)level.X/1024f*0.529f,0.607f+(float)level.X/768f*0.392f, 1f); this.setColor(1f, 0.47f+(float)level.X/1024f*0.529f,0.607f+(float)level.X/768f*0.392f, 1f);
this.setBounds(level.X, level.Y, 111, 125); this.setBounds(level.X, level.Y*AssetLoader.ratio, 111, 125);
Thelabel=new Label(level.Element, AssetLoader.Skin_level,"Levelshort"); Thelabel=new Label(level.Element, AssetLoader.Skin_level,"Levelshort");
Thelabel.setColor(level.X/1024f,level.X/1024f,level.X/1024f,1f); Thelabel.setColor(level.X/1024f,level.X/1024f,level.X/1024f,1f);
Thelabel.setPosition(level.X+54, level.Y+20, Align.bottom | Align.center); Thelabel.setPosition(level.X+54, level.Y*AssetLoader.ratio+20, Align.bottom | Align.center);
} }
public Color getLevelcolor() { public Color getLevelcolor() {
@ -48,10 +48,10 @@ public class ButtonLevel extends ImageTextButton {
public void draw(Batch batch, float parentAlpha) { public void draw(Batch batch, float parentAlpha) {
super.draw(batch, parentAlpha); super.draw(batch, parentAlpha);
if (level.Special) { if (level.Special) {
batch.draw(Finalled,level.X,level.Y); batch.draw(Finalled,level.X,level.Y*AssetLoader.ratio);
} }
if (!Activated) { if (!Activated) {
batch.draw(Locked,level.X+this.getWidth()-Locked.getRegionWidth(),level.Y+this.getHeight()-Locked.getRegionWidth()); batch.draw(Locked,level.X+this.getWidth()-Locked.getRegionWidth(),level.Y*AssetLoader.ratio+this.getHeight()-Locked.getRegionWidth());
} }
Thelabel.draw(batch, 1f); Thelabel.draw(batch, 1f);
} }

View File

@ -68,7 +68,6 @@ public class AssetLoader {
Texture_fond2 = new Texture(Gdx.files.internal("pictures/fond2.png")); Texture_fond2 = new Texture(Gdx.files.internal("pictures/fond2.png"));
Texture_fond2.setWrap(TextureWrap.Repeat, TextureWrap.Repeat); Texture_fond2.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
Atlas_level= new TextureAtlas(Gdx.files.internal("textures/level.pack")); Atlas_level= new TextureAtlas(Gdx.files.internal("textures/level.pack"));
Atlas_game = new TextureAtlas(Gdx.files.internal("textures/game.pack"));
for(int i=0; i < 5; i++) for(int i=0; i < 5; i++)
addstyle(Atlas_level,"leveler"+String.valueOf(i)); addstyle(Atlas_level,"leveler"+String.valueOf(i));
addstyle(Atlas_level,"arrows"); addstyle(Atlas_level,"arrows");
@ -95,7 +94,7 @@ public class AssetLoader {
width=1920; width=1920;
height=1080; height=1080;
if (Math.abs(16f/9f-realRatio)>Math.abs(4f/3f-realRatio)) { if (Math.abs(16f/9f-realRatio)>Math.abs(4f/3f-realRatio)) {
ratio=4/3; ratio=1.44f;
Gdx.app.debug("AssetLoader","Ratio 4/3, résolution virtuelle : 1920x1440."); Gdx.app.debug("AssetLoader","Ratio 4/3, résolution virtuelle : 1920x1440.");
height=1440; height=1440;
} }

View File

@ -109,7 +109,7 @@ public class SaveObject {
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 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}, new int[]{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
38f, 38f,
450f, 740f,
-1, -1,
0, 0,
new Grid(20,20), new Grid(20,20),
@ -134,7 +134,7 @@ public class SaveObject {
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 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}, new int[]{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
38f, 38f,
200, 260f,
-1, -1,
0, 0,
new Grid(20,20), new Grid(20,20),
@ -159,7 +159,7 @@ public class SaveObject {
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 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}, new int[]{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
180f, 180f,
300f, 460f,
-1, -1,
15, 15,
new Grid(20,20), new Grid(20,20),
@ -184,8 +184,8 @@ public class SaveObject {
"e+", "e+",
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[]{0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0},
330f, 380f,
350f, 550f,
0, 0,
16, 16,
new Grid(20,20), new Grid(20,20),
@ -209,8 +209,8 @@ public class SaveObject {
"E-", "E-",
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[]{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
490f, 590f,
380f, 550f,
0, 0,
16, 16,
new Grid(20,20), new Grid(20,20),
@ -234,8 +234,8 @@ public class SaveObject {
"e0", "e0",
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[]{0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0},
490f, 590f,
200f, 220f,
1, 1,
136, 136,
new Grid(20,20), new Grid(20,20),
@ -259,8 +259,8 @@ public class SaveObject {
"eX", "eX",
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[]{0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0},
640f, 790f,
200f, 220f,
2, 2,
230, 230,
new Grid(20,20), new Grid(20,20),
@ -285,8 +285,8 @@ public class SaveObject {
"p", "p",
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2},
800f, 950f,
290f, 400f,
2, 2,
370, 370,
new Grid(20,20), new Grid(20,20),
@ -310,8 +310,8 @@ public class SaveObject {
"H", "H",
new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[]{0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, new int[]{0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1},
900f, 1050f,
450f, 740f,
3, 3,
750, 750,
new Grid(20,20), new Grid(20,20),

View File

@ -38,8 +38,8 @@ public class main extends Game {
} }
public void debug() { public void debug() {
AssetLoader.prefs.putInteger("ResolutionX", 640); AssetLoader.prefs.putInteger("ResolutionX", 1024);
AssetLoader.prefs.putInteger("ResolutionY", 200); AssetLoader.prefs.putInteger("ResolutionY", 768);
AssetLoader.prefs.putBoolean("Fullscreen", false); AssetLoader.prefs.putBoolean("Fullscreen", false);
AssetLoader.prefs.putBoolean("VSync", false); AssetLoader.prefs.putBoolean("VSync", false);
AssetLoader.prefs.putInteger("log", Gdx.app.LOG_DEBUG); AssetLoader.prefs.putInteger("log", Gdx.app.LOG_DEBUG);

View File

@ -39,7 +39,7 @@ public class LevelScreen implements Screen {
private TimerTask ScrollTask; private TimerTask ScrollTask;
private Stage stage; private Stage stage;
private Table table; private Table table;
private ImageButton Previous,Next,Exit; private ImageButton Previous,Next,Exit,cout,tech;
private TextButton buttonPlay,buttonExit; private TextButton buttonPlay,buttonExit;
private Level[] thelevels; private Level[] thelevels;
private TextArea TextDescriptive; private TextArea TextDescriptive;
@ -73,12 +73,12 @@ public class LevelScreen implements Screen {
ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30); ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30);
TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level,"Descriptif"); TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level,"Descriptif");
TextDescriptive.setBounds(15, 15, 1009, 130); TextDescriptive.setBounds(15, 15, 1009, 130);
buttonPlay = new TextButton("Jouer", AssetLoader.Skin_level,"Bouton"); buttonPlay = new TextButton("Connexions", AssetLoader.Skin_level,"Bouton");
buttonPlay.setPosition(120, 170); buttonPlay.setPosition(1500, AssetLoader.height-40);
buttonExit = new TextButton("Quitter", AssetLoader.Skin_level,"Bouton"); buttonExit = new TextButton("Statistiques", AssetLoader.Skin_level,"Bouton");
buttonExit.setPosition(220, 170); buttonExit.setPosition(1720, AssetLoader.height-40);
Exit=new ImageButton(AssetLoader.Skin_level,"Exit"); Exit=new ImageButton(AssetLoader.Skin_level,"Exit");
Exit.setPosition(1000, AssetLoader.height-Exit.getHeight()); Exit.setPosition(1110, AssetLoader.height-Exit.getHeight()-5);
Exit.addListener(new ClickListener(){ Exit.addListener(new ClickListener(){
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
@ -86,9 +86,13 @@ public class LevelScreen implements Screen {
} }
}); });
Next=new ImageButton(AssetLoader.Skin_level,"Next"); Next=new ImageButton(AssetLoader.Skin_level,"Next");
Next.setPosition(940, 170); Next.setPosition(1030, 170);
Previous=new ImageButton(AssetLoader.Skin_level,"Previous"); Previous=new ImageButton(AssetLoader.Skin_level,"Previous");
Previous.setPosition(1020, 170); Previous.setPosition(1110, 170);
cout=new ImageButton(AssetLoader.Skin_level,"cout");
cout.setPosition(1250, 50);
tech=new ImageButton(AssetLoader.Skin_level,"tech");
tech.setPosition(1370, 50);
} }
@Override @Override
@ -119,6 +123,8 @@ public class LevelScreen implements Screen {
stage.addActor(buttonPlay); stage.addActor(buttonPlay);
stage.addActor(buttonExit); stage.addActor(buttonExit);
stage.addActor(Previous); stage.addActor(Previous);
stage.addActor(cout);
stage.addActor(tech);
Gdx.input.setInputProcessor(stage); Gdx.input.setInputProcessor(stage);
} }

View File

@ -66,37 +66,35 @@ public class LevelRenderer {
public void render(float delta, float runTime) { public void render(float delta, float runTime) {
Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
//Gdx.gl.glViewport(0, 0, AssetLoader.width, AssetLoader.height);
batcher.begin(); batcher.begin();
batcher.setProjectionMatrix(AssetLoader.Camera.combined); batcher.setProjectionMatrix(AssetLoader.Camera.combined);
batcher.setColor(0.25f,0.25f,0.25f,1); batcher.setColor(0.25f,0.25f,0.25f,1f);
batcher.draw(AssetLoader.Texture_fond2, 0, 0, this.scrollx/2, this.scrolly/2, AssetLoader.width, AssetLoader.height); batcher.draw(AssetLoader.Texture_fond2, 0, 0, this.scrollx/2, this.scrolly/2, AssetLoader.width, AssetLoader.height);
batcher.setColor(0.7f,0.7f,0.7f,1); batcher.setColor(0.7f,0.7f,0.7f,1);
batcher.draw(AssetLoader.Texture_fond, 0, 0, this.scrollx, this.scrolly, AssetLoader.width, AssetLoader.height); batcher.draw(AssetLoader.Texture_fond, 0, 0, this.scrollx, this.scrolly, AssetLoader.width, AssetLoader.height);
batcher.setColor(1,1,1,1); batcher.end();
batcher2.begin();
batcher2.setProjectionMatrix(AssetLoader.Camera.combined);
batcher2.setColor(Color.WHITE);
Texture_logobig=AssetLoader.Skin_level.getRegion("logo3"); Texture_logobig=AssetLoader.Skin_level.getRegion("logo3");
Texture_logosmall=AssetLoader.Skin_level.getRegion("logo2"); Texture_logosmall=AssetLoader.Skin_level.getRegion("logo2");
batcher.draw(Texture_logosmall,20, AssetLoader.height-Texture_logobig.getRegionHeight()+Texture_logosmall.getRegionHeight()/2); batcher2.draw(Texture_logosmall,20, AssetLoader.height-Texture_logobig.getRegionHeight()+Texture_logosmall.getRegionHeight()/2);
batcher.draw(Texture_logobig,120, AssetLoader.height-Texture_logobig.getRegionHeight()); batcher2.draw(Texture_logobig,120, AssetLoader.height-Texture_logobig.getRegionHeight());
batcher.end(); batcher2.end();
Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glEnable(GL20.GL_BLEND);
shapeRenderer.begin(ShapeType.Filled); shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setProjectionMatrix(AssetLoader.Camera.combined); shapeRenderer.setProjectionMatrix(AssetLoader.Camera.combined);
shapeRenderer.setColor(0.5f, 0.5f, 0.5f, 0.5f); shapeRenderer.setColor(0.5f, 0.5f, 0.5f, 0.5f);
shapeRenderer.rect(10, 10, 1500, 140); shapeRenderer.rect(10, 10, 1190, 140);
shapeRenderer.rect(1500, 10, AssetLoader.width-1500, 140); shapeRenderer.rect(1210, 10, 250, 140);
shapeRenderer.rect(1500, 160, AssetLoader.width-1500, 140); shapeRenderer.rect(1210, 160,250, 140);
shapeRenderer.rect(1500, 310, AssetLoader.width-1500, 300); shapeRenderer.rect(1210, 310,250, 300);
shapeRenderer.rect(1500, 620, AssetLoader.width-1500, AssetLoader.height-620); shapeRenderer.rect(1210, 620,250, AssetLoader.height-620);
shapeRenderer.rect(1470, 10, 440, AssetLoader.height-10);
shapeRenderer.end(); shapeRenderer.end();
batcher2.begin();
batcher2.setColor(1f,1f,1f,1f);
batcher2.draw(AssetLoader.Atlas_game.findRegion("cout"),1150,40);
batcher2.draw(AssetLoader.Atlas_game.findRegion("tech"),1280,40);
batcher2.end();
for (int i=0;i<LevelScreen.buttonLevels.length;i++) { for (int i=0;i<LevelScreen.buttonLevels.length;i++) {
if (LevelScreen.buttonLevels[i]!=null) { if (LevelScreen.buttonLevels[i]!=null) {
@ -112,7 +110,7 @@ public class LevelRenderer {
} }
if (found!=-1) if (found!=-1)
{ {
Laser.draw(batcher,LevelScreen.buttonLevels[i].level.X+20,LevelScreen.buttonLevels[i].level.Y+20,LevelScreen.buttonLevels[found].level.X+20,LevelScreen.buttonLevels[found].level.Y+20,10,0.5f,LevelScreen.buttonLevels[found].Activated,LevelScreen.buttonLevels[i].getLevelcolor(),LevelScreen.buttonLevels[found].getLevelcolor()); Laser.draw(batcher,LevelScreen.buttonLevels[i].level.X+20,LevelScreen.buttonLevels[i].level.Y*AssetLoader.ratio+20,LevelScreen.buttonLevels[found].level.X+20,LevelScreen.buttonLevels[found].level.Y*AssetLoader.ratio+20,10,0.5f,LevelScreen.buttonLevels[found].Activated,LevelScreen.buttonLevels[i].getLevelcolor(),LevelScreen.buttonLevels[found].getLevelcolor());
} }
} }
} }