示例#1
0
	void Scene::render( Graphics2D& g , Vec2f const& pos )
	{
		for ( int i = 0 ; i < mLevel.mNumCellData ; ++i )
		{
			BubbleCell& cell = mLevel.getCell(i);

			if ( cell.isBlock() || cell.isEmpty() )
				continue;

			Vec2f cPos = mLevel.calcCellCenterPos( i );

			//if ( cell.isBlock() )
			//{
			//	g.setBrush( ColorKey3( 255 , 0 , 0 ) );
			//	g.drawCircle( pos + cPos , g_BubbleRadius );
			//}
			//else if ( cell.isEmpty() )
			//{
			//	g.setBrush( ColorKey3( 255 , 255 , 255 ) );
			//	g.drawCircle( pos + cPos , g_BubbleRadius );
			//}
			//else
			{
				renderBubble( g , pos + cPos , cell.getColor() );
			}	
		}

		renderBackground( g , pos );

		renderBubbleList( g , pos , mShootList );
		renderBubbleList( g , pos , mFallList );
		renderLauncher( g , pos );

	}
示例#2
0
void Playground::paintGL()
{
    glClearColor( 0.5f, 0.5f, 0.5f, 0.f );
    glClear(GL_COLOR_BUFFER_BIT);

    for(int x = 0; x < columns; x++)
        for(int y = 0; y < rows; y++)
            if(bubbles[x][y] != -1) {
                int colorId = bubbles[x][y];
                renderBubble(x * bubbleSize, y * bubbleSize, colorIndeces[colorId]);
            }

    //glLoadIdentity();
}
示例#3
0
	void Scene::renderBubbleList( Graphics2D& g , Vec2f const& pos , BubbleList& bList )
	{
		for( BubbleList::iterator iter = bList.begin() ,iterEnd = bList.end() ;
			iter != iterEnd ; ++iter )
		{
			SceneBubble* bubble = *iter;
			Vec2f bPos = pos + bubble->pos;

			if ( bubble->alpha != 1.0f )
			{
				g.beginBlend( bPos - Vec2f( g_BubbleRadius , g_BubbleRadius ) , 
					Vec2f( g_BubbleDiameter , g_BubbleDiameter ) , bubble->alpha );

				renderBubble( g , pos + bubble->pos , bubble->color );

				g.endBlend();
			}
			else
			{
				renderBubble( g , pos + bubble->pos , bubble->color );
			}
		}

	}
示例#4
0
	void Scene::renderLauncher( Graphics2D& g , Vec2f const& pos )
	{
		RenderUtility::setBrush( g ,  mLevel.mShootBubbleColor );
		RenderUtility::setPen( g ,  mLevel.mShootBubbleColor );

		Vec2f bPos = pos + mLevel.mLauncherPos;

		Vec2f startPos = bPos + 10 * mLevel.mLauncherDir;
		Vec2f offset = 15 * mLevel.mLauncherDir;
		int idx = ( mTimeCount / 120 ) % 13 - 4;
		for( int i = 0 ; i < 5 ; ++ i )
		{
			int r = std::max( 1 , 5 - abs( idx - i ) );
			startPos += offset;
			g.drawCircle( startPos  , r  );

		}
		//g.drawLine( bPos , bPos + 60 * mLevel.mLauncherDir );
		renderBubble( g , bPos , mLevel.mShootBubbleColor );

	}