Ejemplo n.º 1
0
float _bbReadFloat(){
	switch( dataPtr->fieldType ){
	case BBTYPE_END:RTEX( "Out of data" );return 0;
	case BBTYPE_INT:return (float)dataPtr++->field.INT;
	case BBTYPE_FLT:return dataPtr++->field.FLT;
	case BBTYPE_CSTR:return (float)atof( dataPtr++->field.CSTR );
	default:RTEX( "Bad data type" );return 0;
	}
}
Ejemplo n.º 2
0
BBStr *_bbReadStr(){
	switch( dataPtr->fieldType ){
	case BBTYPE_END:RTEX( "Out of data" );return 0;
	case BBTYPE_INT:return d_new BBStr( itoa( dataPtr++->field.INT ) );
	case BBTYPE_FLT:return d_new BBStr( ftoa( dataPtr++->field.FLT ) );
	case BBTYPE_CSTR:return d_new BBStr( dataPtr++->field.CSTR );
	default:RTEX( "Bad data type" );return 0;
	}
}
Ejemplo n.º 3
0
void bbEndGraphics(){
	freeGraphics();
	gx_runtime->closeGraphics( gx_graphics );
	gx_graphics=gx_runtime->openGraphics( 400,300,0,0,gxGraphics::GRAPHICS_WINDOWED );
	if( !gx_runtime->idle() ) RTEX( 0 );
	if( gx_graphics ){
		curr_clsColor=0;
		curr_color=0xffffffff;
		curr_font=gx_graphics->getDefaultFont();
		bbSetBuffer( gx_graphics->getFrontCanvas() );
		return;
	}
	RTEX( "Unable to set graphics mode" );
}
Ejemplo n.º 4
0
static void graphics( int w,int h,int d,int flags ){
	freeGraphics();
	gx_runtime->closeGraphics( gx_graphics );
	gx_graphics=gx_runtime->openGraphics( w,h,d,gx_driver,flags );
	if( !gx_runtime->idle() ) RTEX( 0 );
	if( !gx_graphics ){
		RTEX( "Unable to set graphics mode" );
	}
	curr_clsColor=0;
	curr_color=0xffffffff;
	curr_font=gx_graphics->getDefaultFont();
	gxCanvas *buff=(flags & gxGraphics::GRAPHICS_3D) ?
		gx_graphics->getBackCanvas() : gx_graphics->getFrontCanvas();
	bbSetBuffer( buff );
}
Ejemplo n.º 5
0
int bbDrawMovie( gxMovie *movie,int x,int y,int w,int h ){
	if( w<0 ) w=movie->getWidth();
	if( h<0 ) h=movie->getHeight();
	int playing=movie->draw( gx_canvas,x,y,w,h );
	if( !gx_runtime->idle() ) RTEX( 0 );
	return playing;
}
Ejemplo n.º 6
0
static inline void debugMode( int n ){
	if( debug ){
		if( n<1 || n>gfx_modes.size() ){
			RTEX( "Illegal graphics mode index" );
		}
	}
}
Ejemplo n.º 7
0
static void endPrinting( gxCanvas *c ){
	c->setViewport( p_vpx,p_vpy,p_vpw,p_vph );
	c->setHandle( p_hx,p_hy );
	c->setOrigin( p_ox,p_oy );
	if( c==gx_canvas ) c->setColor( curr_color );
	if( !gx_runtime->idle() ) RTEX( 0 );
}
Ejemplo n.º 8
0
int bbWaitMouse() {
    for(;;) {
        if( !gx_runtime->idle() ) RTEX( 0 );
        if( int key=gx_mouse->getKey() ) return key;
        gx_runtime->delay( 20 );
    }
}
Ejemplo n.º 9
0
static inline void debugDriver( int n ){
	if( debug ){
		if( n<1 || n>gx_runtime->numGraphicsDrivers() ){
			RTEX( "Illegal graphics driver index" );
		}
	}
}
Ejemplo n.º 10
0
int bbWaitJoy( int port ) {
    if( port<0 || port>=gx_joysticks.size() ) return 0;
    for(;;) {
        if( !gx_runtime->idle() ) RTEX( 0 );
        if( int key=gx_joysticks[port]->getKey() ) return key;
        gx_runtime->delay( 20 );
    }
}
Ejemplo n.º 11
0
int bbHostIP( int index ){
	if( debug ){
		if( index<1 || index>host_ips.size() ){
			RTEX( "Host index out of range" );
		}
	}
	return host_ips[index-1];
}
Ejemplo n.º 12
0
int bbWaitKey() {
    for(;;) {
        if( !gx_runtime->idle() ) RTEX( 0 );
        if( int key=gx_keyboard->getKey( ) ) {
            if( key=gx_input->toAscii( key ) ) return key;
        }
        gx_runtime->delay( 20 );
    }
}
Ejemplo n.º 13
0
TCPStream *  bbAcceptTCPStream( TCPServer *server ){
	debugTCPServer( server );
	if( !gx_runtime->idle() ) RTEX( 0 );
	if( TCPStream *tcp=server->accept() ){
		tcp_set.insert( tcp );
		return tcp;
	}
	return 0;
}
Ejemplo n.º 14
0
void bbGraphics( int w,int h,int d,int mode ){
	int flags=0;
	switch( mode ){
	case 0:flags|=debug ? gxGraphics::GRAPHICS_WINDOWED : 0 ;break;
	case 1:break;
	case 2:flags|=gxGraphics::GRAPHICS_WINDOWED;break;
	case 3:flags|=gxGraphics::GRAPHICS_WINDOWED|gxGraphics::GRAPHICS_SCALED;break;
	case 6:flags|=gxGraphics::GRAPHICS_WINDOWED|gxGraphics::GRAPHICS_AUTOSUSPEND;break;
	case 7:flags|=gxGraphics::GRAPHICS_WINDOWED|gxGraphics::GRAPHICS_SCALED|gxGraphics::GRAPHICS_AUTOSUSPEND;break;
	default:RTEX( "Illegal Graphics mode" );
	}
	graphics( w,h,d,flags );
}
Ejemplo n.º 15
0
bbImage *bbLoadAnimImage( BBStr *s,int w,int h,int first,int cnt ){

	string t=*s;delete s;

	if( cnt<1 ) RTEX( "Illegal frame count" );
	if( first<0 ) RTEX( "Illegal first frame" );

	gxCanvas *pic=gx_graphics->loadCanvas( t,gxCanvas::CANVAS_NONDISPLAY );
	if( !pic ) return 0;

	//frames per row, per picture
	int fpr=pic->getWidth()/w;
	int fpp=pic->getHeight()/h*fpr;
	if( first+cnt>fpp ){
		gx_graphics->freeCanvas( pic );
		RTEX( "Not enough frames in bitmap" );
	}

	//x,y of first frame...
	vector<gxCanvas*> frames;
	int src_x=first%fpr*w,src_y=first/fpr*h;

	for( int k=0;k<cnt;++k ){
		gxCanvas *c=gx_graphics->createCanvas( w,h,0 );
		if( !c ){
			for( --k;k>=0;--k ) gx_graphics->freeCanvas( frames[k] );
			gx_graphics->freeCanvas( pic );return 0;
		}
		c->blit( 0,0,pic,src_x,src_y,w,h,true );
		if( auto_dirty ) c->backup();
		if( auto_midhandle ) c->setHandle( c->getWidth()/2,c->getHeight()/2 );
		frames.push_back( c );
		src_x+=w;if( src_x+w>pic->getWidth() ){ src_x=0;src_y+=h; }
	}
	gx_graphics->freeCanvas( pic );
	bbImage *i=d_new bbImage( frames );
	image_set.insert( i );
	return i;
}
Ejemplo n.º 16
0
void bbGraphics3D( int w,int h,int d,int mode ){
	int flags=gxGraphics::GRAPHICS_3D;
	switch( mode ){
	case 0:flags|=(debug && bbWindowed3D()) ? gxGraphics::GRAPHICS_WINDOWED : 0 ;break;
	case 1:break;
	case 2:flags|=gxGraphics::GRAPHICS_WINDOWED;break;
	case 3:flags|=gxGraphics::GRAPHICS_WINDOWED|gxGraphics::GRAPHICS_SCALED;break;
	case 6:flags|=gxGraphics::GRAPHICS_WINDOWED|gxGraphics::GRAPHICS_AUTOSUSPEND;break;
	case 7:flags|=gxGraphics::GRAPHICS_WINDOWED|gxGraphics::GRAPHICS_SCALED|gxGraphics::GRAPHICS_AUTOSUSPEND;break;
	default:RTEX( "Illegal Graphics3D mode" );
	}
	graphics( w,h,d,flags );
	extern void blitz3d_open();
	blitz3d_open();
}
Ejemplo n.º 17
0
void _bbVecBoundsEx(){
	RTEX( "Blitz array index out of bounds" );
}
Ejemplo n.º 18
0
void PosixFileSystem::closeDir( BBDir *dir ){
	RTEX( "PosixFileSystem::closeDir not implemented" );
}
Ejemplo n.º 19
0
BBDir *PosixFileSystem::verifyDir( BBDir *d ){
	RTEX( "PosixFileSystem::verifyDir not implemented" );
}
Ejemplo n.º 20
0
BBDir *PosixFileSystem::openDir( const std::string &name,int flags ){
	RTEX( "PosixFileSystem::openDir not implemented" );
}
Ejemplo n.º 21
0
int PosixFileSystem::getFileSize( const std::string &name )const{
	RTEX( "PosixFileSystem::getFileSize not implemented" );
}
Ejemplo n.º 22
0
bool PosixFileSystem::deleteFile( const std::string &file ){
	RTEX( "PosixFileSystem::deleteFile not implemented" );
}
Ejemplo n.º 23
0
bool PosixFileSystem::deleteDir( const std::string &dir ){
	RTEX( "PosixFileSystem::deleteDir not implemented" );
}
Ejemplo n.º 24
0
static inline void debugDir( gxDir *d ){
	if( debug ){
		if( !gx_filesys->verifyDir( d ) ) RTEX( "Directory does not exist" );
	}
}
Ejemplo n.º 25
0
static void procNotFound(){
	RTEX( "User lib function not found" );
}
Ejemplo n.º 26
0
void _bbArrayBoundsEx(){
	RTEX( "Array index out of bounds" );
}
Ejemplo n.º 27
0
void _bbNullObjEx(){
	RTEX( "Object does not exist" );
}
Ejemplo n.º 28
0
bool PosixFileSystem::renameFile( const std::string &src,const std::string &dest ){
	RTEX( "PosixFileSystem::renameFile not implemented" );
}
Ejemplo n.º 29
0
static inline void debugFile( bbFile *f ){
	if( debug ){
		if( !file_set.count( f ) ) RTEX( "File does not exist" );
	}
}
Ejemplo n.º 30
0
std::string PosixFileSystem::getCurrentDir()const{
	RTEX( "PosixFileSystem::getCurrentDir not implemented" );
}