
//Change this to true for a stretchy canvas!
//
var RESIZEABLE_CANVAS=false;

//Start us up!
//
window.onload=function( e ){

	if( RESIZEABLE_CANVAS ){
		window.onresize=function( e ){
			var canvas=document.getElementById( "GameCanvas" );

			//This vs window.innerWidth, which apparently doesn't account for scrollbar?
			var width=document.body.clientWidth;
			
			//This vs document.body.clientHeight, which does weird things - document seems to 'grow'...perhaps canvas resize pushing page down?
			var height=window.innerHeight;			

			canvas.width=width;
			canvas.height=height;
		}
		window.onresize( null );
	}
	
	game_canvas=document.getElementById( "GameCanvas" );
	
	game_console=document.getElementById( "GameConsole" );

	try{
	
		bbInit();
		bbMain();
		
		if( game_runner!=null ) game_runner();
		
	}catch( err ){
	
		showError( err );
	}
}

//Globals
var game_canvas;
var game_console;
var game_runner;

//${METADATA_BEGIN}
var META_DATA="[1.jpg];type=image/jpg;width=1800;height=1200;\n[2.jpg];type=image/jpg;width=1800;height=1200;\n[3.jpg];type=image/jpg;width=1800;height=1200;\n[4.jpg];type=image/jpg;width=900;height=600;\n[5.jpg];type=image/jpg;width=525;height=656;\n[6.jpg];type=image/jpg;width=900;height=506;\n[mojo_font.png];type=image/png;width=864;height=13;\n";

//${METADATA_END}
function getMetaData( path,key ){	
	var i=META_DATA.indexOf( "["+path+"]" );
	if( i==-1 ) return "";
	i+=path.length+2;

	var e=META_DATA.indexOf( "\n",i );
	if( e==-1 ) e=META_DATA.length;

	i=META_DATA.indexOf( ";"+key+"=",i )
	if( i==-1 || i>=e ) return "";
	i+=key.length+2;

	e=META_DATA.indexOf( ";",i );
	if( e==-1 ) return "";

	return META_DATA.slice( i,e );
}

function loadString( path ){
	if( path=="" ) return "";
//${TEXTFILES_BEGIN}
		return "";

//${TEXTFILES_END}
}

function loadImage( path,onloadfun ){
	var ty=getMetaData( path,"type" );
	if( ty.indexOf( "image/" )!=0 ) return null;

	var image=new Image();
	
	image.meta_width=parseInt( getMetaData( path,"width" ) );
	image.meta_height=parseInt( getMetaData( path,"height" ) );
	image.onload=onloadfun;
	image.src="data/"+path;
	
	return image;
}

function loadAudio( path ){
	var audio=new Audio( "data/"+path );
	return audio;
}

//${TRANSCODE_BEGIN}

// Javascript Monkey runtime.
//
// Placed into the public domain 24/02/2011.
// No warranty implied; use at your own risk.

//***** JavaScript Runtime *****

var D2R=0.017453292519943295;
var R2D=57.29577951308232;

var err_info="";
var err_stack=[];

function push_err(){
	err_stack.push( err_info );
}

function pop_err(){
	err_info=err_stack.pop();
}

function stackTrace(){
	var str="";
	push_err();
	err_stack.reverse();
	for( var i=0;i<err_stack.length;++i ){
		str+=err_stack[i]+"\n";
	}
	err_stack.reverse();
	pop_err();
	return str;
}

function print( str ){
	if( game_console ){
		game_console.value+=str+"\n";
		game_console.scrollTop = game_console.scrollHeight - game_console.clientHeight;
	}
	if( window.console!=undefined ){
		window.console.log( str );
	}
}

function showError( err ){
	if( err.length ) alert( "Monkey runtime error: "+err+"\n"+stackTrace() );
}

function error( err ){
	throw err;
}

function dbg_object( obj ){
	if( obj ) return obj;
	error( "Null object access" );
}

function dbg_array( arr,index ){
	if( index>=0 && index<arr.length ) return arr;
	error( "Array index out of range" );
}

function new_bool_array( len ){
	var arr=Array( len );
	for( var i=0;i<len;++i ) arr[i]=false;
	return arr;
}

function new_number_array( len ){
	var arr=Array( len );
	for( var i=0;i<len;++i ) arr[i]=0;
	return arr;
}

function new_string_array( len ){
	var arr=Array( len );
	for( var i=0;i<len;++i ) arr[i]='';
	return arr;
}

function new_array_array( len ){
	var arr=Array( len );
	for( var i=0;i<len;++i ) arr[i]=[];
	return arr;
}

function new_object_array( len ){
	var arr=Array( len );
	for( var i=0;i<len;++i ) arr[i]=null;
	return arr;
}

function resize_bool_array( arr,len ){
	var i=arr.length;
	arr=arr.slice(0,len);
	if( len<=i ) return arr;
	arr.length=len;
	while( i<len ) arr[i++]=false;
	return arr;
}

function resize_number_array( arr,len ){
	var i=arr.length;
	arr=arr.slice(0,len);
	if( len<=i ) return arr;
	arr.length=len;
	while( i<len ) arr[i++]=0;
	return arr;
}

function resize_string_array( arr,len ){
	var i=arr.length;
	arr=arr.slice(0,len);
	if( len<=i ) return arr;
	arr.length=len;
	while( i<len ) arr[i++]="";
	return arr;
}

function resize_array_array( arr,len ){
	var i=arr.length;
	arr=arr.slice(0,len);
	if( len<=i ) return arr;
	arr.length=len;
	while( i<len ) arr[i++]=[];
	return arr;
}

function resize_object_array( arr,len ){
	var i=arr.length;
	arr=arr.slice(0,len);
	if( len<=i ) return arr;
	arr.length=len;
	while( i<len ) arr[i++]=null;
	return arr;
}

function string_compare( lhs,rhs ){
	var n=Math.min( lhs.length,rhs.length ),i,t;
	for( i=0;i<n;++i ){
		t=lhs.charCodeAt(i)-rhs.charCodeAt(i);
		if( t ) return t;
	}
	return lhs.length-rhs.length;
}

function string_replace( str,find,rep ){	//no unregex replace all?!?
	var i=0;
	for(;;){
		i=str.indexOf( find,i );
		if( i==-1 ) return str;
		str=str.substring( 0,i )+rep+str.substring( i+find.length );
		i+=rep.length;
	}
}

function string_trim( str ){
	var i=0,i2=str.length;
	while( i<i2 && str.charCodeAt(i)<=32 ) i+=1;
	while( i2>i && str.charCodeAt(i2-1)<=32 ) i2-=1;
	return str.slice( i,i2 );
}

function string_starts_with( str,substr ){
	return substr.length<=str.length && str.slice(0,substr.length)==substr;
}

function string_ends_with( str,substr ){
	return substr.length<=str.length && str.slice(str.length-substr.length,str.length)==substr;
}

function object_downcast( obj,clas ){
	if( obj instanceof clas ) return obj;
	return null;
}

function object_implements( obj,iface ){
	if( obj && obj.implments && obj.implments[iface] ) return obj;
	return null;
}

function extend_class( clas ){
	var tmp=function(){};
	tmp.prototype=clas.prototype;
	return new tmp;
}

// HTML5 mojo runtime.
//
// Copyright 2011 Mark Sibly, all rights reserved.
// No warranty implied; use at your own risk.

var dead=false;

var KEY_LMB=1;
var KEY_RMB=2;
var KEY_MMB=3;
var KEY_TOUCH0=0x180;

function eatEvent( e ){
	if( e.stopPropagation ){
		e.stopPropagation();
		e.preventDefault();
	}else{
		e.cancelBubble=true;
		e.returnValue=false;
	}
}

function keyToChar( key ){
	switch( key ){
	case 8:
	case 9:
	case 13:
	case 27:
	case 32:
		return key;
	case 33:
	case 34:
	case 35:
	case 36:
	case 37:
	case 38:
	case 39:
	case 40:
	case 45:
		return key | 0x10000;
	case 46:
		return 127;
	}
	return 0;
}

//***** gxtkApp class *****

function gxtkApp(){

	this.graphics=new gxtkGraphics( this,game_canvas );
	this.input=new gxtkInput( this );
	this.audio=new gxtkAudio( this );

	this.loading=0;
	this.maxloading=0;

	this.updateRate=0;
	
	this.startMillis=(new Date).getTime();
	
	this.suspended=false;
	
	var app=this;
	var canvas=game_canvas;
	
	function gxtkMain(){
		canvas.onkeydown=function( e ){
			app.input.OnKeyDown( e.keyCode );
			var chr=keyToChar( e.keyCode );
			if( chr ) app.input.PutChar( chr );
			if( e.keyCode<48 || (e.keyCode>111 && e.keyCode<122) ) eatEvent( e );
		}

		canvas.onkeyup=function( e ){
			app.input.OnKeyUp( e.keyCode );
		}

		canvas.onkeypress=function( e ){
			if( e.charCode ){
				app.input.PutChar( e.charCode );
			}else if( e.which ){
				app.input.PutChar( e.which );
			}
		}

		canvas.onmousedown=function( e ){
			switch( e.button ){
			case 0:app.input.OnKeyDown( KEY_LMB );break;
			case 1:app.input.OnKeyDown( KEY_MMB );break;
			case 2:app.input.OnKeyDown( KEY_RMB );break;
			}
			eatEvent( e );
		}
		
		canvas.onmouseup=function( e ){
			switch( e.button ){
			case 0:app.input.OnKeyUp( KEY_LMB );break;
			case 1:app.input.OnKeyUp( KEY_MMB );break;
			case 2:app.input.OnKeyUp( KEY_RMB );break;
			}
			eatEvent( e );
		}
		
		canvas.onmouseout=function( e ){
			app.input.OnKeyUp( KEY_LMB );
			app.input.OnKeyUp( KEY_MMB );
			app.input.OnKeyUp( KEY_RMB );
			eatEvent( e );
		}

		canvas.onmousemove=function( e ){
			var x=e.clientX+document.body.scrollLeft;
			var y=e.clientY+document.body.scrollTop;
			var c=canvas;
			while( c ){
				x-=c.offsetLeft;
				y-=c.offsetTop;
				c=c.offsetParent;
			}
			app.input.OnMouseMove( x,y );
			eatEvent( e );
		}

		canvas.onfocus=function( e ){
			//app.InvokeOnResume();
		}
		
		canvas.onblur=function( e ){
			//app.InvokeOnSuspend();
		}

		canvas.focus();

		app.InvokeOnCreate();
		app.InvokeOnRender();
	}
	
	game_runner=gxtkMain;
}

var timerSeq=0;

gxtkApp.prototype.SetFrameRate=function( fps ){

	var seq=++timerSeq;
	
	if( !fps ) return;
	
	var app=this;
	var updatePeriod=1000.0/fps;
	var nextUpdate=(new Date).getTime()+updatePeriod;
	
	function timeElapsed(){
		if( seq!=timerSeq ) return;

		var time;		
		var updates=0;

		for(;;){
			nextUpdate+=updatePeriod;

			app.InvokeOnUpdate();
			if( seq!=timerSeq ) return;
			
			if( nextUpdate>(new Date).getTime() ) break;
			
			if( ++updates==7 ){
				nextUpdate=(new Date).getTime();
				break;
			}
		}
		app.InvokeOnRender();
		if( seq!=timerSeq ) return;
			
		var delay=nextUpdate-(new Date).getTime();
		setTimeout( timeElapsed,delay>0 ? delay : 0 );
	}
	
	setTimeout( timeElapsed,updatePeriod );
}

gxtkApp.prototype.IncLoading=function(){
	++this.loading;
	if( this.loading>this.maxloading ) this.maxloading=this.loading;
	if( this.loading==1 ) this.SetFrameRate( 0 );
}

gxtkApp.prototype.DecLoading=function(){
	--this.loading;
	if( this.loading!=0 ) return;
	this.maxloading=0;
	this.SetFrameRate( this.updateRate );
}

gxtkApp.prototype.GetMetaData=function( path,key ){
	return getMetaData( path,key );
}

gxtkApp.prototype.Die=function( err ){
	dead=true;
	this.audio.OnSuspend();
	showError( err );
}

gxtkApp.prototype.InvokeOnCreate=function(){
	if( dead ) return;
	
	try{
		this.OnCreate();
	}catch( ex ){
		this.Die( ex );
	}
}

gxtkApp.prototype.InvokeOnUpdate=function(){
	if( dead || this.suspended || !this.updateRate || this.loading ) return;
	
	try{
		this.input.BeginUpdate();
		this.OnUpdate();		
		this.input.EndUpdate();
	}catch( ex ){
		this.Die( ex );
	}
}

gxtkApp.prototype.InvokeOnSuspend=function(){
	if( dead || this.suspended ) return;
	
	try{
		this.suspended=true;
		this.OnSuspend();
		this.audio.OnSuspend();
	}catch( ex ){
		this.Die( ex );
	}
}

gxtkApp.prototype.InvokeOnResume=function(){
	if( dead || !this.suspended ) return;
	
	try{
		this.audio.OnResume();
		this.OnResume();
		this.suspended=false;
	}catch( ex ){
		this.Die( ex );
	}
}

gxtkApp.prototype.InvokeOnRender=function(){
	if( dead || this.suspended ) return;
	
	try{
		this.graphics.BeginRender();
		if( this.loading ){
			this.OnLoading();
		}else{
			this.OnRender();
		}
		this.graphics.EndRender();
	}catch( ex ){
		this.Die( ex );
	}
}

//***** GXTK API *****

gxtkApp.prototype.GraphicsDevice=function(){
	return this.graphics;
}

gxtkApp.prototype.InputDevice=function(){
	return this.input;
}

gxtkApp.prototype.AudioDevice=function(){
	return this.audio;
}

gxtkApp.prototype.AppTitle=function(){
	return document.URL;
}

gxtkApp.prototype.LoadState=function(){
	//use cookies for file:// URLS in FF and IE...
	if( document.URL.toLowerCase().substr(0,7)=="file://" &&
			(navigator.userAgent.indexOf( "Firefox" )!=-1 || navigator.userAgent.indexOf( "MSIE" )!=-1) ){
		var bits=document.cookie.split( ";" )
		if( bits.length!=1 ) return "";
		bits=bits[0].split( "=" );
		if( bits.length!=2 || bits[0]!=".mojostate" ) return "";
		return unescape( bits[1] );
	}else{
		var state=localStorage.getItem( ".mojostate@"+document.URL );
		if( state ) return state;
	}
	return "";
}

gxtkApp.prototype.SaveState=function( state ){
	//use cookies for file:// URLS in FF and IE...
	if( document.URL.toLowerCase().substr(0,7)=="file://" &&
			(navigator.userAgent.indexOf( "Firefox" )!=-1 || navigator.userAgent.indexOf( "MSIE" )!=-1) ){
		var exdate=new Date();
		exdate.setDate( exdate.getDate()+3650 );
		document.cookie=".mojostate="+escape( state )+"; expires="+exdate.toUTCString()
	}else{
		localStorage.setItem( ".mojostate@"+document.URL,state );
	}
}

gxtkApp.prototype.LoadString=function( path ){
	return loadString( path );
}

gxtkApp.prototype.SetUpdateRate=function( fps ){
	this.updateRate=fps;
	
	if( !this.loading ) this.SetFrameRate( fps );
}

gxtkApp.prototype.MilliSecs=function(){
	return ((new Date).getTime()-this.startMillis)|0;
}

gxtkApp.prototype.Loading=function(){
	return this.loading;
}

gxtkApp.prototype.OnCreate=function(){
}

gxtkApp.prototype.OnUpdate=function(){
}

gxtkApp.prototype.OnSuspend=function(){
}

gxtkApp.prototype.OnResume=function(){
}

gxtkApp.prototype.OnRender=function(){
}

gxtkApp.prototype.OnLoading=function(){
}

//***** gxtkGraphics class *****

function gxtkGraphics( app,canvas ){
	this.app=app;
	this.canvas=canvas;
	this.gc=canvas.getContext( '2d' );
	this.tmpCanvas=null;
	this.r=255;
	this.b=255;
	this.g=255;
	this.white=true;
	this.color="rgb(255,255,255)"
	this.alpha=1.0;
	this.blend="source-over";
	this.ix=1;this.iy=0;
	this.jx=0;this.jy=1;
	this.tx=0;this.ty=0;
	this.tformed=false;
	this.scissorX=0;
	this.scissorY=0;
	this.scissorWidth=0;
	this.scissorHeight=0;
	this.clipped=false;
}

gxtkGraphics.prototype.BeginRender=function(){
	this.gc.save();
}

gxtkGraphics.prototype.EndRender=function(){
	this.gc.restore();
}

gxtkGraphics.prototype.Width=function(){
	return this.canvas.width;
}

gxtkGraphics.prototype.Height=function(){
	return this.canvas.height;
}

gxtkGraphics.prototype.LoadSurface=function( path ){
	
	var app=this.app;
	
	function onloadfun(){
		app.DecLoading();
	}

	app.IncLoading();

	var image=loadImage( path,onloadfun );
	if( image ) return new gxtkSurface( image,this );

	app.DecLoading();
	return null;
}

gxtkGraphics.prototype.SetAlpha=function( alpha ){
	this.alpha=alpha;
	this.gc.globalAlpha=alpha;
}

gxtkGraphics.prototype.SetColor=function( r,g,b ){
	this.r=r;
	this.g=g;
	this.b=b;
	this.white=(r==255 && g==255 && b==255);
	this.color="rgb("+(r|0)+","+(g|0)+","+(b|0)+")";
	this.gc.fillStyle=this.color;
	this.gc.strokeStyle=this.color;
}

gxtkGraphics.prototype.SetBlend=function( blend ){
	switch( blend ){
	case 1:
		this.blend="lighter";
		break;
	default:
		this.blend="source-over";
	}
	this.gc.globalCompositeOperation=this.blend;
}

gxtkGraphics.prototype.SetScissor=function( x,y,w,h ){
	this.scissorX=x;
	this.scissorY=y;
	this.scissorWidth=w;
	this.scissorHeight=h;
	this.clipped=(x!=0 || y!=0 || w!=this.canvas.width || h!=this.canvas.height);
	this.gc.restore();
	this.gc.save();
	if( this.clipped ){
		this.gc.beginPath();
		this.gc.rect( x,y,w,h );
		this.gc.clip();
		this.gc.closePath();
	}
	this.gc.fillStyle=this.color;
	this.gc.strokeStyle=this.color;
	if( this.tformed ) this.gc.setTransform( this.ix,this.iy,this.jx,this.jy,this.tx,this.ty );
}

gxtkGraphics.prototype.SetMatrix=function( ix,iy,jx,jy,tx,ty ){
	this.ix=ix;this.iy=iy;
	this.jx=jx;this.jy=jy;
	this.tx=tx;this.ty=ty;
	this.gc.setTransform( ix,iy,jx,jy,tx,ty );
	this.tformed=(ix!=1 || iy!=0 || jx!=0 || jy!=1 || tx!=0 || ty!=0);
}

gxtkGraphics.prototype.Cls=function( r,g,b ){
	if( this.tformed ) this.gc.setTransform( 1,0,0,1,0,0 );
	this.gc.fillStyle="rgb("+(r|0)+","+(g|0)+","+(b|0)+")";
	this.gc.globalAlpha=1;
	this.gc.globalCompositeOperation="source-over";
	this.gc.fillRect( 0,0,this.canvas.width,this.canvas.height );
	this.gc.fillStyle=this.color;
	this.gc.globalAlpha=this.alpha;
	this.gc.globalCompositeOperation=this.blend;
	if( this.tformed ) this.gc.setTransform( this.ix,this.iy,this.jx,this.jy,this.tx,this.ty );
}

gxtkGraphics.prototype.DrawRect=function( x,y,w,h ){
	if( w<0 ){ x+=w;w=-w; }
	if( h<0 ){ y+=h;h=-h; }
	if( w<=0 || h<=0 ) return;
	//
	this.gc.fillRect( x,y,w,h );
}

gxtkGraphics.prototype.DrawLine=function( x1,y1,x2,y2 ){
	if( this.tformed ){
		var x1_t=x1 * this.ix + y1 * this.jx + this.tx;
		var y1_t=x1 * this.iy + y1 * this.jy + this.ty;
		var x2_t=x2 * this.ix + y2 * this.jx + this.tx;
		var y2_t=x2 * this.iy + y2 * this.jy + this.ty;
		this.gc.setTransform( 1,0,0,1,0,0 );
	  	this.gc.beginPath();
	  	this.gc.moveTo( x1_t,y1_t );
	  	this.gc.lineTo( x2_t,y2_t );
	  	this.gc.stroke();
	  	this.gc.closePath();
		this.gc.setTransform( this.ix,this.iy,this.jx,this.jy,this.tx,this.ty );
	}else{
	  	this.gc.beginPath();
	  	this.gc.moveTo( x1,y1 );
	  	this.gc.lineTo( x2,y2 );
	  	this.gc.stroke();
	  	this.gc.closePath();
	}
}

gxtkGraphics.prototype.DrawOval=function( x,y,w,h ){
	if( w<0 ){ x+=w;w=-w; }
	if( h<0 ){ y+=h;h=-h; }
	if( w<=0 || h<=0 ) return;
	//
  	var w2=w/2,h2=h/2;
	this.gc.save();
	this.gc.translate( x+w2,y+h2 );
	this.gc.scale( w2,h2 );
  	this.gc.beginPath();
	this.gc.arc( 0,0,1,0,Math.PI*2,false );
	this.gc.fill();
  	this.gc.closePath();
	this.gc.restore();
}

gxtkGraphics.prototype.DrawPoly=function( verts ){
	if( verts.length<6 ) return;
	this.gc.beginPath();
	this.gc.moveTo( verts[0],verts[1] );
	for( var i=2;i<verts.length;i+=2 ){
		this.gc.lineTo( verts[i],verts[i+1] );
	}
	this.gc.fill();
	this.gc.closePath();
}

gxtkGraphics.prototype.DrawSurface=function( surface,x,y ){
	if( !surface.image.complete ) return;
	
	if( this.white ){
		this.gc.drawImage( surface.image,x,y );
		return;
	}
	
	this.DrawImageTinted( surface.image,x,y,0,0,surface.swidth,surface.sheight );
}

gxtkGraphics.prototype.DrawSurface2=function( surface,x,y,srcx,srcy,srcw,srch ){
	if( !surface.image.complete ) return;

	if( srcw<0 ){ srcx+=srcw;srcw=-srcw; }
	if( srch<0 ){ srcy+=srch;srch=-srch; }
	if( srcw<=0 || srch<=0 ) return;

	if( this.white ){
		this.gc.drawImage( surface.image,srcx,srcy,srcw,srch,x,y,srcw,srch );
		return;
	}
	
	this.DrawImageTinted( surface.image,x,y,srcx,srcy,srcw,srch  );
}

gxtkGraphics.prototype.DrawImageTinted=function( image,dx,dy,sx,sy,sw,sh ){

	if( !this.tmpCanvas ){
		this.tmpCanvas=document.createElement( "canvas" );
	}

	if( sw>this.tmpCanvas.width || sh>this.tmpCanvas.height ){
		this.tmpCanvas.width=Math.max( sw,this.tmpCanvas.width );
		this.tmpCanvas.height=Math.max( sh,this.tmpCanvas.height );
	}
	
	var tgc=this.tmpCanvas.getContext( "2d" );
	
	tgc.globalCompositeOperation="copy";

	tgc.drawImage( image,sx,sy,sw,sh,0,0,sw,sh );
	
	var imgData=tgc.getImageData( 0,0,sw,sh );
	
	var p=imgData.data,sz=sw*sh*4,i;
	
	for( i=0;i<sz;i+=4 ){
		p[i]=p[i]*this.r/255;
		p[i+1]=p[i+1]*this.g/255;
		p[i+2]=p[i+2]*this.b/255;
	}
	
	tgc.putImageData( imgData,0,0 );
	
	this.gc.drawImage( this.tmpCanvas,0,0,sw,sh,dx,dy,sw,sh );
}

//***** gxtkSurface class *****

function gxtkSurface( image,graphics ){
	this.image=image;
	this.graphics=graphics;
	this.swidth=image.meta_width;
	this.sheight=image.meta_height;
}

//***** GXTK API *****

gxtkSurface.prototype.Discard=function(){
	if( this.image ){
		this.image=null;
	}
}

gxtkSurface.prototype.Width=function(){
	return this.swidth;
}

gxtkSurface.prototype.Height=function(){
	return this.sheight;
}

gxtkSurface.prototype.Loaded=function(){
	return this.image.complete;
}

//***** Class gxtkInput *****

function gxtkInput( app ){
	this.app=app;
	this.keyStates=new Array( 512 );
	this.charQueue=new Array( 32 );
	this.charPut=0;
	this.charGet=0;
	this.mouseX=0;
	this.mouseY=0;
	this.joyX=0;
	this.joyY=0;
	this.joyZ=0;
	this.accelX=0;
	this.accelY=0;
	this.accelZ=0;
	for( var i=0;i<512;++i ){
		this.keyStates[i]=0;
	}
}

gxtkInput.prototype.BeginUpdate=function(){
}

gxtkInput.prototype.EndUpdate=function(){
	for( var i=0;i<512;++i ){
		this.keyStates[i]&=0x100;
	}
	this.charGet=0;
	this.charPut=0;
}

gxtkInput.prototype.OnKeyDown=function( key ){
	if( (this.keyStates[key]&0x100)==0 ){
		this.keyStates[key]|=0x100;
		++this.keyStates[key];	
	}
}

gxtkInput.prototype.OnKeyUp=function( key ){
	this.keyStates[key]&=0xff;
}

gxtkInput.prototype.PutChar=function( char ){
	if( this.charPut-this.charGet<32 ){
		this.charQueue[this.charPut & 31]=char;
		this.charPut+=1;
	}
}

gxtkInput.prototype.OnMouseMove=function( x,y ){
	this.mouseX=x;
	this.mouseY=y;
}

//***** GXTK API *****

gxtkInput.prototype.SetKeyboardEnabled=function( enabled ){
	return 0;
}

gxtkInput.prototype.KeyDown=function( key ){
	if( key>0 && key<512 ){
		if( key==KEY_TOUCH0 ) key=KEY_LMB;
		return this.keyStates[key] >> 8;
	}
	return 0;
}

gxtkInput.prototype.KeyHit=function( key ){
	if( key>0 && key<512 ){
		if( key==KEY_TOUCH0 ) key=KEY_LMB;
		return this.keyStates[key] & 0xff;
	}
	return 0;
}

gxtkInput.prototype.GetChar=function(){
	if( this.charPut!=this.charGet ){
		var char=this.charQueue[this.charGet & 31];
		this.charGet+=1;
		return char;
	}
	return 0;
}

gxtkInput.prototype.MouseX=function(){
	return this.mouseX;
}

gxtkInput.prototype.MouseY=function(){
	return this.mouseY;
}

gxtkInput.prototype.JoyX=function( index ){
	return this.joyX;
}

gxtkInput.prototype.JoyY=function( index ){
	return this.joyY;
}

gxtkInput.prototype.JoyZ=function( index ){
	return this.joyZ;
}

gxtkInput.prototype.TouchX=function( index ){
	return this.mouseX;
}

gxtkInput.prototype.TouchY=function( index ){
	return this.mouseY;
}

gxtkInput.prototype.AccelX=function(){
	return 0;
}

gxtkInput.prototype.AccelY=function(){
	return 0;
}

gxtkInput.prototype.AccelZ=function(){
	return 0;
}


//***** gxtkChannel class *****
function gxtkChannel(){
	this.audio=null;
	this.sample=null;
	this.volume=1;
	this.pan=0;
	this.rate=1;
}

//***** gxtkAudio class *****
function gxtkAudio( app ){
	this.app=app;
	this.okay=typeof(Audio)!="undefined";
	this.nextchan=0;
	this.music=null;
	this.channels=new Array(33);
	for( var i=0;i<33;++i ){
		this.channels[i]=new gxtkChannel();
	}
}

gxtkAudio.prototype.OnSuspend=function(){
	var i;
	for( i=0;i<33;++i ){
		var chan=this.channels[i];
		if( chan.audio ) chan.audio.pause();
	}
}

gxtkAudio.prototype.OnResume=function(){
	var i;
	for( i=0;i<33;++i ){
		var chan=this.channels[i];
		if( chan.audio ) chan.audio.play();
	}
}

gxtkAudio.prototype.LoadSample=function( path ){
	var audio=loadAudio( path );
	if( audio ) return new gxtkSample( audio );
	return null;
}

gxtkAudio.prototype.PlaySample=function( sample,channel,flags ){
	if( !this.okay ) return;
	
	var chan=this.channels[channel];
	
	if( chan.sample==sample && chan.audio ){	//&& !chan.audio.paused ){
		chan.audio.loop=(flags&1)!=0;
		chan.audio.volume=chan.volume;
		try{
			chan.audio.currentTime=0;
		}catch(ex){
		}
		chan.audio.play();
		return;
	}

	if( chan.audio ) chan.audio.pause();
	
	var audio=sample.AllocAudio();
	
	if( audio ){
		for( var i=0;i<33;++i ){
			if( this.channels[i].audio==audio ){
				this.channels[i].audio=null;
				break;
			}
		}
		audio.loop=(flags&1)!=0;
		audio.volume=chan.volume;
		audio.play();
	}
	
	chan.audio=audio;
	chan.sample=sample;
}

gxtkAudio.prototype.StopChannel=function( channel ){
	var chan=this.channels[channel];
	if( chan.audio ) chan.audio.pause();
}

gxtkAudio.prototype.ChannelState=function( channel ){
	var chan=this.channels[channel];
	if( chan.audio && !chan.audio.paused && !chan.audio.ended ) return 1;
	return 0;
}

gxtkAudio.prototype.SetVolume=function( channel,volume ){
	var chan=this.channels[channel];
	if( chan.audio ) chan.audio.volume=volume;
	chan.volume=volume;
}

gxtkAudio.prototype.SetPan=function( channel,pan ){
	var chan=this.channels[channel];
	chan.pan=pan;
}

gxtkAudio.prototype.SetRate=function( channel,rate ){
	var chan=this.channels[channel];
	chan.rate=rate;
}

gxtkAudio.prototype.PlayMusic=function( path,flags ){
	this.StopMusic();
	
	this.music=this.LoadSample( path );
	if( !this.music ) return;
	
	this.PlaySample( this.music,32,flags );
}

gxtkAudio.prototype.StopMusic=function(){
	this.StopChannel( 32 );

	if( this.music ){
		this.music.Discard();
		this.music=null;
	}
}

gxtkAudio.prototype.MusicState=function(){

	return this.ChannelState( 32 );
}

gxtkAudio.prototype.SetMusicVolume=function( volume ){

	this.SetVolume( 32,volume );
}

//***** gxtkSample class *****

function gxtkSample( audio ){
	this.audio=audio;
	this.insts=new Array( 8 );
	this.insts[0]=audio;
}

gxtkSample.prototype.Discard=function(){
	if( this.audio ){
		this.audio=null;
		for( var i=0;i<8;++i ){
			this.insts[i]=null;
		}
	}
}

gxtkSample.prototype.AllocAudio=function(){
	for( var i=0;i<8;++i ){
		var audio=this.insts[i];
		if( audio ){
			//Ok, this is ugly but seems to work best...no idea how/why!
			if( audio.paused ){
				if( audio.currentTime==0 ) return audio;
				audio.currentTime=0;
			}else if( audio.ended ){
				audio.pause();
			}
		}else{
			audio=new Audio( this.audio.src );
			this.insts[i]=audio;
			return audio;
		}
	}
	return null;
}
function bb_app_App(){
	Object.call(this);
}
function bb_app_App_new(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<109>";
	bb_app_device=bb_app_AppDevice_new.call(new bb_app_AppDevice,this);
	pop_err();
	return this;
}
bb_app_App.prototype.m_OnCreate=function(){
	push_err();
	pop_err();
	return 0;
}
bb_app_App.prototype.m_OnUpdate=function(){
	push_err();
	pop_err();
	return 0;
}
bb_app_App.prototype.m_OnSuspend=function(){
	push_err();
	pop_err();
	return 0;
}
bb_app_App.prototype.m_OnResume=function(){
	push_err();
	pop_err();
	return 0;
}
bb_app_App.prototype.m_OnRender=function(){
	push_err();
	pop_err();
	return 0;
}
bb_app_App.prototype.m_OnLoading=function(){
	push_err();
	pop_err();
	return 0;
}
function bb_library_Application(){
	bb_app_App.call(this);
}
bb_library_Application.prototype=extend_class(bb_app_App);
function bb_library_Application_new(){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<10>";
	bb_app_App_new.call(this);
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<10>";
	pop_err();
	return this;
}
bb_library_Application.prototype.m_OnCreate=function(){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<18>";
	bb_app_SetUpdateRate(30);
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<19>";
	bb_library_Picture_Init();
	pop_err();
	return 0;
}
var bb_library_Application_mhit1;
var bb_library_Application_curImage;
var bb_library_Application_curAlpha;
var bb_library_Application_mx;
var bb_library_Application_my;
bb_library_Application.prototype.m_OnUpdate=function(){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<23>";
	bb_library_Application_mhit1=bb_input_MouseHit(0);
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<24>";
	if(((bb_library_Application_mhit1)!=0) && ((bb_library_Application_curImage)!=null)){
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<25>";
		bb_library_Application_curImage=null;
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<26>";
		bb_library_Application_mhit1=0;
	}
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<29>";
	if((bb_library_Application_curImage)!=null){
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<30>";
		if(bb_library_Application_curAlpha<1.0){
			err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<30>";
			bb_library_Application_curAlpha+=0.1;
		}
	}
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<33>";
	bb_library_Application_mx=((bb_input_MouseX())|0);
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<34>";
	bb_library_Application_my=((bb_input_MouseY())|0);
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<35>";
	bb_library_Picture_SetMouse(bb_library_Application_mhit1,bb_library_Application_mx,bb_library_Application_my);
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<36>";
	bb_library_Picture_Update();
	pop_err();
	return 0;
}
bb_library_Application.prototype.m_OnRender=function(){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<40>";
	bb_library_Picture_Draw();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<42>";
	if(bb_library_Application_curImage!=null){
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<43>";
		var t_scale=(bb_library_AppW-20)/(bb_library_Application_curImage.m_Width());
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<44>";
		t_scale=bb_math_Min2(t_scale,(bb_library_AppH-20)/(bb_library_Application_curImage.m_Height()));
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<46>";
		bb_graphics_SetAlpha(bb_library_Application_curAlpha);
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<47>";
		bb_graphics_DrawImage2(bb_library_Application_curImage,((bb_library_AppW/2)|0)-(bb_library_Application_curImage.m_Width())*t_scale/2.0,10.0,0.0,t_scale,t_scale,0);
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<48>";
		bb_graphics_SetAlpha(1.0);
	}
	pop_err();
	return 0;
}
function bb_app_AppDevice(){
	gxtkApp.call(this);
	this.f_app=null;
	this.f_updateRate=0;
}
bb_app_AppDevice.prototype=extend_class(gxtkApp);
function bb_app_AppDevice_new(t_app){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<47>";
	dbg_object(this).f_app=t_app;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<48>";
	bb_graphics_SetGraphicsContext(bb_graphics_GraphicsContext_new.call(new bb_graphics_GraphicsContext,this.GraphicsDevice()));
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<49>";
	bb_input_SetInputDevice(this.InputDevice());
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<50>";
	bb_audio_SetAudioDevice(this.AudioDevice());
	pop_err();
	return this;
}
function bb_app_AppDevice_new2(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<44>";
	pop_err();
	return this;
}
bb_app_AppDevice.prototype.OnCreate=function(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<54>";
	bb_graphics_SetFont(null,32);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<55>";
	var t_=this.f_app.m_OnCreate();
	pop_err();
	return t_;
}
bb_app_AppDevice.prototype.OnUpdate=function(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<59>";
	var t_=this.f_app.m_OnUpdate();
	pop_err();
	return t_;
}
bb_app_AppDevice.prototype.OnSuspend=function(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<63>";
	var t_=this.f_app.m_OnSuspend();
	pop_err();
	return t_;
}
bb_app_AppDevice.prototype.OnResume=function(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<67>";
	var t_=this.f_app.m_OnResume();
	pop_err();
	return t_;
}
bb_app_AppDevice.prototype.OnRender=function(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<71>";
	bb_graphics_BeginRender();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<72>";
	var t_r=this.f_app.m_OnRender();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<73>";
	bb_graphics_EndRender();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<74>";
	pop_err();
	return t_r;
}
bb_app_AppDevice.prototype.OnLoading=function(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<78>";
	bb_graphics_BeginRender();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<79>";
	var t_r=this.f_app.m_OnLoading();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<80>";
	bb_graphics_EndRender();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<81>";
	pop_err();
	return t_r;
}
bb_app_AppDevice.prototype.SetUpdateRate=function(t_hertz){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<85>";
	gxtkApp.prototype.SetUpdateRate.call(this,t_hertz);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<86>";
	this.f_updateRate=t_hertz;
	pop_err();
	return 0;
}
function bb_graphics_GraphicsContext(){
	Object.call(this);
	this.f_device=null;
	this.f_defaultFont=null;
	this.f_font=null;
	this.f_firstChar=0;
	this.f_matrixSp=0;
	this.f_ix=1.0;
	this.f_iy=.0;
	this.f_jx=.0;
	this.f_jy=1.0;
	this.f_tx=.0;
	this.f_ty=.0;
	this.f_tformed=0;
	this.f_matDirty=0;
	this.f_color_r=.0;
	this.f_color_g=.0;
	this.f_color_b=.0;
	this.f_alpha=.0;
	this.f_blend=0;
	this.f_scissor_x=.0;
	this.f_scissor_y=.0;
	this.f_scissor_width=.0;
	this.f_scissor_height=.0;
	this.f_matrixStack=new_number_array(192);
}
function bb_graphics_GraphicsContext_new(t_device){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<207>";
	dbg_object(this).f_device=t_device;
	pop_err();
	return this;
}
function bb_graphics_GraphicsContext_new2(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<204>";
	pop_err();
	return this;
}
var bb_graphics_context;
function bb_graphics_SetGraphicsContext(t_gc){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<246>";
	bb_graphics_context=t_gc;
	pop_err();
	return 0;
}
var bb_input_device;
function bb_input_SetInputDevice(t_dev){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/input.monkey<40>";
	bb_input_device=t_dev;
	pop_err();
	return 0;
}
var bb_audio_device;
function bb_audio_SetAudioDevice(t_dev){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/audio.monkey<56>";
	bb_audio_device=t_dev;
	pop_err();
	return 0;
}
var bb_app_device;
function bbMain(){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<7>";
	bb_library_Application_new.call(new bb_library_Application);
	pop_err();
	return 0;
}
function bb_graphics_Image(){
	Object.call(this);
	this.f_surface=null;
	this.f_width=0;
	this.f_height=0;
	this.f_frames=[];
	this.f_flags=0;
	this.f_tx=.0;
	this.f_ty=.0;
	this.f_source=null;
}
var bb_graphics_Image_DefaultFlags;
function bb_graphics_Image_new(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<62>";
	pop_err();
	return this;
}
bb_graphics_Image.prototype.m_SetHandle=function(t_tx,t_ty){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<106>";
	dbg_object(this).f_tx=t_tx;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<107>";
	dbg_object(this).f_ty=t_ty;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<108>";
	dbg_object(this).f_flags=dbg_object(this).f_flags&-2;
	pop_err();
	return 0;
}
bb_graphics_Image.prototype.m_ApplyFlags=function(t_iflags){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<177>";
	this.f_flags=t_iflags;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<179>";
	if((this.f_flags&2)!=0){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<180>";
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<180>";
		var t_=this.f_frames;
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<180>";
		var t_2=0;
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<180>";
		while(t_2<t_.length){
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<180>";
			var t_f=dbg_array(t_,t_2)[t_2];
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<180>";
			t_2=t_2+1;
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<181>";
			dbg_object(t_f).f_x+=1;
		}
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<183>";
		this.f_width-=2;
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<186>";
	if((this.f_flags&4)!=0){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<187>";
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<187>";
		var t_3=this.f_frames;
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<187>";
		var t_4=0;
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<187>";
		while(t_4<t_3.length){
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<187>";
			var t_f2=dbg_array(t_3,t_4)[t_4];
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<187>";
			t_4=t_4+1;
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<188>";
			dbg_object(t_f2).f_y+=1;
		}
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<190>";
		this.f_height-=2;
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<193>";
	if((this.f_flags&1)!=0){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<194>";
		this.m_SetHandle((this.f_width)/2.0,(this.f_height)/2.0);
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<197>";
	if(this.f_frames.length==1 && dbg_object(dbg_array(this.f_frames,0)[0]).f_x==0 && dbg_object(dbg_array(this.f_frames,0)[0]).f_y==0 && this.f_width==this.f_surface.Width() && this.f_height==this.f_surface.Height()){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<198>";
		this.f_flags|=65536;
	}
	pop_err();
	return 0;
}
bb_graphics_Image.prototype.m_Load=function(t_path,t_nframes,t_iflags){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<129>";
	this.f_surface=dbg_object(bb_graphics_context).f_device.LoadSurface(t_path);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<130>";
	if(!((this.f_surface)!=null)){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<130>";
		pop_err();
		return null;
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<132>";
	this.f_width=((this.f_surface.Width()/t_nframes)|0);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<133>";
	this.f_height=this.f_surface.Height();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<135>";
	this.f_frames=new_object_array(t_nframes);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<137>";
	for(var t_i=0;t_i<t_nframes;t_i=t_i+1){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<138>";
		dbg_array(this.f_frames,t_i)[t_i]=bb_graphics_Frame_new.call(new bb_graphics_Frame,t_i*this.f_width,0)
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<141>";
	this.m_ApplyFlags(t_iflags);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<143>";
	pop_err();
	return this;
}
bb_graphics_Image.prototype.m_Grab=function(t_x,t_y,t_iwidth,t_iheight,t_nframes,t_iflags,t_source){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<148>";
	dbg_object(this).f_source=t_source;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<149>";
	this.f_surface=dbg_object(t_source).f_surface;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<151>";
	this.f_width=t_iwidth;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<152>";
	this.f_height=t_iheight;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<154>";
	this.f_frames=new_object_array(t_nframes);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<156>";
	var t_ix=t_x+dbg_object(dbg_array(dbg_object(t_source).f_frames,0)[0]).f_x;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<157>";
	var t_iy=t_y+dbg_object(dbg_array(dbg_object(t_source).f_frames,0)[0]).f_y;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<159>";
	for(var t_i=0;t_i<t_nframes;t_i=t_i+1){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<160>";
		if(t_ix+this.f_width>dbg_object(t_source).f_width){
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<161>";
			t_ix=dbg_object(dbg_array(dbg_object(t_source).f_frames,0)[0]).f_x;
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<162>";
			t_iy+=this.f_height;
		}
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<164>";
		if(t_ix+this.f_width>dbg_object(t_source).f_width || t_iy+this.f_height>dbg_object(t_source).f_height){
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<165>";
			error("Image frame outside surface");
		}
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<167>";
		dbg_array(this.f_frames,t_i)[t_i]=bb_graphics_Frame_new.call(new bb_graphics_Frame,t_ix,t_iy)
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<168>";
		t_ix+=this.f_width;
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<171>";
	this.m_ApplyFlags(t_iflags);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<173>";
	pop_err();
	return this;
}
bb_graphics_Image.prototype.m_GrabImage=function(t_x,t_y,t_width,t_height,t_frames,t_flags){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<101>";
	if(dbg_object(this).f_frames.length!=1){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<101>";
		pop_err();
		return null;
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<102>";
	var t_=(bb_graphics_Image_new.call(new bb_graphics_Image)).m_Grab(t_x,t_y,t_width,t_height,t_frames,t_flags,this);
	pop_err();
	return t_;
}
bb_graphics_Image.prototype.m_Width=function(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<73>";
	pop_err();
	return this.f_width;
}
bb_graphics_Image.prototype.m_Height=function(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<77>";
	pop_err();
	return this.f_height;
}
function bb_graphics_Frame(){
	Object.call(this);
	this.f_x=0;
	this.f_y=0;
}
function bb_graphics_Frame_new(t_x,t_y){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<54>";
	dbg_object(this).f_x=t_x;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<55>";
	dbg_object(this).f_y=t_y;
	pop_err();
	return this;
}
function bb_graphics_Frame_new2(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<49>";
	pop_err();
	return this;
}
function bb_graphics_LoadImage(t_path,t_frameCount,t_flags){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<272>";
	var t_=(bb_graphics_Image_new.call(new bb_graphics_Image)).m_Load(t_path,t_frameCount,t_flags);
	pop_err();
	return t_;
}
function bb_graphics_LoadImage2(t_path,t_frameWidth,t_frameHeight,t_frameCount,t_flags){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<276>";
	var t_atlas=(bb_graphics_Image_new.call(new bb_graphics_Image)).m_Load(t_path,1,0);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<277>";
	if((t_atlas)!=null){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<277>";
		var t_=t_atlas.m_GrabImage(0,0,t_frameWidth,t_frameHeight,t_frameCount,t_flags);
		pop_err();
		return t_;
	}
	pop_err();
	return null;
}
function bb_graphics_SetFont(t_font,t_firstChar){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<537>";
	if(!((t_font)!=null)){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<538>";
		if(!((dbg_object(bb_graphics_context).f_defaultFont)!=null)){
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<539>";
			dbg_object(bb_graphics_context).f_defaultFont=bb_graphics_LoadImage("mojo_font.png",96,2);
		}
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<541>";
		t_font=dbg_object(bb_graphics_context).f_defaultFont;
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<542>";
		t_firstChar=32;
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<544>";
	dbg_object(bb_graphics_context).f_font=t_font;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<545>";
	dbg_object(bb_graphics_context).f_firstChar=t_firstChar;
	pop_err();
	return 0;
}
var bb_graphics_renderDevice;
function bb_graphics_SetMatrix(t_ix,t_iy,t_jx,t_jy,t_tx,t_ty){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<326>";
	dbg_object(bb_graphics_context).f_ix=t_ix;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<327>";
	dbg_object(bb_graphics_context).f_iy=t_iy;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<328>";
	dbg_object(bb_graphics_context).f_jx=t_jx;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<329>";
	dbg_object(bb_graphics_context).f_jy=t_jy;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<330>";
	dbg_object(bb_graphics_context).f_tx=t_tx;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<331>";
	dbg_object(bb_graphics_context).f_ty=t_ty;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<332>";
	dbg_object(bb_graphics_context).f_tformed=((t_ix!=1.0 || t_iy!=0.0 || t_jx!=0.0 || t_jy!=1.0 || t_tx!=0.0 || t_ty!=0.0)?1:0);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<333>";
	dbg_object(bb_graphics_context).f_matDirty=1;
	pop_err();
	return 0;
}
function bb_graphics_SetMatrix2(t_m){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<322>";
	bb_graphics_SetMatrix(dbg_array(t_m,0)[0],dbg_array(t_m,1)[1],dbg_array(t_m,2)[2],dbg_array(t_m,3)[3],dbg_array(t_m,4)[4],dbg_array(t_m,5)[5]);
	pop_err();
	return 0;
}
function bb_graphics_SetColor(t_r,t_g,t_b){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<281>";
	dbg_object(bb_graphics_context).f_color_r=t_r;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<282>";
	dbg_object(bb_graphics_context).f_color_g=t_g;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<283>";
	dbg_object(bb_graphics_context).f_color_b=t_b;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<284>";
	dbg_object(bb_graphics_context).f_device.SetColor(t_r,t_g,t_b);
	pop_err();
	return 0;
}
function bb_graphics_SetAlpha(t_alpha){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<292>";
	dbg_object(bb_graphics_context).f_alpha=t_alpha;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<293>";
	dbg_object(bb_graphics_context).f_device.SetAlpha(t_alpha);
	pop_err();
	return 0;
}
function bb_graphics_SetBlend(t_blend){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<301>";
	dbg_object(bb_graphics_context).f_blend=t_blend;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<302>";
	dbg_object(bb_graphics_context).f_device.SetBlend(t_blend);
	pop_err();
	return 0;
}
function bb_graphics_DeviceWidth(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<264>";
	var t_=dbg_object(bb_graphics_context).f_device.Width();
	pop_err();
	return t_;
}
function bb_graphics_DeviceHeight(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<268>";
	var t_=dbg_object(bb_graphics_context).f_device.Height();
	pop_err();
	return t_;
}
function bb_graphics_SetScissor(t_x,t_y,t_width,t_height){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<310>";
	dbg_object(bb_graphics_context).f_scissor_x=t_x;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<311>";
	dbg_object(bb_graphics_context).f_scissor_y=t_y;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<312>";
	dbg_object(bb_graphics_context).f_scissor_width=t_width;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<313>";
	dbg_object(bb_graphics_context).f_scissor_height=t_height;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<314>";
	dbg_object(bb_graphics_context).f_device.SetScissor(((t_x)|0),((t_y)|0),((t_width)|0),((t_height)|0));
	pop_err();
	return 0;
}
function bb_graphics_BeginRender(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<250>";
	bb_graphics_renderDevice=dbg_object(bb_graphics_context).f_device;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<251>";
	dbg_object(bb_graphics_context).f_matrixSp=0;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<252>";
	bb_graphics_SetMatrix(1.0,0.0,0.0,1.0,0.0,0.0);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<253>";
	bb_graphics_SetColor(255.0,255.0,255.0);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<254>";
	bb_graphics_SetAlpha(1.0);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<255>";
	bb_graphics_SetBlend(0);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<256>";
	bb_graphics_SetScissor(0.0,0.0,(bb_graphics_DeviceWidth()),(bb_graphics_DeviceHeight()));
	pop_err();
	return 0;
}
function bb_graphics_EndRender(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<260>";
	bb_graphics_renderDevice=null;
	pop_err();
	return 0;
}
function bb_app_SetUpdateRate(t_hertz){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/app.monkey<149>";
	var t_=bb_app_device.SetUpdateRate(t_hertz);
	pop_err();
	return t_;
}
function bb_library_Picture(){
	Object.call(this);
	this.f_img=null;
	this.f_factor=.0;
}
function bb_library_Picture_new(){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<53>";
	pop_err();
	return this;
}
var bb_library_Picture_maxW;
var bb_library_Picture_maxH;
var bb_library_Picture_list;
function bb_library_Picture_Add(t__p){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<77>";
	var t_inst=bb_library_Picture_new.call(new bb_library_Picture);
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<78>";
	dbg_object(t_inst).f_img=bb_graphics_LoadImage(t__p,1,bb_graphics_Image_DefaultFlags);
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<80>";
	if(dbg_object(t_inst).f_img.m_Width()>bb_library_Picture_maxW){
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<81>";
		dbg_object(t_inst).f_factor=(bb_library_Picture_maxW)/(dbg_object(t_inst).f_img.m_Width());
	}
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<84>";
	if(dbg_object(t_inst).f_img.m_Height()>bb_library_Picture_maxH){
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<85>";
		dbg_object(t_inst).f_factor=bb_math_Min2(dbg_object(t_inst).f_factor,(bb_library_Picture_maxH)/(dbg_object(t_inst).f_img.m_Height()));
	}
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<88>";
	bb_library_Picture_list.m_AddLast(t_inst);
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<89>";
	pop_err();
	return t_inst;
}
function bb_library_Picture_Init(){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<71>";
	for(var t_i=1;t_i<=6;t_i=t_i+1){
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<72>";
		bb_library_Picture_Add(String(t_i)+".jpg");
	}
	pop_err();
	return 0;
}
var bb_library_Picture_mhit1;
var bb_library_Picture_mx;
var bb_library_Picture_my;
function bb_library_Picture_SetMouse(t_hit1,t_x,t_y){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<65>";
	bb_library_Picture_mhit1=t_hit1;
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<66>";
	bb_library_Picture_mx=t_x;
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<67>";
	bb_library_Picture_my=t_y;
	pop_err();
	return 0;
}
function bb_library_Picture_Update(){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<93>";
	var t_tmp_x=5;
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<94>";
	var t_tmp_y=5;
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<96>";
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<96>";
	var t_=bb_library_Picture_list.m_ObjectEnumerator();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<96>";
	while(t_.m_HasNext()){
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<96>";
		var t_inst=t_.m_NextObject();
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<97>";
		if((bb_library_RectsOverlap((bb_library_Picture_mx),(bb_library_Picture_my),1.0,1.0,(t_tmp_x),(t_tmp_y),(dbg_object(t_inst).f_img.m_Width())*dbg_object(t_inst).f_factor,(dbg_object(t_inst).f_img.m_Height())*dbg_object(t_inst).f_factor))!=0){
			err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<98>";
			if((bb_library_Picture_mhit1)!=0){
				err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<99>";
				bb_library_Application_curImage=dbg_object(t_inst).f_img;
				err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<100>";
				bb_library_Application_curAlpha=0.0;
			}
		}
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<105>";
		t_tmp_x+=bb_library_Picture_maxW+5;
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<106>";
		if(t_tmp_x+bb_library_Picture_maxW>bb_library_AppW){
			err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<107>";
			t_tmp_y+=bb_library_Picture_maxH+5;
			err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<108>";
			t_tmp_x=5;
		}
	}
	pop_err();
	return 0;
}
function bb_library_Picture_Draw(){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<114>";
	bb_graphics_Cls(0.0,0.0,0.0);
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<116>";
	var t_tmp_x=5;
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<117>";
	var t_tmp_y=5;
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<119>";
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<119>";
	var t_=bb_library_Picture_list.m_ObjectEnumerator();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<119>";
	while(t_.m_HasNext()){
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<119>";
		var t_inst=t_.m_NextObject();
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<121>";
		bb_graphics_SetAlpha(0.5);
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<122>";
		if((bb_library_RectsOverlap((bb_library_Picture_mx),(bb_library_Picture_my),1.0,1.0,(t_tmp_x),(t_tmp_y),(dbg_object(t_inst).f_img.m_Width())*dbg_object(t_inst).f_factor,(dbg_object(t_inst).f_img.m_Height())*dbg_object(t_inst).f_factor))!=0){
			err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<123>";
			bb_graphics_SetAlpha(1.0);
		}
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<125>";
		bb_graphics_DrawImage2(dbg_object(t_inst).f_img,(t_tmp_x),(t_tmp_y),0.0,dbg_object(t_inst).f_factor,dbg_object(t_inst).f_factor,0);
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<126>";
		bb_graphics_SetAlpha(1.0);
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<129>";
		t_tmp_x+=bb_library_Picture_maxW+5;
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<130>";
		if(t_tmp_x+bb_library_Picture_maxW>bb_library_AppW){
			err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<131>";
			t_tmp_y+=bb_library_Picture_maxH+5;
			err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<132>";
			t_tmp_x=5;
		}
	}
	pop_err();
	return 0;
}
function bb_math_Min(t_x,t_y){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/math.monkey<51>";
	if(t_x<t_y){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/math.monkey<51>";
		pop_err();
		return t_x;
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/math.monkey<52>";
	pop_err();
	return t_y;
}
function bb_math_Min2(t_x,t_y){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/math.monkey<78>";
	if(t_x<t_y){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/math.monkey<78>";
		pop_err();
		return t_x;
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/math.monkey<79>";
	pop_err();
	return t_y;
}
function bb_list_List(){
	Object.call(this);
	this.f__head=(bb_list_HeadNode_new.call(new bb_list_HeadNode));
}
function bb_list_List_new(){
	push_err();
	pop_err();
	return this;
}
bb_list_List.prototype.m_AddLast=function(t_data){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<120>";
	var t_=bb_list_Node_new.call(new bb_list_Node,this.f__head,dbg_object(this.f__head).f__pred,t_data);
	pop_err();
	return t_;
}
function bb_list_List_new2(t_data){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<13>";
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<13>";
	var t_=t_data;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<13>";
	var t_2=0;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<13>";
	while(t_2<t_.length){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<13>";
		var t_t=dbg_array(t_,t_2)[t_2];
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<13>";
		t_2=t_2+1;
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<14>";
		this.m_AddLast(t_t);
	}
	pop_err();
	return this;
}
bb_list_List.prototype.m_ObjectEnumerator=function(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<124>";
	var t_=bb_list_Enumerator_new.call(new bb_list_Enumerator,this);
	pop_err();
	return t_;
}
function bb_list_Node(){
	Object.call(this);
	this.f__succ=null;
	this.f__pred=null;
	this.f__data=null;
}
function bb_list_Node_new(t_succ,t_pred,t_data){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<199>";
	this.f__succ=t_succ;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<200>";
	this.f__pred=t_pred;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<201>";
	dbg_object(this.f__succ).f__pred=this;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<202>";
	dbg_object(this.f__pred).f__succ=this;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<203>";
	this.f__data=t_data;
	pop_err();
	return this;
}
function bb_list_Node_new2(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<196>";
	pop_err();
	return this;
}
function bb_list_HeadNode(){
	bb_list_Node.call(this);
}
bb_list_HeadNode.prototype=extend_class(bb_list_Node);
function bb_list_HeadNode_new(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<248>";
	bb_list_Node_new2.call(this);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<249>";
	this.f__succ=(this);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<250>";
	this.f__pred=(this);
	pop_err();
	return this;
}
function bb_input_MouseHit(t_button){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/input.monkey<104>";
	var t_=bb_input_device.KeyHit(1+t_button);
	pop_err();
	return t_;
}
function bb_input_MouseX(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/input.monkey<92>";
	var t_=bb_input_device.MouseX();
	pop_err();
	return t_;
}
function bb_input_MouseY(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/input.monkey<96>";
	var t_=bb_input_device.MouseY();
	pop_err();
	return t_;
}
function bb_list_Enumerator(){
	Object.call(this);
	this.f__list=null;
	this.f__curr=null;
}
function bb_list_Enumerator_new(t_list){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<264>";
	this.f__list=t_list;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<265>";
	this.f__curr=dbg_object(dbg_object(t_list).f__head).f__succ;
	pop_err();
	return this;
}
function bb_list_Enumerator_new2(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<261>";
	pop_err();
	return this;
}
bb_list_Enumerator.prototype.m_HasNext=function(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<269>";
	while(dbg_object(dbg_object(this.f__curr).f__succ).f__pred!=this.f__curr){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<270>";
		this.f__curr=dbg_object(this.f__curr).f__succ;
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<272>";
	var t_=this.f__curr!=dbg_object(this.f__list).f__head;
	pop_err();
	return t_;
}
bb_list_Enumerator.prototype.m_NextObject=function(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<276>";
	var t_data=dbg_object(this.f__curr).f__data;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<277>";
	this.f__curr=dbg_object(this.f__curr).f__succ;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/monkey/list.monkey<278>";
	pop_err();
	return t_data;
}
function bb_library_RectsOverlap(t_x0,t_y0,t_w0,t_h0,t_x2,t_y2,t_w2,t_h2){
	push_err();
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<141>";
	if(t_x0>t_x2+t_w2 || t_x0+t_w0<t_x2){
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<141>";
		pop_err();
		return 0;
	}
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<142>";
	if(t_y0>t_y2+t_h2 || t_y0+t_h0<t_y2){
		err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<142>";
		pop_err();
		return 0;
	}
	err_info="C:/Dokumente und Einstellungen/NetSick/Desktop/Neuer Ordner/library.monkey<143>";
	pop_err();
	return 1;
}
var bb_library_AppW;
function bb_graphics_DebugRenderDevice(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<237>";
	if(!((bb_graphics_renderDevice)!=null)){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<237>";
		error("Rendering operations can only be performed inside OnRender");
	}
	pop_err();
	return 0;
}
function bb_graphics_Cls(t_r,t_g,t_b){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<381>";
	bb_graphics_DebugRenderDevice();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<383>";
	bb_graphics_renderDevice.Cls(t_r,t_g,t_b);
	pop_err();
	return 0;
}
function bb_graphics_PushMatrix(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<341>";
	var t_sp=dbg_object(bb_graphics_context).f_matrixSp;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<342>";
	var t_=t_sp+0;
	dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_)[t_]=dbg_object(bb_graphics_context).f_ix
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<343>";
	var t_2=t_sp+1;
	dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_2)[t_2]=dbg_object(bb_graphics_context).f_iy
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<344>";
	var t_3=t_sp+2;
	dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_3)[t_3]=dbg_object(bb_graphics_context).f_jx
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<345>";
	var t_4=t_sp+3;
	dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_4)[t_4]=dbg_object(bb_graphics_context).f_jy
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<346>";
	var t_5=t_sp+4;
	dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_5)[t_5]=dbg_object(bb_graphics_context).f_tx
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<347>";
	var t_6=t_sp+5;
	dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_6)[t_6]=dbg_object(bb_graphics_context).f_ty
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<348>";
	dbg_object(bb_graphics_context).f_matrixSp=t_sp+6;
	pop_err();
	return 0;
}
function bb_graphics_Transform(t_ix,t_iy,t_jx,t_jy,t_tx,t_ty){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<358>";
	var t_ix2=t_ix*dbg_object(bb_graphics_context).f_ix+t_iy*dbg_object(bb_graphics_context).f_jx;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<359>";
	var t_iy2=t_ix*dbg_object(bb_graphics_context).f_iy+t_iy*dbg_object(bb_graphics_context).f_jy;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<360>";
	var t_jx2=t_jx*dbg_object(bb_graphics_context).f_ix+t_jy*dbg_object(bb_graphics_context).f_jx;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<361>";
	var t_jy2=t_jx*dbg_object(bb_graphics_context).f_iy+t_jy*dbg_object(bb_graphics_context).f_jy;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<362>";
	var t_tx2=t_tx*dbg_object(bb_graphics_context).f_ix+t_ty*dbg_object(bb_graphics_context).f_jx+dbg_object(bb_graphics_context).f_tx;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<363>";
	var t_ty2=t_tx*dbg_object(bb_graphics_context).f_iy+t_ty*dbg_object(bb_graphics_context).f_jy+dbg_object(bb_graphics_context).f_ty;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<364>";
	bb_graphics_SetMatrix(t_ix2,t_iy2,t_jx2,t_jy2,t_tx2,t_ty2);
	pop_err();
	return 0;
}
function bb_graphics_Transform2(t_coords){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<582>";
	var t_out=new_number_array(t_coords.length);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<583>";
	for(var t_i=0;t_i<t_coords.length-1;t_i=t_i+2){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<584>";
		var t_x=dbg_array(t_coords,t_i)[t_i];
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<584>";
		var t_=t_i+1;
		var t_y=dbg_array(t_coords,t_)[t_];
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<585>";
		dbg_array(t_out,t_i)[t_i]=t_x*dbg_object(bb_graphics_context).f_ix+t_y*dbg_object(bb_graphics_context).f_jx+dbg_object(bb_graphics_context).f_tx
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<586>";
		var t_2=t_i+1;
		dbg_array(t_out,t_2)[t_2]=t_x*dbg_object(bb_graphics_context).f_iy+t_y*dbg_object(bb_graphics_context).f_jy+dbg_object(bb_graphics_context).f_ty
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<588>";
	pop_err();
	return t_out;
}
function bb_graphics_Translate(t_x,t_y){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<368>";
	bb_graphics_Transform(1.0,0.0,0.0,1.0,t_x,t_y);
	pop_err();
	return 0;
}
function bb_graphics_ValidateMatrix(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<230>";
	if((dbg_object(bb_graphics_context).f_matDirty)!=0){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<231>";
		dbg_object(bb_graphics_context).f_device.SetMatrix(dbg_object(bb_graphics_context).f_ix,dbg_object(bb_graphics_context).f_iy,dbg_object(bb_graphics_context).f_jx,dbg_object(bb_graphics_context).f_jy,dbg_object(bb_graphics_context).f_tx,dbg_object(bb_graphics_context).f_ty);
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<232>";
		dbg_object(bb_graphics_context).f_matDirty=0;
	}
	pop_err();
	return 0;
}
function bb_graphics_PopMatrix(){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<352>";
	var t_sp=dbg_object(bb_graphics_context).f_matrixSp-6;
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<353>";
	var t_=t_sp+0;
	var t_2=t_sp+1;
	var t_3=t_sp+2;
	var t_4=t_sp+3;
	var t_5=t_sp+4;
	var t_6=t_sp+5;
	bb_graphics_SetMatrix(dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_)[t_],dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_2)[t_2],dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_3)[t_3],dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_4)[t_4],dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_5)[t_5],dbg_array(dbg_object(bb_graphics_context).f_matrixStack,t_6)[t_6]);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<354>";
	dbg_object(bb_graphics_context).f_matrixSp=t_sp;
	pop_err();
	return 0;
}
function bb_graphics_DrawImage(t_image,t_x,t_y,t_frame){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<436>";
	bb_graphics_DebugRenderDevice();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<438>";
	var t_f=dbg_array(dbg_object(t_image).f_frames,t_frame)[t_frame];
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<440>";
	if((dbg_object(bb_graphics_context).f_tformed)!=0){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<441>";
		bb_graphics_PushMatrix();
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<443>";
		bb_graphics_Translate(t_x-dbg_object(t_image).f_tx,t_y-dbg_object(t_image).f_ty);
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<445>";
		bb_graphics_ValidateMatrix();
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<447>";
		if((dbg_object(t_image).f_flags&65536)!=0){
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<448>";
			dbg_object(bb_graphics_context).f_device.DrawSurface(dbg_object(t_image).f_surface,0.0,0.0);
		}else{
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<450>";
			dbg_object(bb_graphics_context).f_device.DrawSurface2(dbg_object(t_image).f_surface,0.0,0.0,dbg_object(t_f).f_x,dbg_object(t_f).f_y,dbg_object(t_image).f_width,dbg_object(t_image).f_height);
		}
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<453>";
		bb_graphics_PopMatrix();
	}else{
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<455>";
		bb_graphics_ValidateMatrix();
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<457>";
		if((dbg_object(t_image).f_flags&65536)!=0){
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<458>";
			dbg_object(bb_graphics_context).f_device.DrawSurface(dbg_object(t_image).f_surface,t_x-dbg_object(t_image).f_tx,t_y-dbg_object(t_image).f_ty);
		}else{
			err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<460>";
			dbg_object(bb_graphics_context).f_device.DrawSurface2(dbg_object(t_image).f_surface,t_x-dbg_object(t_image).f_tx,t_y-dbg_object(t_image).f_ty,dbg_object(t_f).f_x,dbg_object(t_f).f_y,dbg_object(t_image).f_width,dbg_object(t_image).f_height);
		}
	}
	pop_err();
	return 0;
}
function bb_graphics_Rotate(t_angle){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<376>";
	bb_graphics_Transform(Math.cos((t_angle)*D2R),-Math.sin((t_angle)*D2R),Math.sin((t_angle)*D2R),Math.cos((t_angle)*D2R),0.0,0.0);
	pop_err();
	return 0;
}
function bb_graphics_Scale(t_x,t_y){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<372>";
	bb_graphics_Transform(t_x,0.0,0.0,t_y,0.0,0.0);
	pop_err();
	return 0;
}
function bb_graphics_DrawImage2(t_image,t_x,t_y,t_rotation,t_scaleX,t_scaleY,t_frame){
	push_err();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<467>";
	bb_graphics_DebugRenderDevice();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<469>";
	var t_f=dbg_array(dbg_object(t_image).f_frames,t_frame)[t_frame];
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<471>";
	bb_graphics_PushMatrix();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<473>";
	bb_graphics_Translate(t_x,t_y);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<474>";
	bb_graphics_Rotate(t_rotation);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<475>";
	bb_graphics_Scale(t_scaleX,t_scaleY);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<477>";
	bb_graphics_Translate(-dbg_object(t_image).f_tx,-dbg_object(t_image).f_ty);
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<479>";
	bb_graphics_ValidateMatrix();
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<481>";
	if((dbg_object(t_image).f_flags&65536)!=0){
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<482>";
		dbg_object(bb_graphics_context).f_device.DrawSurface(dbg_object(t_image).f_surface,0.0,0.0);
	}else{
		err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<484>";
		dbg_object(bb_graphics_context).f_device.DrawSurface2(dbg_object(t_image).f_surface,0.0,0.0,dbg_object(t_f).f_x,dbg_object(t_f).f_y,dbg_object(t_image).f_width,dbg_object(t_image).f_height);
	}
	err_info="D:/MonkeyPro48/MonkeyPro48/modules/mojo/graphics.monkey<487>";
	bb_graphics_PopMatrix();
	pop_err();
	return 0;
}
var bb_library_AppH;
function bbInit(){
	bb_graphics_context=null;
	bb_input_device=null;
	bb_audio_device=null;
	bb_app_device=null;
	bb_graphics_Image_DefaultFlags=0;
	bb_graphics_renderDevice=null;
	bb_library_Picture_maxW=240;
	bb_library_Picture_maxH=180;
	bb_library_Picture_list=bb_list_List_new.call(new bb_list_List);
	bb_library_Application_mhit1=0;
	bb_library_Application_curImage=null;
	bb_library_Application_curAlpha=.0;
	bb_library_Application_mx=0;
	bb_library_Application_my=0;
	bb_library_Picture_mhit1=0;
	bb_library_Picture_mx=0;
	bb_library_Picture_my=0;
	bb_library_AppW=800;
	bb_library_AppH=500;
}
//${TRANSCODE_END}

