1 /******************************************************************************* 2 * Copyright 2011 See AUTHORS file. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 ******************************************************************************/ 16 17 package com.badlogic.gdx.tests; 18 19 import com.badlogic.gdx.Gdx; 20 import com.badlogic.gdx.graphics.GL20; 21 import com.badlogic.gdx.graphics.Texture; 22 import com.badlogic.gdx.graphics.g2d.SpriteBatch; 23 import com.badlogic.gdx.tests.utils.GdxTest; 24 25 public class BlitTest extends GdxTest { 26 27 Texture rgb888; 28 Texture rgba8888; 29 Texture psRgb888; 30 Texture psRgba8888; 31 SpriteBatch batch; 32 create()33 public void create () { 34 rgb888 = new Texture("data/bobrgb888-32x32.png"); 35 rgba8888 = new Texture("data/bobargb8888-32x32.png"); 36 psRgb888 = new Texture("data/alpha.png"); 37 psRgba8888 = new Texture("data/rgb.png"); 38 batch = new SpriteBatch(); 39 } 40 render()41 public void render () { 42 Gdx.gl.glClearColor(0.4f, 0.4f, 0.4f, 1); 43 Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); 44 45 batch.begin(); 46 batch.draw(rgb888, 0, 0); 47 batch.draw(rgba8888, 60, 0); 48 batch.draw(psRgb888, 0, 60); 49 batch.draw(psRgba8888, psRgb888.getWidth() + 20, 60); 50 batch.end(); 51 } 52 53 @Override dispose()54 public void dispose () { 55 batch.dispose(); 56 rgb888.dispose(); 57 rgba8888.dispose(); 58 psRgb888.dispose(); 59 psRgba8888.dispose(); 60 } 61 } 62