feat: refonte de l'affichage du plateau de jeu ajout du sous menu avec transmuteurs gestion du plein écran/son
This commit is contained in:
parent
dc4b82c189
commit
939913adb6
|
@ -122,6 +122,25 @@ public class Grid implements Serializable{
|
||||||
if (value>0)
|
if (value>0)
|
||||||
GetXY(x,y).Copper_calc=oldvalue+22+value;
|
GetXY(x,y).Copper_calc=oldvalue+22+value;
|
||||||
}
|
}
|
||||||
|
int value=0;
|
||||||
|
if (oldvalue==34 && (GetCoppercalc(x-1,y)==31 || GetCoppercalc(x-1,y)==55 || GetCoppercalc(x-1,y)==58))
|
||||||
|
value=62;
|
||||||
|
if (oldvalue==34 && (GetCoppercalc(x+1,y)==31 || GetCoppercalc(x+1,y)==55 || GetCoppercalc(x+1,y)==58))
|
||||||
|
value=58;
|
||||||
|
if (oldvalue==31 && (GetCoppercalc(x-1,y)==34 || GetCoppercalc(x-1,y)==58 || GetCoppercalc(x-1,y)==62))
|
||||||
|
value=59;
|
||||||
|
if (oldvalue==31 && (GetCoppercalc(x+1,y)==34 || GetCoppercalc(x+1,y)==58 || GetCoppercalc(x+1,y)==62))
|
||||||
|
value=55;
|
||||||
|
if (oldvalue==33 && (GetCoppercalc(x,y-1)==27 || GetCoppercalc(x,y-1)==50 || GetCoppercalc(x,y-1)==51))
|
||||||
|
value=57;
|
||||||
|
if (oldvalue==33 && (GetCoppercalc(x,y+1)==27 || GetCoppercalc(x,y+1)==50 || GetCoppercalc(x,y+1)==51))
|
||||||
|
value=56;
|
||||||
|
if (oldvalue==27 && (GetCoppercalc(x,y-1)==33 || GetCoppercalc(x,y-1)==56 || GetCoppercalc(x,y-1)==57))
|
||||||
|
value=51;
|
||||||
|
if (oldvalue==27 && (GetCoppercalc(x,y+1)==33 || GetCoppercalc(x,y+1)==56 || GetCoppercalc(x,y+1)==57))
|
||||||
|
value=50;
|
||||||
|
if (value>0)
|
||||||
|
GetXY(x,y).Copper_calc=value;
|
||||||
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class main extends Game {
|
||||||
debug();
|
debug();
|
||||||
//test();
|
//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.contains("ResolutionX") && AssetLoader.prefs.contains("ResolutionX")) {
|
if (AssetLoader.prefs.getInteger("ResolutionX")>0 && AssetLoader.prefs.getInteger("ResolutionY")>0) {
|
||||||
try {
|
try {
|
||||||
int ResolutionX=AssetLoader.prefs.getInteger("ResolutionX");
|
int ResolutionX=AssetLoader.prefs.getInteger("ResolutionX");
|
||||||
int ResolutionY=AssetLoader.prefs.getInteger("ResolutionY");
|
int ResolutionY=AssetLoader.prefs.getInteger("ResolutionY");
|
||||||
|
|
|
@ -5,6 +5,9 @@ import java.util.TimerTask;
|
||||||
|
|
||||||
import com.badlogic.gdx.Game;
|
import com.badlogic.gdx.Game;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.Graphics.DisplayMode;
|
||||||
|
import com.badlogic.gdx.InputMultiplexer;
|
||||||
|
import com.badlogic.gdx.InputProcessor;
|
||||||
import com.badlogic.gdx.Screen;
|
import com.badlogic.gdx.Screen;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
|
@ -13,15 +16,24 @@ import com.badlogic.gdx.maps.tiled.TiledMap;
|
||||||
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
|
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
|
||||||
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell;
|
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell;
|
||||||
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
|
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
|
||||||
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
|
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.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
|
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.Table;
|
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.Align;
|
||||||
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.utils.Array;
|
||||||
|
|
||||||
|
import fr.evolving.UI.Menu;
|
||||||
import fr.evolving.worlds.GameRenderer;
|
import fr.evolving.worlds.GameRenderer;
|
||||||
import fr.evolving.worlds.GameWorld;
|
import fr.evolving.worlds.GameWorld;
|
||||||
import fr.evolving.worlds.LevelRenderer;
|
import fr.evolving.worlds.LevelRenderer;
|
||||||
|
@ -33,28 +45,50 @@ import fr.evolving.automata.Level;
|
||||||
import fr.evolving.inputs.InputHandler;
|
import fr.evolving.inputs.InputHandler;
|
||||||
|
|
||||||
public class GameScreen implements Screen {
|
public class GameScreen implements Screen {
|
||||||
|
private InputMultiplexer multiplexer;
|
||||||
|
private Array<InputProcessor> processors;
|
||||||
private Timer ScrollTimer;
|
private Timer ScrollTimer;
|
||||||
private TimerTask ScrollTask;
|
private TimerTask ScrollTask;
|
||||||
private Stage stage;
|
private Stage stage,stage2;
|
||||||
private Table table;
|
private HorizontalGroup table;
|
||||||
|
private VerticalGroup table2;
|
||||||
private GameWorld world;
|
private GameWorld world;
|
||||||
private GameRenderer Renderer;
|
private GameRenderer Renderer;
|
||||||
private float runTime;
|
private float runTime;
|
||||||
public Level level;
|
public Level level;
|
||||||
private ImageButton[] Barre;
|
private ImageButton[] Barre;
|
||||||
private ImageTextButton cycle,temp,nrj,rayon,cout,tech;
|
private ImageTextButton cycle,temp,nrj,rayon,cout,tech;
|
||||||
|
private ImageTextButton[] Barre2;
|
||||||
String[] tocreate={"run","stop","speed","separator","move","zoomp","zoomm","separator","raz","save","levels","tree","exits","separator","screen","sound","tuto","settings","separator","stat"};
|
String[] tocreate={"run","stop","speed","separator","move","zoomp","zoomm","separator","raz","save","levels","tree","exits","separator","screen","sound","tuto","settings","separator","stat"};
|
||||||
|
String[] tocreate2={"Structure","Charge","Direction","Selection","Création","Détection","Action","Scénario"};
|
||||||
|
public Actor selected;
|
||||||
private ButtonLevel buttonlevel;
|
private ButtonLevel buttonlevel;
|
||||||
private Objectives objectives;
|
private Objectives objectives;
|
||||||
private TouchMaptiles map;
|
private TouchMaptiles map;
|
||||||
private Image Barrehaut,Barrebas;
|
private Menu menu;
|
||||||
|
private float oldx,oldy;
|
||||||
|
private Label fpsLabel;
|
||||||
|
|
||||||
|
|
||||||
// This is the constructor, not the class declaration
|
// This is the constructor, not the class declaration
|
||||||
public GameScreen(Level alevel) {
|
public GameScreen(Level alevel) {
|
||||||
|
Gdx.app.debug(getClass().getSimpleName(),"Création des Barres verticales & horizontales");
|
||||||
|
table = new HorizontalGroup();
|
||||||
|
table.bottom().padLeft(5f).padBottom(8f).space(10f);
|
||||||
|
table2 = new VerticalGroup();
|
||||||
|
table2.setPosition(AssetLoader.width, AssetLoader.height*2/3);
|
||||||
|
table2.right();
|
||||||
|
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)");
|
||||||
|
fpsLabel=new Label("0 FPS",AssetLoader.Skin_level,"FPS");
|
||||||
|
fpsLabel.setPosition(AssetLoader.width-75, AssetLoader.height-220);
|
||||||
|
multiplexer = new InputMultiplexer();
|
||||||
|
processors = new Array<InputProcessor>();
|
||||||
stage = new Stage(AssetLoader.viewport);
|
stage = new Stage(AssetLoader.viewport);
|
||||||
table = new Table();
|
stage2 = new Stage(AssetLoader.viewport);
|
||||||
this.level=alevel;
|
this.level=alevel;
|
||||||
|
oldx=0;
|
||||||
|
oldy=0;
|
||||||
world = new GameWorld(level);
|
world = new GameWorld(level);
|
||||||
Renderer = new GameRenderer(this);
|
Renderer = new GameRenderer(this);
|
||||||
world.setRenderer(Renderer);
|
world.setRenderer(Renderer);
|
||||||
|
@ -69,33 +103,88 @@ public class GameScreen implements Screen {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30);
|
ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30);
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Création de la barre de gestion du bas");
|
Gdx.app.debug(getClass().getSimpleName(),"Création des barres");
|
||||||
Barre=new ImageButton[tocreate.length];
|
Barre=new ImageButton[tocreate.length];
|
||||||
int i=0;
|
int i=0;
|
||||||
for (String tocreateitem: tocreate)
|
for (String tocreateitem: tocreate) {
|
||||||
Barre[i++]= new ImageButton(AssetLoader.Skin_level,tocreateitem);
|
Barre[i]= new ImageButton(AssetLoader.Skin_level,tocreateitem);
|
||||||
|
Barre[i++].setName(tocreateitem);
|
||||||
|
}
|
||||||
|
Barre2=new ImageTextButton[tocreate2.length];
|
||||||
|
i=0;
|
||||||
|
for (String tocreateitem: tocreate2) {
|
||||||
|
Barre2[i]= new ImageTextButton(tocreateitem,AssetLoader.Skin_level);
|
||||||
|
Barre2[i++].setName(tocreateitem);
|
||||||
|
}
|
||||||
Barre[10].addListener(new ClickListener(){
|
Barre[10].addListener(new ClickListener(){
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
Gdx.app.debug(event.getListenerActor().toString(),"Barre:Niveaux");
|
||||||
((Game)Gdx.app.getApplicationListener()).setScreen(new LevelScreen(level.aWorld));
|
((Game)Gdx.app.getApplicationListener()).setScreen(new LevelScreen(level.aWorld));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
if (Gdx.graphics.isFullscreen())
|
||||||
|
Barre[14].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("windows"));
|
||||||
|
Barre[14].addListener(new ClickListener(){
|
||||||
|
@Override
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
Gdx.app.debug(event.getListenerActor().toString(),"Barre:Ecran");
|
||||||
|
DisplayMode currentMode = Gdx.graphics.getDesktopDisplayMode();
|
||||||
|
if (Gdx.graphics.isFullscreen())
|
||||||
|
{
|
||||||
|
Gdx.app.debug(event.getListenerActor().toString(),"vers fenetre.");
|
||||||
|
Gdx.graphics.setDisplayMode(currentMode.width, currentMode.height, false);
|
||||||
|
Barre[14].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("screen"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Gdx.app.debug(event.getListenerActor().toString(),"vers plein ecran.");
|
||||||
|
Gdx.graphics.setDisplayMode(currentMode.width, currentMode.height, true);
|
||||||
|
Barre[14].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("windows"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (AssetLoader.intro.getVolume()==0)
|
||||||
|
Barre[15].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("nosound"));
|
||||||
|
Barre[15].addListener(new ClickListener(){
|
||||||
|
@Override
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
Gdx.app.debug(event.getListenerActor().getName(),"Barre:Son");
|
||||||
|
if (AssetLoader.intro.getVolume()>0)
|
||||||
|
{
|
||||||
|
Gdx.app.debug(event.getListenerActor().toString(),"arret son.");
|
||||||
|
AssetLoader.intro.setVolume(0f);
|
||||||
|
Barre[15].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("nosound"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Gdx.app.debug(event.getListenerActor().toString(),"marche son.");
|
||||||
|
AssetLoader.intro.setVolume(1f);
|
||||||
|
Barre[15].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("sound"));
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
Barre[12].addListener(new ClickListener(){
|
Barre[12].addListener(new ClickListener(){
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
Gdx.app.debug(event.getListenerActor().toString(),"Barre:Quitter");
|
||||||
Gdx.app.exit();
|
Gdx.app.exit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Barre[6].addListener(new ClickListener(){
|
for (i=4;i<7;i++) {
|
||||||
|
Barre[i].addListener(new ClickListener(){
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
map.setZoom(1.1f);
|
selected=event.getListenerActor();
|
||||||
|
Gdx.app.debug(event.getListenerActor().toString(),"Barre:Selection dans la Barre bas");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Barre[5].addListener(new ClickListener(){
|
}
|
||||||
|
Barre2[0].addListener(new ClickListener(){
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
map.setZoom(0.9f);
|
Gdx.app.debug(event.getListenerActor().toString(),"Affichage sousmenu");
|
||||||
|
((TiledMapTileLayer)menu.map.getLayers().get(0)).getCell(1,6).setTile(AssetLoader.tileSet.getTile(10));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Création de la barre de gestion du haut");
|
Gdx.app.debug(getClass().getSimpleName(),"Création de la barre de gestion du haut");
|
||||||
|
@ -116,49 +205,83 @@ public class GameScreen implements Screen {
|
||||||
objectives.setPosition(890,AssetLoader.height-95);
|
objectives.setPosition(890,AssetLoader.height-95);
|
||||||
buttonlevel=new ButtonLevel(level,true);
|
buttonlevel=new ButtonLevel(level,true);
|
||||||
buttonlevel.setPosition(1760,AssetLoader.height-125);
|
buttonlevel.setPosition(1760,AssetLoader.height-125);
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Ajout des barres");
|
|
||||||
Barrehaut=new Image(AssetLoader.Atlas_level.findRegion("barrehaut"));
|
|
||||||
Barrehaut.setBounds(0.0f, AssetLoader.height-200.0f,1920.0f,200.0f);
|
|
||||||
Barrehaut.setColor(0.25f, 0.25f, 0.25f, 0.9f);
|
|
||||||
Barrebas=new Image(AssetLoader.Atlas_level.findRegion("barrebas"));
|
|
||||||
Barrebas.setBounds(0.0f, 0.0f,1920.0f,95.0f);
|
|
||||||
Barrebas.setColor(0.25f, 0.25f, 0.25f, 0.9f);
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Création d'une tilemap");
|
Gdx.app.debug(getClass().getSimpleName(),"Création d'une tilemap");
|
||||||
map=new TouchMaptiles(level,128,128);
|
map=new TouchMaptiles(level,128,128);
|
||||||
map.setBounds(0, 0, AssetLoader.width, AssetLoader.height);
|
map.setBounds(0, 0, AssetLoader.width, AssetLoader.height);
|
||||||
map.addListener(new ClickListener(){
|
map.addListener(new ClickListener(){
|
||||||
@Override
|
@Override
|
||||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
|
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
|
||||||
|
oldx=0;
|
||||||
//Vector3 temp_coord = new Vector3(x,y,0);
|
oldy=0;
|
||||||
//Vector3 coords = map.camera.unproject(temp_coord);
|
if (selected==null)
|
||||||
//x =(int) coords.x;
|
;
|
||||||
//y =(int) coords.y;
|
else if (selected.getName()=="zoomp")
|
||||||
x=(int)((x/AssetLoader.width*map.camera.viewportWidth)+map.decx);
|
|
||||||
y=(int)((y/AssetLoader.height*map.camera.viewportHeight)+map.decy);
|
|
||||||
if (level.Grid.GetXY(x,y)!=null)
|
|
||||||
{
|
{
|
||||||
System.out.println("Screen coordinates translated to world coordinates: "+ "X: " + x + " Y: " + y+" zoom:"+map.getZoom());
|
map.setZoom(0.9f);
|
||||||
if (level.Grid.GetCopper(x,y)==false)
|
map.setDec((AssetLoader.width/2-x)/2,(AssetLoader.height/2-y)/2);
|
||||||
level.Grid.GetXY(x,y).Copper=true;
|
return false;
|
||||||
|
}
|
||||||
|
else if (selected.getName()=="zoomm")
|
||||||
|
{
|
||||||
|
map.setZoom(1.1f);
|
||||||
|
map.setDec((AssetLoader.width/2-x)/2,(AssetLoader.height/2-y)/2);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (selected.getName()=="pen")
|
||||||
|
{
|
||||||
|
Vector2 coords=map.screentoworld(x, y);
|
||||||
|
if (level.Grid.GetXY(coords.x,coords.y)!=null)
|
||||||
|
{
|
||||||
|
Gdx.app.debug(event.getListenerActor().toString(),"Screen coordinates translated to world coordinates: "+ "X: " + coords.x + " Y: " + coords.y);
|
||||||
|
if (level.Grid.GetCopper(coords.x,coords.y)==false)
|
||||||
|
level.Grid.GetXY(coords.x,coords.y).Copper=true;
|
||||||
else
|
else
|
||||||
level.Grid.GetXY(x,y).Copper=false;
|
level.Grid.GetXY(coords.x,coords.y).Copper=false;
|
||||||
level.Grid.tiling();
|
level.Grid.tiling();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map.addListener(new ClickListener(){
|
||||||
|
@Override
|
||||||
|
public void touchDragged(InputEvent event, float x, float y, int pointer) {
|
||||||
|
if (selected==null)
|
||||||
|
;
|
||||||
|
else if (selected.getName()=="move") {
|
||||||
|
if (oldx!=0 && oldy!=0) {
|
||||||
|
map.setDec(x-oldx,y-oldy);
|
||||||
|
Gdx.app.debug(event.getListenerActor().toString(),"Decalage absolue en pixel:"+(x-oldx)+"x"+(y-oldy));
|
||||||
|
}
|
||||||
|
oldx=x;
|
||||||
|
oldy=y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu=new Menu(4,8);
|
||||||
|
map.addListener(new ClickListener(){
|
||||||
|
@Override
|
||||||
|
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
|
||||||
|
Vector2 coords=menu.screentoworld(x,y);
|
||||||
|
Gdx.app.debug(event.getListenerActor().toString(),"Coordonnées:"+x+"x"+y+" Coordonnées deprojettée:"+coords.x+"x"+coords.y);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
||||||
runTime += delta;
|
runTime += delta;
|
||||||
world.update(delta);
|
world.update(delta);
|
||||||
Renderer.render(delta, runTime);
|
fpsLabel.setText(Gdx.graphics.getFramesPerSecond()+"FPS");
|
||||||
|
Renderer.render(delta, runTime,0);
|
||||||
|
stage2.draw();
|
||||||
|
Renderer.render(delta, runTime,1);
|
||||||
stage.draw();
|
stage.draw();
|
||||||
|
Renderer.render(delta, runTime,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -169,22 +292,27 @@ public class GameScreen implements Screen {
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
Gdx.app.log("*****","Affichage du niveau.");
|
Gdx.app.log("*****","Affichage du niveau.");
|
||||||
table.bottom().left().padBottom(10f);
|
for (int i=0;i<tocreate2.length;i++)
|
||||||
|
table2.addActor(Barre2[i]);
|
||||||
for (int i=0;i<tocreate.length;i++)
|
for (int i=0;i<tocreate.length;i++)
|
||||||
table.add(Barre[i]).padLeft(10f);
|
table.addActor(Barre[i]);
|
||||||
stage.addActor(map);
|
stage2.addActor(map);
|
||||||
stage.addActor(Barrehaut);
|
|
||||||
stage.addActor(Barrebas);
|
|
||||||
stage.addActor(objectives);
|
stage.addActor(objectives);
|
||||||
stage.addActor(buttonlevel);
|
stage.addActor(buttonlevel);
|
||||||
stage.addActor(rayon);
|
stage.addActor(rayon);
|
||||||
stage.addActor(nrj);
|
stage.addActor(nrj);
|
||||||
|
stage.addActor(fpsLabel);
|
||||||
stage.addActor(temp);
|
stage.addActor(temp);
|
||||||
stage.addActor(cycle);
|
stage.addActor(cycle);
|
||||||
|
stage.addActor(table2);
|
||||||
stage.addActor(table);
|
stage.addActor(table);
|
||||||
stage.addActor(tech);
|
stage.addActor(tech);
|
||||||
stage.addActor(cout);
|
stage.addActor(cout);
|
||||||
Gdx.input.setInputProcessor(stage);
|
stage.addActor(menu);
|
||||||
|
processors.add(stage);
|
||||||
|
processors.add(stage2);
|
||||||
|
multiplexer.setProcessors(processors);
|
||||||
|
Gdx.input.setInputProcessor(multiplexer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -80,13 +80,13 @@ public class LevelScreen implements Screen {
|
||||||
@Override
|
@Override
|
||||||
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
|
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
|
||||||
ButtonLevel abutton = (ButtonLevel)event.getListenerActor();
|
ButtonLevel abutton = (ButtonLevel)event.getListenerActor();
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Enter button "+abutton.level.Name);
|
Gdx.app.debug(event.getListenerActor().toString(), "Enter button ");
|
||||||
if (!abutton.isChecked())
|
if (!abutton.isChecked())
|
||||||
showlevel(abutton);
|
showlevel(abutton);
|
||||||
}
|
}
|
||||||
public void exit(InputEvent event, float x, float y, int pointer, Actor fromActor) {
|
public void exit(InputEvent event, float x, float y, int pointer, Actor fromActor) {
|
||||||
ButtonLevel abutton = (ButtonLevel)event.getListenerActor();
|
ButtonLevel abutton = (ButtonLevel)event.getListenerActor();
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Enter button "+abutton.level.Name);
|
Gdx.app.debug(event.getListenerActor().toString(), "Enter button ");
|
||||||
if (!abutton.isChecked())
|
if (!abutton.isChecked())
|
||||||
showlevel(abutton);
|
showlevel(abutton);
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ public class LevelScreen implements Screen {
|
||||||
world++;
|
world++;
|
||||||
loadWorld(world);
|
loadWorld(world);
|
||||||
}
|
}
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"World:"+String.valueOf(world)+" Maxworld:"+String.valueOf(getMaxWorld()));
|
Gdx.app.debug(event.getListenerActor().toString(),"World:"+String.valueOf(world)+" Maxworld:"+String.valueOf(getMaxWorld()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Previous=new ImageButton(AssetLoader.Skin_level,"Previous");
|
Previous=new ImageButton(AssetLoader.Skin_level,"Previous");
|
||||||
|
@ -174,7 +174,7 @@ public class LevelScreen implements Screen {
|
||||||
world--;
|
world--;
|
||||||
loadWorld(world);
|
loadWorld(world);
|
||||||
}
|
}
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"World:"+String.valueOf(world)+" Maxworld:"+String.valueOf(getMaxWorld()));
|
Gdx.app.debug(event.getListenerActor().toString(),"World:"+String.valueOf(world)+" Maxworld:"+String.valueOf(getMaxWorld()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cout=new ImageTextButton("5",AssetLoader.Skin_level,"cout");
|
cout=new ImageTextButton("5",AssetLoader.Skin_level,"cout");
|
||||||
|
|
|
@ -21,10 +21,8 @@ public class GameRenderer {
|
||||||
private ShapeRenderer shapeRenderer;
|
private ShapeRenderer shapeRenderer;
|
||||||
private SpriteBatch batcher;
|
private SpriteBatch batcher;
|
||||||
private GameScreen GameScreen;
|
private GameScreen GameScreen;
|
||||||
|
private TextureRegion oneselection;
|
||||||
public void evolve() {
|
private float rotation;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public GameRenderer(GameScreen GameScreen) {
|
public GameRenderer(GameScreen GameScreen) {
|
||||||
this.GameScreen=GameScreen;
|
this.GameScreen=GameScreen;
|
||||||
|
@ -32,13 +30,38 @@ public class GameRenderer {
|
||||||
batcher.setProjectionMatrix(AssetLoader.Camera.combined);
|
batcher.setProjectionMatrix(AssetLoader.Camera.combined);
|
||||||
shapeRenderer = new ShapeRenderer();
|
shapeRenderer = new ShapeRenderer();
|
||||||
shapeRenderer.setProjectionMatrix(AssetLoader.Camera.combined);
|
shapeRenderer.setProjectionMatrix(AssetLoader.Camera.combined);
|
||||||
|
oneselection= AssetLoader.Atlas_level.findRegion("circle");
|
||||||
|
rotation=0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(float delta, float runTime) {
|
public void evolve() {
|
||||||
|
rotation+=5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(float delta, float runTime,int layer) {
|
||||||
|
if (layer==0) {
|
||||||
|
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||||
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
|
}
|
||||||
|
else if (layer==1) {
|
||||||
|
batcher.begin();
|
||||||
|
batcher.setColor(0.25f, 0.25f, 0.25f, 1f);
|
||||||
|
batcher.draw(AssetLoader.Atlas_level.findRegion("barrehaut"),0.0f,AssetLoader.height-198.0f,1920.0f,200.0f);
|
||||||
|
batcher.draw(AssetLoader.Atlas_level.findRegion("barrebas"),0.0f,0.0f,1920.0f,170.0f);
|
||||||
|
batcher.draw(AssetLoader.Atlas_level.findRegion("barrecentre"),1450f,AssetLoader.height-800.0f,620f,520.0f);
|
||||||
|
batcher.end();
|
||||||
|
}
|
||||||
|
else if (layer==2) {
|
||||||
shapeRenderer.begin(ShapeType.Filled);
|
shapeRenderer.begin(ShapeType.Filled);
|
||||||
shapeRenderer.end();
|
shapeRenderer.end();
|
||||||
batcher.begin();
|
batcher.begin();
|
||||||
|
if (GameScreen.selected!=null)
|
||||||
|
{
|
||||||
|
batcher.setColor(1f, 0f, 0f, 1f);
|
||||||
|
batcher.draw(oneselection, GameScreen.selected.getX(), GameScreen.selected.getY(), GameScreen.selected.getWidth()/2,GameScreen.selected.getHeight()/2,GameScreen.selected.getWidth(), GameScreen.selected.getHeight(),1f,1f,rotation);
|
||||||
|
}
|
||||||
batcher.end();
|
batcher.end();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,6 @@ public class LevelRenderer {
|
||||||
Laser=new Laser();
|
Laser=new Laser();
|
||||||
AssetLoader.viewport.apply();
|
AssetLoader.viewport.apply();
|
||||||
font=AssetLoader.Skin_level.getFont("OpenDyslexicAlta-22");
|
font=AssetLoader.Skin_level.getFont("OpenDyslexicAlta-22");
|
||||||
font.setColor(AssetLoader.Levelcolors[LevelScreen.world]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void evolve() {
|
public void evolve() {
|
||||||
|
@ -70,7 +69,7 @@ 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);
|
||||||
|
font.setColor(AssetLoader.Levelcolors[LevelScreen.world]);
|
||||||
batcher.begin();
|
batcher.begin();
|
||||||
batcher.setProjectionMatrix(AssetLoader.Camera.combined);
|
batcher.setProjectionMatrix(AssetLoader.Camera.combined);
|
||||||
batcher.setColor(0.25f,0.25f,0.25f,1f);
|
batcher.setColor(0.25f,0.25f,0.25f,1f);
|
||||||
|
|
Loading…
Reference in New Issue