gt: 				alpha( 0f );
context: /*
   * Pixel Dungeon
   * Copyright (C) 2012-2015  Oleg Dolya
   *
   * Shattered Pixel Dungeon
   * Copyright (C) 2014-2015 Evan Debenham
   *
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with this program.  If not, see <http://www.gnu.org/licenses/>
   */
  package com.minecraftpixeldungeon.scenes;
  
  import javax.microedition.khronos.opengles.GL10;
  
  import android.opengl.GLES20;
  
  import com.watabou.glwrap.Texture;
  import com.watabou.input.Touchscreen;
  import com.watabou.noosa.BitmapText;
  import com.watabou.noosa.BitmapText.Font;
  import com.watabou.noosa.BitmapTextMultiline;
  import com.watabou.noosa.Camera;
  import com.watabou.noosa.ColorBlock;
  import com.watabou.noosa.Game;
  import com.watabou.noosa.Scene;
  import com.watabou.noosa.Visual;
  import com.minecraftpixeldungeon.Assets;
  import com.minecraftpixeldungeon.Badges;
  import com.minecraftpixeldungeon.MinecraftPixelDungeon;
  import com.minecraftpixeldungeon.effects.BadgeBanner;
  import com.watabou.utils.BitmapCache;
  
  public class PixelScene extends Scene {
  
  	// Minimum virtual display size for portrait orientation
  	public static final float MIN_WIDTH_P        = 135;
  	public static final float MIN_HEIGHT_P        = 225;
  
  	// Minimum virtual display size for landscape orientation
  	public static final float MIN_WIDTH_L        = 240;
  	public static final float MIN_HEIGHT_L        = 160;
  
  	public static int defaultZoom = 0;
  	public static int maxDefaultZoom = 0;
  	public static float minZoom;
  	public static float maxZoom;
  
  	public static Camera uiCamera;
  
  	//stylized pixel font
  	public static BitmapText.Font pixelFont;
  	//These represent various mipmaps of the same font
  	public static BitmapText.Font font1x;
  	public static BitmapText.Font font2x;
  
  	@Override
  	public void create() {
  
  		super.create();
  
  		GameScene.scene = null;
  
  		float minWidth, minHeight;
  		if (MinecraftPixelDungeon.landscape()) {
  			minWidth = MIN_WIDTH_L;
  			minHeight = MIN_HEIGHT_L;
  		} else {
  			minWidth = MIN_WIDTH_P;
  			minHeight = MIN_HEIGHT_P;
  		}
  
  		maxDefaultZoom = (int)Math.min(Game.width/minWidth, Game.height/minHeight);
  		defaultZoom = MinecraftPixelDungeon.scale();
  
  		if (defaultZoom < Math.ceil( Game.density * 2 ) || defaultZoom > maxDefaultZoom){
  			defaultZoom = (int)Math.ceil( Game.density * 2.5 );
  			while ((
  				Game.width / defaultZoom < minWidth ||
  				Game.height / defaultZoom < minHeight
  			) && defaultZoom > 1) {
  				defaultZoom--;
  			}
  		}
  
  		minZoom = 1;
  		maxZoom = defaultZoom * 2;
  
  		Camera.reset( new PixelCamera( defaultZoom ) );
  
  		float uiZoom = defaultZoom;
  		uiCamera = Camera.createFullscreen( uiZoom );
  		Camera.add( uiCamera );
  
  		if (pixelFont == null) {
  
  			// 3x5 (6)
  			pixelFont = Font.colorMarked(
  				BitmapCache.get( Assets.PIXELFONT), 0x00000000, BitmapText.Font.LATIN_FULL );
  			pixelFont.baseLine = 6;
  			pixelFont.tracking = -1;
  
  			// 9x15 (18)
  			font1x = Font.colorMarked(
  					BitmapCache.get( Assets.FONT1X), 22, 0x00000000, BitmapText.Font.LATIN_FULL );
  			font1x.baseLine = 17;
  			font1x.tracking = -2;
  			font1x.texture.filter(Texture.LINEAR, Texture.LINEAR);
  
  			//font1x double scaled
  			font2x = Font.colorMarked(
  					BitmapCache.get( Assets.FONT2X), 44, 0x00000000, BitmapText.Font.LATIN_FULL );
  			font2x.baseLine = 38;
  			font2x.tracking = -4;
  			font2x.texture.filter(Texture.LINEAR, Texture.NEAREST);
  		}
  	}
  
  	@Override
  	public void destroy() {
  		super.destroy();
  		Touchscreen.event.removeAll();
  	}
  
  	public static BitmapText.Font font;
  	public static float scale;
  
  	public static void chooseFont( float size ) {
  		chooseFont( size, defaultZoom );
  	}
  
  	public static void chooseFont( float size, float zoom ) {
  
  		float pt = size * zoom;
  
  		if (pt >= 25) {
  
  			font = font2x;
  			scale = pt / 38f;
  
  		} else if (pt >= 12) {
  
  			font = font1x;
  			scale = pt / 19f;
  
  		} else {
  			font = pixelFont;
  			scale = 1f;
  		}
  
  		scale /= zoom;
  	}
  	
  	public static BitmapText createText( float size ) {
  		return createText( null, size );
  	}
  	
  	public static BitmapText createText( String text, float size ) {
  		
  		chooseFont( size );
  		
  		BitmapText result = new BitmapText( text, font );
  		result.scale.set( scale );
  		
  		return result;
  	}
  	
  	public static BitmapTextMultiline createMultiline( float size ) {
  		return createMultiline( null, size );
  	}
  	
  	public static BitmapTextMultiline createMultiline( String text, float size ) {
  		
  		chooseFont( size );
  		
  		BitmapTextMultiline result = new BitmapTextMultiline( text, font );
  		result.scale.set( scale );
  		
  		return result;
  	}
  
  	public static boolean noFade = false;
  	protected void fadeIn() {
  		if (noFade) {
  			noFade = false;
  		} else {
  			fadeIn( 0xFF000000, false );
  		}
  	}
  	
  	protected void fadeIn( int color, boolean light ) {
  		add( new Fader( color, light ) );
  	}
  	
  	public static void showBadge( Badges.Badge badge ) {
  		BadgeBanner banner = BadgeBanner.show( badge.image );
  		banner.camera = uiCamera;
  		banner.x = (banner.camera.width - banner.width) / 2 ;
  		banner.y = (banner.camera.height - banner.height) / 3 ;
  		Game.scene().add( banner );
  	}
  	
  	protected static class Fader extends ColorBlock {
  		
  		private static float FADE_TIME = 1f;
  		
  		private boolean light;
  		
  		private float time;
  		
  		public Fader( int color, boolean light ) {
  			super( uiCamera.width, uiCamera.height, color );
  			
  			this.light = light;
  			
  			camera = uiCamera;
  			
  			alpha( 1f );
  			time = FADE_TIME;
  		}
  		
  		@Override
  		public void update() {
  			
  			super.update();
  			
  			if ((time -= Game.elapsed) <= 0) {
  