}
@Override
public void draw(PU_Rect drawArea)
{
PU_Player self = PUWeb.game().getSelf();
// Pokemon bar
PU_Image pokemonBar = PUWeb.resources().getGuiImage(GuiImages.IMG_GUI_WORLD_POKEMONBAR);
if(pokemonBar != null)
{
pokemonBar.draw(193, 11);
}
// The following routine might not seem very efficient,
// but since webgl is the slowest element in the program - this is the best thing to do
PU_Image pokemonSlot = PUWeb.resources().getGuiImage(GuiImages.IMG_GUI_WORLD_POKEMONSLOT);
if(pokemonSlot != null)
{
// First draw all slots (to avoid texture switching)
for(int i = 0; i < 6; i++)
{
pokemonSlot.draw(201+(i*(pokemonSlot.getWidth()+2)), 14);
}
if(self != null)
{
// Now draw our pokemon icons in a batch
int pokemonCount = self.getPokemonCount();
if(pokemonCount > 0)
{
WebGLTexture pokemonTexture = PUWeb.resources().getPokemonTexture();
if(pokemonTexture != null)
{
PUWeb.engine().beginTextureBatch(pokemonTexture, 2048, pokemonCount, 255, 255, 255, 255);
for(int i = 0; i < 6; i++)
{
PU_Pokemon pokemon = self.getPokemon(i);
if(pokemon != null)
{
PU_Image pokemonIcon = PUWeb.resources().getPokemonIcon(pokemon.getSpeciesId());
if(pokemonIcon != null)
{