/** * RenderTable: Draws the table where the game will be played, namely: * - some texture for the background * - the right part with the IST logo and the student name and number * - squares to define the playing positions of each player * - names and the available money for each player * \param _money amount of money of each player * \param _img surfaces where the table background and IST logo were loaded * \param _renderer renderer to handle all rendering in a window */ void RenderTable(List *players, TTF_Font *_font, SDL_Surface *_img[], SDL_Renderer *_renderer) { SDL_Color black = {0, 0, 0, 255}; // black SDL_Texture *table_texture; SDL_Rect tableSrc, tableDest; int height; char money_str[STRING_SIZE]; // set color of renderer to white SDL_SetRenderDrawColor(_renderer, 255, 255, 255, 255); // clear the window SDL_RenderClear(_renderer); tableDest.x = tableSrc.x = 0; tableDest.y = tableSrc.y = 0; tableSrc.w = _img[0]->w; tableSrc.h = _img[0]->h; tableDest.w = SEP; tableDest.h = HEIGHT_WINDOW; table_texture = SDL_CreateTextureFromSurface(_renderer, _img[0]); SDL_RenderCopy(_renderer, table_texture, &tableSrc, &tableDest); // render the IST Logo height = RenderLogo(SEP, 0, _img[1], _renderer); // render the student name height += RenderText(SEP+3*MARGIN, height, myName1, _font, &black, _renderer); // this renders the student number height += RenderText(SEP+3*MARGIN, height, myName2, _font, &black, _renderer); // 2xnewline height += 2*RenderText(SEP+3*MARGIN, height, " ", _font, &black, _renderer); List *aux = players->next; Player *cur_player = NULL; while (aux) { cur_player = (Player *) aux->payload; if (cur_player->ingame) { sprintf(money_str, "%s (%s): %d euros", cur_player->name, cur_player->type == HU ? "HU" : "EA", cur_player->money); height += RenderText(SEP+3*MARGIN, height, money_str, _font, &black, _renderer); } aux = aux->next; } RenderPlayerArea(players, _renderer, _font); // destroy everything SDL_DestroyTexture(table_texture); }
void PxIntroSceneRenderer::HandlePaint( PxWindow * window) { if( first ) { m_ElapsedTime = m_Start = GetTickCount(); first = false; } DWORD last = m_ElapsedTime; m_ElapsedTime = GetTickCount() - m_Start; m_ElapsedTime = (last + m_ElapsedTime)/2; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0, 0.0,-8); glRotatef((float)m_ElapsedTime/8, 1.0f, 0, 0); glRotatef((float)m_ElapsedTime/12, 0, 1.0f, 0); glViewport(0, 0, TEX_BUFF_WIDTH, TEX_BUFF_WIDTH); RenderScene(); glBindTexture(GL_TEXTURE_2D, m_BlurTex); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, TEX_BUFF_WIDTH, TEX_BUFF_WIDTH, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glViewport( (PxWindow::Window()->ScreenWidth - TEX_BUFF_WIDTH ) / 2, (PxWindow::Window()->ScreenHeight - TEX_BUFF_WIDTH ), TEX_BUFF_WIDTH, TEX_BUFF_WIDTH ); RenderScene(); RenderLogo(); glFlush(); window->Update(); }