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 ); }
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(); }
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 ); } } }
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 ); }