コード例 #1
0
ファイル: bemgame.cpp プロジェクト: Zitrax/brainblast
void BemGame::AddSpaceTiles()
{
	// This functions adds the background bitmaps. (Pictures
	// of Space.) The Space picture is a tile that is rotated
	// for variaton.

	KrResource* resource = engine->Vault()->GetResource(	KYRATAG_TILE,
															BEM_SPACE );
	GLASSERT( resource );

	KrTileResource* spaceTileRes = resource->ToTileResource();
	GLASSERT( spaceTileRes );

	int i, j;
	KrRect bounds = engine->FullScreenBounds();

	for( i=0; i<(bounds.Width() / spaceTileRes->Size() + 1); i++ )
	{
		for( j=0; j<(bounds.Height() / spaceTileRes->Size() + 1); j++ )
		{
			KrTile* spaceTile = new KrTile( spaceTileRes );
			GLASSERT( spaceTile );

			spaceTile->SetPos( i * spaceTile->Size(), j * spaceTile->Size() );
			spaceTile->SetRotation( (i+j) & 7 );

			engine->Tree()->AddNode( backgroundTree, spaceTile );
		}
	}
}
コード例 #2
0
ファイル: Puzzle.cpp プロジェクト: Zitrax/brainblast
void
Puzzle::setBackgroundTile(KrTile* tile)
{
	// Delete old tree if existing
	if( m_background_tree )
		Brainblast::instance()->engine()->Tree()->DeleteNode(m_background_tree);
	// Create new tree and insert in the global tree
	if( !m_background_tree ) {
		m_background_tree = new KrImNode;
		Brainblast::instance()->engine()->Tree()->AddNode(0, m_background_tree);
		m_background_tree->SetZDepth(BACZ);
	}
	
	// Create and position all bg tiles
	for(uint x=0;x<m_width;x++)
	{
		int xspace = m_rect.w/m_width;
		
		for(uint y=0;y<m_height;y++)
		{
			int yspace = m_rect.h/m_height;
			
			KrTile* ctile = tile->Clone()->ToTile();
			Brainblast::instance()->engine()->Tree()->AddNode(m_background_tree, ctile);
			ctile->SetPos(m_rect.x + x*xspace+xspace/2-ctile->Size()/2,
						  m_rect.y + y*yspace+yspace/2-ctile->Size()/2);
			m_back[y*m_width+x] = ctile;
		}
	}
}
コード例 #3
0
ファイル: pyKrTile.cpp プロジェクト: gefariasjr/projetofinal1
PyObject *
_wrap_tile_size (PyObject *self, PyObject *args)
{
	   PyObject *py_r;

	   if (!PyArg_ParseTuple (args, "O:size", &py_r)) return NULL;

	   KrTile *t = AS_PTR (KrTile, py_r);
	   GLASSERT (t);

	   int size = t->Size();

	   return PyInt_FromLong (size);
}