primera prueba
This commit is contained in:
@@ -4,24 +4,49 @@ import com.badlogic.gdx.ApplicationAdapter;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
|
||||
public class MyGdxGame extends ApplicationAdapter {
|
||||
SpriteBatch batch;
|
||||
Texture img;
|
||||
|
||||
BitmapFont font;
|
||||
int WIN_ALT;
|
||||
int WIN_ANCH;
|
||||
private TextureRegion[] regions = new TextureRegion[14]; // #2
|
||||
float contadorGif = 0;
|
||||
@Override
|
||||
public void create () {
|
||||
batch = new SpriteBatch();
|
||||
img = new Texture("badlogic.jpg");
|
||||
img = new Texture("125760.png");
|
||||
font = new BitmapFont(Gdx.files.internal("CentieSans.fnt"));
|
||||
WIN_ALT=900;
|
||||
WIN_ANCH=700;
|
||||
Gdx.graphics.setWindowedMode(WIN_ALT, WIN_ANCH);
|
||||
for(int i = 0; i<14; i++) {
|
||||
regions[i] = new TextureRegion(img, 39+i*49, 15, 40, 40);
|
||||
}
|
||||
//regions[0] = new TextureRegion(img, 40, 15, 40, 40); // #3
|
||||
//regions[1] = new TextureRegion(img, 88, 15, 40, 40); // #4
|
||||
//regions[2] = new TextureRegion(img, 88+48, 15, 40, 40); // #5
|
||||
//regions[3] = new TextureRegion(img, 0.5f, 0.5f, 1f, 1f); // #6
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render () {
|
||||
Gdx.gl.glClearColor(0, 0, 1, 1);
|
||||
Gdx.gl.glClearColor(0.5f, 0, 0, 1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
batch.begin();
|
||||
batch.draw(img, 0, 0);
|
||||
//batch.draw(img, 0, 0);
|
||||
contadorGif+=Gdx.graphics.getDeltaTime()*10;
|
||||
if(contadorGif>13) {
|
||||
contadorGif=0;
|
||||
}
|
||||
batch.draw(regions[(int)contadorGif], 75 * (0 + 1), 100);
|
||||
font.draw(batch, "iniciar", Gdx.graphics.getWidth()/3.75f,Gdx.graphics.getHeight()/2);
|
||||
font.draw(batch, "configuracion", Gdx.graphics.getWidth()/5,Gdx.graphics.getHeight()/4);
|
||||
batch.end();
|
||||
}
|
||||
|
||||
@@ -29,5 +54,6 @@ public class MyGdxGame extends ApplicationAdapter {
|
||||
public void dispose () {
|
||||
batch.dispose();
|
||||
img.dispose();
|
||||
font.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user