OpenGLRenderer::OpenGLRenderer() : m_BackgroundColor(OpenGLColorCornflowerBlue()), m_ForegroundColor(OpenGLColorBlack()) { setBackgroundColor(OpenGLColorCornflowerBlue()); setForegroundColor(OpenGLColorBlack()); }
void Game::paint() { //While the game is loading, the load method will be called once per update if (isLoading() == true) { //Cache the screen width and height float screenWidth = getScreenWidth(); float screenHeight = getScreenHeight(); //Draw a black background, you could replace this //in the future with a full screen background texture OpenGLRenderer::getInstance()->setForegroundColor(OpenGLColorBlack()); OpenGLRenderer::getInstance()->drawRectangle(0.0f, 0.0f, screenWidth, screenHeight); //Calculate the bar width and height, don't actually hard-code these float barWidth = 200.0f * getScale(); float barHeight = 40.0f * getScale(); float barX = (screenWidth - barWidth) / 2.0f; float barY = (screenHeight - barHeight) / 2.0f; // float percentageLoaded = (float)m_LoadStep / (float)(GameLoadStepCount - 1); float loadedWidth = barWidth * percentageLoaded; OpenGLRenderer::getInstance()->setForegroundColor(OpenGLColorYellow()); OpenGLRenderer::getInstance()->drawRectangle(barX, barY, loadedWidth, barHeight); // OpenGLRenderer::getInstance()->setForegroundColor(OpenGLColorWhite()); OpenGLRenderer::getInstance()->drawRectangle(barX, barY, barWidth, barHeight, false); return; } OpenGLRenderer::getInstance()->drawTexture(m_BackgroundTexture,0.0f,0.0f); #if _DEBUG if (m_World != NULL) { m_World->DrawDebugData(); } #endif //Paint the game's game objects for (int i = 0; i < m_GameObjects.size(); i++) { m_GameObjects.at(i)->paint(); } }
void Menu::paint() { if(m_Background != NULL) { OpenGLRenderer::getInstance()->drawTexture(m_Background, 0.0f, 0.0f); } else { OpenGLRenderer::getInstance()->setForegroundColor(OpenGLColorBlack()); OpenGLRenderer::getInstance()->drawRectangle(0.0f, 0.0f, getWidth(), getHeight()); } if(m_Title != NULL) { OpenGLRenderer::getInstance()->drawTexture(m_Title, m_TitleX, m_TitleY); } for(int i = 0; i < m_Buttons.size(); i++) { m_Buttons.at(i)->paint(); } }
void Ball::paint() { //Draw an the puck in black OpenGLRenderer::getInstance()->setForegroundColor(OpenGLColorBlack()); OpenGLRenderer::getInstance()->drawCircle(getX(), getY(), getRadius()); }