All pastes #224527 Raw Edit

Someone

public text v1 · immutable
#224527 ·published 2006-10-27 12:58 UTC
rendered paste body
bool AppSol::printcon(int r, int g, int b,const char *str, int x , int y)
      {
		
            if (!g3d->BeginDraw (CSDRAW_2DGRAPHICS))
            {
                 return 0;               
            }   
				iGraphics2D* g2d = g3d->GetDriver2D ();                            
            font = g2d->GetFontServer()->LoadFont(CSFONT_LARGE);
            int glyphWidth, glyphHeight;
            font->GetMaxSize (glyphWidth, glyphHeight);
            int white = g3d->GetDriver2D ()->FindRGB (r, g, b);
            g3d->GetDriver2D ()->Write (font, x ,g3d->GetDriver2D ()->GetHeight () - (glyphHeight == -1? 20 : (glyphHeight+1)) - y,white, 0, str);


      }


	if (!g3d->BeginDraw (CSDRAW_2DGRAPHICS))
		return;
	// Tell the camera to render into the frame buffer.
	view->Draw ();
	
	// Output 2d Info on top of 3d info
	iGraphics2D* g2d = g3d->GetDriver2D ();  
	g2d->Clear(0);

	font = g2d->GetFontServer()->LoadFont(CSFONT_LARGE);

	// Show camera pos 
	printcon ( 255,0 , 0 , c->GetSector()->QueryObject()->GetName() , 150,80 );
	//printf( "%s" , c->GetSector()->QueryObject()->GetName() );
	csV3PrintCon ( 140, 40 , c->GetTransform().GetOrigin() );
	Box_Meshs();
	//game.Draw_Solar_Sys();
	game.List_Meshs();
	//game.List_Textures();
	//game.List_Materials();
	game.List_Sectors();

.....




void Game::List_Sectors() {

	iSector* sector;
	iSectorList* sectorlist;

	int intsectorcount;
	std::ostringstream myStream;
	std::string num_sector;

	csRef<iEngine> engine = app->GetEngine();
	if (!engine) printf("Game::List_Textures():Failed to locate iEngine renderer!");
	
	sectorlist	= engine->GetSectors();
	intsectorcount = sectorlist->GetCount();
	myStream << intsectorcount;
	num_sector =  "#Sectors: " + myStream.str() ; 

	int x = 100;
	int y = 100;
	
	
	printcon( 255,0,0,  num_sector.c_str()  ,  x  , y  );
	
	for (int i=0 ; i<intsectorcount;i++) {
		sector = sectorlist->Get(i);
		printcon( 255,0,0, sector->QueryObject ()->GetName() ,  x  , y - (10*(i+1)) );

	} // end for list sector
}