Skip to content

Instantly share code, notes, and snippets.

@picopicolab
Created November 3, 2015 07:49
Show Gist options
  • Save picopicolab/8530fd02a05b8548130f to your computer and use it in GitHub Desktop.
Save picopicolab/8530fd02a05b8548130f to your computer and use it in GitHub Desktop.
テクスチャ描画サンプル実装
package com.github.picopicolab.games.demo;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.FPSLogger;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
/**
* テクスチャ描画サンプル実装
*/
public class DemoGame extends ApplicationAdapter {
private SpriteBatch batch;
private Texture img;
private FPSLogger logger;
@Override
public void create() {
batch = new SpriteBatch();
img = new Texture("picopicolab.png"); // 画像読込
logger = new FPSLogger();
}
@Override
public void render() {
Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
// 画像描画
batch.begin();
batch.draw(img, 0, 0);
batch.end();
// FPS 出力
logger.log();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment