--- /dev/null
+/*******************************************************************************\r
+ * Copyright 2010 Mario Zechner (contact@badlogicgames.com)\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the\r
+ * License. You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"\r
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language\r
+ * governing permissions and limitations under the License.\r
+ ******************************************************************************/\r
+\r
+package com.badlogic.gdx.tests;\r
+\r
+import com.badlogic.gdx.Gdx;\r
+import com.badlogic.gdx.InputProcessor;\r
+import com.badlogic.gdx.graphics.Sprite;\r
+import com.badlogic.gdx.graphics.SpriteCache;\r
+import com.badlogic.gdx.tests.utils.GdxTest;\r
+\r
+import static com.badlogic.gdx.graphics.Texture.TextureFilter.*;\r
+import static com.badlogic.gdx.graphics.Texture.TextureWrap.*;\r
+\r
+public class SpriteCacheOffsetTest extends GdxTest implements InputProcessor {\r
+ private int tileMapWidth = 10;\r
+ private int tileMapHeight = 5;\r
+ private int tileSize = 32;\r
+ private SpriteCache cache;\r
+\r
+ public void create () {\r
+ Sprite sprite = new Sprite(Gdx.graphics.newTexture(Gdx.files.internal("data/badlogicsmall.jpg"), Linear, Linear,\r
+ ClampToEdge, ClampToEdge));\r
+ sprite.setSize(tileSize, tileSize);\r
+\r
+ cache = new SpriteCache(1000);\r
+ for (int y = 0; y < tileMapHeight; y++) {\r
+ cache.beginCache();\r
+ for (int x = 0; x < tileMapWidth; x++) {\r
+ sprite.setPosition(x * tileSize, y * tileSize);\r
+ cache.add(sprite);\r
+ }\r
+ cache.endCache();\r
+ sprite.rotate(90);\r
+ }\r
+ }\r
+\r
+ public void render () {\r
+ cache.begin();\r
+ for (int y = 1; y < tileMapHeight - 1; y++)\r
+ cache.draw(y, 1, tileMapWidth - 2);\r
+ cache.end();\r
+ }\r
+\r
+ public boolean keyDown (int keycode) {\r
+ return false;\r
+ }\r
+\r
+ public boolean keyUp (int keycode) {\r
+ return false;\r
+ }\r
+\r
+ public boolean keyTyped (char character) {\r
+ return false;\r
+ }\r
+\r
+ public boolean touchDown (int x, int y, int pointer) {\r
+ return false;\r
+ }\r
+\r
+ public boolean touchUp (int x, int y, int pointer) {\r
+ return false;\r
+ }\r
+\r
+ public boolean touchDragged (int x, int y, int pointer) {\r
+ return false;\r
+ }\r
+\r
+ public boolean needsGL20 () {\r
+ return false;\r
+ }\r
+}\r
import com.badlogic.gdx.tests.MultitouchTest;\r
import com.badlogic.gdx.tests.MyFirstTriangle;\r
import com.badlogic.gdx.tests.ObjTest;\r
-import com.badlogic.gdx.tests.PixmapBlendingTest;\r
-import com.badlogic.gdx.tests.SpritePerformanceTest;\r
-import com.badlogic.gdx.tests.SpriteSheetTest;\r
import com.badlogic.gdx.tests.ParticleEmitterTest;\r
import com.badlogic.gdx.tests.PixelsPerInchTest;\r
+import com.badlogic.gdx.tests.PixmapBlendingTest;\r
import com.badlogic.gdx.tests.Pong;\r
import com.badlogic.gdx.tests.SimpleTest;\r
import com.badlogic.gdx.tests.SoundTest;\r
import com.badlogic.gdx.tests.SpriteBatchShaderTest;\r
import com.badlogic.gdx.tests.SpriteBatchTest;\r
import com.badlogic.gdx.tests.SpriteCacheTest;\r
+import com.badlogic.gdx.tests.SpriteCacheOffsetTest;\r
+import com.badlogic.gdx.tests.SpritePerformanceTest;\r
+import com.badlogic.gdx.tests.SpriteSheetTest;\r
import com.badlogic.gdx.tests.StageTest;\r
import com.badlogic.gdx.tests.TerrainTest;\r
import com.badlogic.gdx.tests.TextureRenderTest;\r
SimpleTest.class,\r
SoundTest.class,\r
SpriteCacheTest.class,\r
+ SpriteCacheOffsetTest.class,\r
SpriteBatchRotationTest.class,\r
SpriteBatchShaderTest.class,\r
SpriteBatchTest.class,\r