【发布时间】:2016-05-21 15:14:55
【问题描述】:
我的脚本每次在 android studio 上运行时都会显示图像,但每次尝试运行脚本时都会出现错误,它是为了显示王牌面孔的有趣图片而发布的。我不确定为什么每次运行脚本时都会出现错误,因为当我输入笑脸图像时它会起作用。
这是脚本:
package com.udacity.gamedev.logging;
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.SpriteBatch;
public class LoggingDemo extends ApplicationAdapter {
// TODO: Give your ApplicationListener a log TAG]
public static final String TAG = LoggingDemo.class.getName();
SpriteBatch batch;
Texture img;
@Override
public void create() {
batch = new SpriteBatch();
img = new Texture("Trump.jpg");
// TODO: Use Gdx.app to find what ApplicationType we're running
// TODO: Use Gdx.app to log the result
Gdx.app.log(TAG, "We're running on" +
Gdx.app.getType()
);
}
@Override
public void render() {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(img, 0, 0);
batch.end();
}
// TODO: Run the Desktop app and find your log message
// TODO: Run the Android app and find your log message
}
【问题讨论】:
标签: java android-studio libgdx android-image