Hello everyone,
I’m new on this forum and very glad i found it because i’m developing a java game with LWJGL for my own enjoyment and i didn’t know about this community The game i develop is a mix between a card game and a tower defense, somewhat basic in the programming but i’m a beginner (and french so excuse me if my english is weird).
I have a question to which i didn’t find any answer. here goes :
In my game, the player can choose between multiple clans and i wondered where i can load the texture for the different clans ? Can i take my textures in an enum without loading them ? But the problem is I don’t want to load the texture of the other clans if they’re not being used. Here the code :
public enum Clan {
HUMAN("human.png"), ORC("orc.png");
private Texture texture = null;
private int texIdCards = 0;
private Clan(String texCard){
try{
texture = TextureLoader.getTexture("PNG" , ResourceLoader.getResourceAsStream(texCard));
texIdCards = texture.getTextureID();
} catch (Exception e){
System.out.println("Can't load Textures : " + texture);
}
}
public int getTexIdCards(){
return texIdCards;
}
}
Will the program load all the texture right when i’ll run it ? If the battle is Human versus Human, I don’t want the Orc texture to take any space in computer’s memory, so is it a good idea to put the loader Texture in an enum ?
Thank you very much!