158 lines
6.8 KiB
Java
158 lines
6.8 KiB
Java
package shootergame.init;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import org.lwjgl.opengl.GL;
|
|
|
|
import shootergame.display.DisplayWindow;
|
|
import shootergame.util.gl.texture.TextureMap;
|
|
import shootergame.util.gl.texture.TextureReference;
|
|
import shootergame.util.gl.texture.AnimationReference;
|
|
|
|
public class Textures
|
|
{
|
|
public static void initTextures(DisplayWindow window)
|
|
{
|
|
// Make the context current
|
|
window.makeContextCurrent();
|
|
GL.createCapabilities();
|
|
|
|
// Initiaize all the textures
|
|
texmap.init();
|
|
}
|
|
|
|
public static final ArrayList<AnimationReference> animations = new ArrayList<AnimationReference>();
|
|
|
|
public static final TextureMap texmap = new TextureMap(16, Resources.TEXMAP_PNG);
|
|
|
|
public static final TextureReference TILE_GRASS = texmap.getTextureReference(0, 1, 0, 1);
|
|
public static final TextureReference TILE_SAND = texmap.getTextureReference(1, 2, 0, 1);
|
|
public static final TextureReference TILE_STONE = texmap.getTextureReference(2, 3, 0, 1);
|
|
public static final TextureReference TILE_DIRT = texmap.getTextureReference(3, 4, 0, 1);
|
|
public static final TextureReference TILE_TREE = texmap.getTextureReference(4, 5, 0, 4);
|
|
public static final TextureReference TILE_ROCK = texmap.getTextureReference(4, 5, 4, 5);
|
|
public static final TextureReference ENTITY_TNT = texmap.getTextureReference(4, 5, 5, 6);
|
|
public static final TextureReference TILE_LADDER = texmap.getTextureReference(3, 4, 4, 5);
|
|
public static final TextureReference TILE_PORTAL = texmap.getTextureReference(3, 4, 5, 6);
|
|
public static final TextureReference TILE_WALL = texmap.getTextureReference(2, 3, 5, 6);
|
|
public static final TextureReference TILE_LADDER_UP = texmap.getTextureReference(16, 17, 0, 16);
|
|
public static final TextureReference TILE_CHEST = texmap.getTextureReference(2, 3, 4, 5);
|
|
|
|
public static final TextureReference UI_HEALTH_FG = texmap.getTextureReference(0, 16, 11, 12);
|
|
public static final TextureReference UI_HEALTH_BG = texmap.getTextureReference(0, 16, 12, 13);
|
|
public static final TextureReference UI_ITEM_SLOTS = texmap.getTextureReference(0, 12, 13, 15);
|
|
public static final TextureReference UI_ACTIVE_SLOT = texmap.getTextureReference(12, 14, 13, 15);
|
|
|
|
public static final TextureReference ITEM_HEALTH_POTION = texmap.getTextureReference(0, 1, 5, 6);
|
|
public static final TextureReference ITEM_AMMO_BOX = texmap.getTextureReference(1, 2, 5, 6);
|
|
public static final TextureReference ITEM_GUN_UPGRADE = texmap.getTextureReference(0, 1, 4, 5);
|
|
public static final TextureReference ITEM_DEFENCE_UPGRADE = texmap.getTextureReference(1, 2, 4, 5);
|
|
|
|
// Fire
|
|
public static final TextureReference TILE_FIRE_0 = texmap.getTextureReference(0, 1, 1, 2);
|
|
public static final TextureReference TILE_FIRE_1 = texmap.getTextureReference(1, 2, 1, 2);
|
|
public static final TextureReference TILE_FIRE_2 = texmap.getTextureReference(2, 3, 1, 2);
|
|
public static final TextureReference TILE_FIRE_3 = texmap.getTextureReference(3, 4, 1, 2);
|
|
public static final TextureReference TILE_FIRE = new AnimationReference(
|
|
8, TILE_FIRE_0, TILE_FIRE_1, TILE_FIRE_2, TILE_FIRE_3);
|
|
|
|
// Player
|
|
public static final TextureReference ENTITY_PLAYER_STILL = texmap.getTextureReference(0, 1, 2, 3);
|
|
public static final TextureReference ENTITY_PLAYER_MOVING = new AnimationReference(10,
|
|
texmap.getTextureReference(0, 1, 2, 3),
|
|
texmap.getTextureReference(1, 2, 2, 3),
|
|
texmap.getTextureReference(2, 3, 2, 3),
|
|
texmap.getTextureReference(3, 4, 2, 3)
|
|
);
|
|
|
|
// Zombie
|
|
public static final TextureReference ENTITY_ZOMBIE = new AnimationReference(10,
|
|
texmap.getTextureReference(0, 1, 3, 4),
|
|
texmap.getTextureReference(1, 2, 3, 4),
|
|
texmap.getTextureReference(2, 3, 3, 4),
|
|
texmap.getTextureReference(3, 4, 3, 4)
|
|
);
|
|
|
|
// Water
|
|
public static final TextureReference TILE_WATER = new AnimationReference(10,
|
|
texmap.getTextureReference(0, 1, 8, 9),
|
|
texmap.getTextureReference(1, 2, 8, 9),
|
|
texmap.getTextureReference(2, 3, 8, 9),
|
|
texmap.getTextureReference(3, 4, 8, 9),
|
|
texmap.getTextureReference(4, 5, 8, 9),
|
|
texmap.getTextureReference(5, 6, 8, 9),
|
|
texmap.getTextureReference(6, 7, 8, 9),
|
|
texmap.getTextureReference(7, 8, 8, 9),
|
|
texmap.getTextureReference(8, 9, 8, 9),
|
|
texmap.getTextureReference(9, 10, 8, 9),
|
|
texmap.getTextureReference(10, 11, 8, 9),
|
|
texmap.getTextureReference(11, 12, 8, 9),
|
|
texmap.getTextureReference(12, 13, 8, 9),
|
|
texmap.getTextureReference(13, 14, 8, 9),
|
|
texmap.getTextureReference(14, 15, 8, 9),
|
|
texmap.getTextureReference(15, 16, 8, 9)
|
|
);
|
|
|
|
// Lava
|
|
public static final TextureReference TILE_LAVA = new AnimationReference(20,
|
|
texmap.getTextureReference(0, 1, 6, 7),
|
|
texmap.getTextureReference(1, 2, 6, 7),
|
|
texmap.getTextureReference(2, 3, 6, 7),
|
|
texmap.getTextureReference(3, 4, 6, 7),
|
|
texmap.getTextureReference(4, 5, 6, 7),
|
|
texmap.getTextureReference(5, 6, 6, 7),
|
|
texmap.getTextureReference(6, 7, 6, 7),
|
|
texmap.getTextureReference(7, 8, 6, 7),
|
|
texmap.getTextureReference(8, 9, 6, 7),
|
|
texmap.getTextureReference(9, 10, 6, 7),
|
|
texmap.getTextureReference(10, 11, 6, 7),
|
|
texmap.getTextureReference(11, 12, 6, 7),
|
|
texmap.getTextureReference(12, 13, 6, 7),
|
|
texmap.getTextureReference(13, 14, 6, 7),
|
|
texmap.getTextureReference(14, 15, 6, 7),
|
|
texmap.getTextureReference(15, 16, 6, 7)
|
|
);
|
|
|
|
// Water flow
|
|
public static final TextureReference TILE_WATER_FLOW = new AnimationReference(20,
|
|
texmap.getTextureReference(0, 1, 9, 10),
|
|
texmap.getTextureReference(1, 2, 9, 10),
|
|
texmap.getTextureReference(2, 3, 9, 10),
|
|
texmap.getTextureReference(3, 4, 9, 10),
|
|
texmap.getTextureReference(4, 5, 9, 10),
|
|
texmap.getTextureReference(5, 6, 9, 10),
|
|
texmap.getTextureReference(6, 7, 9, 10),
|
|
texmap.getTextureReference(7, 8, 9, 10),
|
|
texmap.getTextureReference(8, 9, 9, 10),
|
|
texmap.getTextureReference(9, 10, 9, 10),
|
|
texmap.getTextureReference(10, 11, 9, 10),
|
|
texmap.getTextureReference(11, 12, 9, 10),
|
|
texmap.getTextureReference(12, 13, 9, 10),
|
|
texmap.getTextureReference(13, 14, 9, 10),
|
|
texmap.getTextureReference(14, 15, 9, 10),
|
|
texmap.getTextureReference(15, 16, 9, 10)
|
|
);
|
|
|
|
// Lava flow
|
|
public static final TextureReference TILE_LAVA_FLOW = new AnimationReference(10,
|
|
texmap.getTextureReference(0, 1, 7, 8),
|
|
texmap.getTextureReference(1, 2, 7, 8),
|
|
texmap.getTextureReference(2, 3, 7, 8),
|
|
texmap.getTextureReference(3, 4, 7, 8),
|
|
texmap.getTextureReference(4, 5, 7, 8),
|
|
texmap.getTextureReference(5, 6, 7, 8),
|
|
texmap.getTextureReference(6, 7, 7, 8),
|
|
texmap.getTextureReference(7, 8, 7, 8),
|
|
texmap.getTextureReference(8, 9, 7, 8),
|
|
texmap.getTextureReference(9, 10, 7, 8),
|
|
texmap.getTextureReference(10, 11, 7, 8),
|
|
texmap.getTextureReference(11, 12, 7, 8),
|
|
texmap.getTextureReference(12, 13, 7, 8),
|
|
texmap.getTextureReference(13, 14, 7, 8),
|
|
texmap.getTextureReference(14, 15, 7, 8),
|
|
texmap.getTextureReference(15, 16, 7, 8)
|
|
);
|
|
|
|
|
|
}
|