您好,登录后才能下订单哦!
package com.me.mygdxgame;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
public class MyGdxGame implements ApplicationListener{
Stage stage;
@Override
public void create() {
stage= new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
TextureAtlas atlas= new TextureAtlas(Gdx.files.internal("data/pack")); // 根据pack文件获取所有图片
Image p_w_picpath2= new Image(atlas.findRegion("14")); // 获取名为14的图片,并创建一个Image对象
p_w_picpath2.scale(0.02f, 0.02f);
p_w_picpath2.setPosition(200, 50);
Image p_w_picpath3= new Image(atlas.findRegion("6"));
p_w_picpath2.setPosition(40, 40);
p_w_picpath2.scale(0.5f, 0.5f);
stage.addActor(p_w_picpath2);
stage.addActor(p_w_picpath3);
}
@Override
public void dispose() {
stage.dispose();
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void render() {
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
stage.act(Gdx.graphics.getDeltaTime());
stage.draw();
}
@Override
public void resize( int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void resume() {
// TODO Auto-generated method stub
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。