feat: remaniement des barres de jeux

This commit is contained in:
Nicolas Hordé 2015-06-28 17:39:23 +02:00
parent 6aeb3560ef
commit 50ccccaac1
5 changed files with 39 additions and 31 deletions

View File

@ -9,6 +9,7 @@ import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.utils.Align;
@ -22,6 +23,7 @@ public class ButtonLevel extends ImageTextButton {
Label Thelabel;
float scale;
ImageTextButtonStyle style;
LabelStyle stylelabel;
public ButtonLevel(Level level, boolean Activated) {
super(level.Name, AssetLoader.Skin_level, "world"+String.valueOf(level.aWorld));
@ -47,7 +49,9 @@ public class ButtonLevel extends ImageTextButton {
this.scale=scale;
this.setBounds(level.X, level.Y*AssetLoader.ratio, 111*scale, 125*scale);
Thelabel.setPosition(level.X+54*scale, level.Y*AssetLoader.ratio+20*scale, Align.bottom | Align.center);
Thelabel.setFontScale(scale);
stylelabel=Thelabel.getStyle();
stylelabel.font.setScale(scale);
Thelabel.setStyle(stylelabel);
style= this.getStyle();
style.pressedOffsetX=style.pressedOffsetX*scale;
style.pressedOffsetY=style.pressedOffsetY*scale;

View File

@ -90,10 +90,9 @@ public class GameScreen implements Screen {
cout.setPosition(1445,AssetLoader.height-74);
objectives=new Objectives();
objectives.setVictory(level.Victory);
objectives.setPosition(960,AssetLoader.height-85);
objectives.setPosition(890,AssetLoader.height-95);
buttonlevel=new ButtonLevel(level,true);
buttonlevel.setScale(0.6f);
buttonlevel.setPosition(860,AssetLoader.height-88);
buttonlevel.setPosition(1760,AssetLoader.height-125);
}
@Override

View File

@ -47,7 +47,7 @@ public class LevelScreen implements Screen {
private ImageButton Previous,Next,Exit;
public ImageButton logosmall;
private ImageTextButton cout,tech,cycle,temp,rayon,nrj;
private TextButton buttonPlay,buttonExit;
private TextButton buttonConnect,buttonPlay,buttonStat;
private Level[] thelevels;
private TextArea TextDescriptive;
public int world;
@ -96,12 +96,6 @@ public class LevelScreen implements Screen {
abutton.setPosition(event.getStageX()-56, event.getStageY()-20);
}
}
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
ButtonLevel abutton = (ButtonLevel)event.getListenerActor();
if (!logosmall.isChecked()) {
((Game)Gdx.app.getApplicationListener()).setScreen(new GameScreen(abutton.level));
}
}
});
}
@ -139,10 +133,18 @@ public class LevelScreen implements Screen {
logosmall.setPosition(20, AssetLoader.height-175+logosmall.getHeight()/2);
TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level,"Descriptif");
TextDescriptive.setBounds(15, 15, 1185, 100);
buttonPlay = new TextButton("Connexions", AssetLoader.Skin_level,"Bouton");
buttonPlay.setPosition(1500, AssetLoader.height-40);
buttonExit = new TextButton("Statistiques", AssetLoader.Skin_level,"Bouton");
buttonExit.setPosition(1720, AssetLoader.height-40);
buttonConnect = new TextButton("Connexions", AssetLoader.Skin_level,"Bouton");
buttonConnect.setBounds(1480, AssetLoader.height-60, 190, 40);
buttonPlay = new TextButton("Jouer", AssetLoader.Skin_level,"Bouton");
buttonPlay.setBounds(1040, 20, 150, 40);
buttonPlay.addListener(new ClickListener(){
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
((Game)Gdx.app.getApplicationListener()).setScreen(new GameScreen(selected.level));
}
});
buttonStat = new TextButton("Statistiques", AssetLoader.Skin_level,"Bouton");
buttonStat.setBounds(1710, AssetLoader.height-60, 190, 40);
Exit=new ImageButton(AssetLoader.Skin_level,"Exit");
Exit.setPosition(1110, AssetLoader.height-Exit.getHeight()-5);
Exit.addListener(new ClickListener(){
@ -222,7 +224,8 @@ public class LevelScreen implements Screen {
stage.addActor(Exit);
stage.addActor(Next);
stage.addActor(buttonPlay);
stage.addActor(buttonExit);
stage.addActor(buttonConnect);
stage.addActor(buttonStat);
stage.addActor(Previous);
stage.addActor(cout);
stage.addActor(tech);

View File

@ -18,7 +18,7 @@ import fr.evolving.screens.GameScreen;
public class GameRenderer {
private GameWorld myWorld;
private ShapeRenderer shapeRenderer;
//private ShapeRenderer shapeRenderer;
private SpriteBatch batcher;
private GameScreen GameScreen;
@ -30,23 +30,25 @@ public class GameRenderer {
this.GameScreen=GameScreen;
batcher = new SpriteBatch();
batcher.setProjectionMatrix(AssetLoader.Camera.combined);
shapeRenderer = new ShapeRenderer();
shapeRenderer.setProjectionMatrix(AssetLoader.Camera.combined);
//shapeRenderer = new ShapeRenderer();
//shapeRenderer.setProjectionMatrix(AssetLoader.Camera.combined);
}
public void render(float delta, float runTime) {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(0.2f, 0.2f, 0.2f, 0.5f);
shapeRenderer.rect(5, 5, AssetLoader.width-10, 74);
shapeRenderer.rect(5, AssetLoader.height-81, 810, 74);
shapeRenderer.rect(825, AssetLoader.height-107, 500, 100);
shapeRenderer.rect(1335, AssetLoader.height-107, 200, 100);
shapeRenderer.circle(1850, AssetLoader.height, 300, 60);
shapeRenderer.end();
//shapeRenderer.begin(ShapeType.Filled);
//shapeRenderer.setColor(0.15f, 0.15f, 0.15f, 0.5f);
//shapeRenderer.rect(5, 5, AssetLoader.width-10, 74);
//shapeRenderer.rect(5, AssetLoader.height-81, 810, 74);
//shapeRenderer.rect(825, AssetLoader.height-107, 500, 100);
//shapeRenderer.rect(1335, AssetLoader.height-107, 200, 100);
//shapeRenderer.circle(1850, AssetLoader.height, 300, 60);
//shapeRenderer.end();
batcher.begin();
batcher.disableBlending();
batcher.setColor(0.25f, 0.25f, 0.25f, 0.5f);
batcher.draw(AssetLoader.Atlas_level.findRegion("barrehaut"), 0.0f, AssetLoader.height-200.0f,1920.0f,200.0f);
batcher.draw(AssetLoader.Atlas_level.findRegion("barrebas"), 0.0f, 0.0f,1920.0f,95.0f);
batcher.end();
}

View File

@ -22,9 +22,9 @@ public class GameWorld {
}
public GameWorld(Level level) {
Gdx.app.log("Creation du plateau de jeu","ok");
Gdx.app.log(this.getClass().getSimpleName(),"Initialisation du niveau...");
currentState = GameState.MENU;
myGrid= new Grid(20,20);
//myGrid= new Grid(20,20);
//MySaveObject= new SaveObject("com.mysql.jdbc.Driver","jdbc:mysql://dahut.fr:3306/popfr_games","popfr_games","ef^J,khGMIL~");
//MySaveObject= new SaveObject("com.mysql.jdbc.Driver","jdbc:mysql://192.168.1.252:3306/games","games","WoawGames!!87");
//try {