/** @brief 오브젝트 렌더 함수 */ void Snake::Draw() { for(int i=body.size()-1; i>0; i--) ///< 꼬리 그림 { DrawSurface(screen_, body[i]->x * 20, body[i]->y * 20, tail); } DrawSurface(screen_, body[0]->x*20, body[0]->y*20, head); }
void Button :: Draw() { if(state == BUTTON_STATE_UP) { DrawSurface(posX, posY, upSurface); } else if(state == BUTTON_STATE_DOWN) { DrawSurface(posX, posY, downSurface); } else if(state == BUTTON_STATE_OVER) { DrawSurface(posX, posY, overSurface); } }
void CMovPlayerFrm::OnPaint() { if(NULL==lpPrimary)return; if(DD_OK == lpPrimary->IsLost()){ if(forccNum<3){ HDC hDC = ::GetDC(m_hWnd); HBRUSH brush = CreateSolidBrush(RGB(0, 0, 8)); HBRUSH old_brush = (HBRUSH)SelectObject(hDC,brush); PatBlt(hDC,0,0, 800, 600, PATCOPY); SelectObject(hDC,old_brush); DrawSurface(GetDeviceCaps(hDC,BITSPIXEL)); DeleteObject(brush); ::ReleaseDC(m_hWnd,hDC); } }else{ lpPrimary->Restore(); if(lpSrcSurface)lpSrcSurface->Restore(); } }
BOOL CMovPlayerFrm::DrawMovie() { char time_str[16]; HDC hDC = NULL; hDC = ::GetDC(m_hWnd); if(lpSrcSurface){ DrawSurface(GetDeviceCaps(hDC,BITSPIXEL)); }else{ if(srcWidth ==wWidth && srcHeight==wHeight){ BitBlt(hDC,0,0,srcWidth,srcHeight,memDC,0,0,SRCCOPY); }else{ StretchBlt(hDC,0,0,wWidth,wHeight,memDC,0,0,srcWidth,srcHeight,SRCCOPY); } } if(0==frame_cnt){ start_time = timeGetTime(); } frame_cnt ++; DWORD now_time = timeGetTime(); if(now_time > old_time){ int fps = 1000/(now_time-old_time)/(frame_cnt-old_frame); } ::ReleaseDC(m_hWnd,hDC); old_time = now_time; old_frame = frame_cnt; return TRUE; }
void ms_tick(void) { DrawScene(); draw_banner(); if (ms.state == MS_EXPANDING) { ms.expandframe++; if (ms.expandframe > EXPAND_LENGTH) ms.state = MS_DISPLAYED; else draw_expand(); } if (ms.state == MS_DISPLAYED) { // scan down effect if (ms.current_row < map.ysize) { draw_row(ms.current_row++); if (ms.current_row < map.ysize) draw_row(ms.current_row++); } // draw map DrawRect(ms.x - 1, ms.y - 1, ms.x + ms.w, ms.y + ms.h, DK_BLUE); DrawSurface(ms.sfc, ms.x, ms.y); // you-are-here dot if (++ms.timer & 8) draw_sprite(ms.px, ms.py, SPR_MAP_PIXELS, 4); // dismissal if (ms.lastbuttondown) { if (!buttondown()) ms.lastbuttondown = false; } else if (buttondown()) { ms.state = MS_CONTRACTING; } } else if (ms.state == MS_CONTRACTING) { ms.expandframe--; if (ms.expandframe <= 0) { int param = (ms.return_gm == GM_INVENTORY) ? 1 : 0; game.setmode(ms.return_gm, param); } else { draw_expand(); } } }
// ------------------------------------------------------------------------------------------------ void Map :: Draw(Vector2df camPos) const { int camTileX = camPos.x / MAP_TILE_SIZE; // the map tile at camPos.x int camTileY = camPos.y / MAP_TILE_SIZE; // the map tile at camPos.y int camTileOffsetX = ((int)camPos.x - camTileX * MAP_TILE_SIZE); // the offset of the camera int camTileOffsetY = ((int)camPos.y - camTileY * MAP_TILE_SIZE); // the offset of the camera // for each of the screen tiles for(Tile screenTileX = 0; screenTileX < MAP_NUM_TILES_ON_SCREEN_X; screenTileX++) { for(Tile screenTileY = 0; screenTileY < MAP_NUM_TILES_ON_SCREEN_Y; screenTileY++) { // determine which map tile is going to be drawn for this screen tile Uint32 mapTileX = camTileX + screenTileX; Uint32 mapTileY = camTileY + screenTileY; // only draw the screen tile if the map tile is actually a valid tile (within the bounds of the map) if(mapTileX >= 0 && mapTileX < MAP_NUM_TILES_X && mapTileY >= 0 && mapTileY < MAP_NUM_TILES_Y) { DrawSurface( screenPos.x - camTileOffsetX + screenTileX * MAP_TILE_SIZE, // ScreenPosX of tile screenPos.y - camTileOffsetY + screenTileY * MAP_TILE_SIZE, // ScreenPosY of tile tileSurfaces[tileTypes[mapTileX][mapTileY]]); // TileType } } } } // ----------------------------------------------------------------------------------------------
/* map coords */ void Graphics::DrawTileSingle(int x, int y, const Tile* const tile) { y -= screenTileYOffset; x -= screenTileXOffset; if (x < xDisplaySize) { if ((tile->priority && highPriorityDisplay) || (!tile->priority && lowPriorityDisplay)) { if ((tile->tileID) - tileOffset >= this->tileAmount) { DrawTileNone(x, y); DrawTileInvalid(x, y); } else if ((tile->tileID || !this->tileOffset) && tile->paletteLine < paletteLines) { DrawSurface(tiles[(tile->tileID) - tileOffset][tile->paletteLine][tile->xFlip | (tile->yFlip<<1)], MainScreen->surface, 8*x, 8*y); } else { DrawTileBlank(x, y, tile); } } else { DrawTileNone(x, y); } } }
BOOL CMovie::DrawMovie() { char time_str[16]; HDC hDC = NULL; if(0==frame_cnt && musicNum>=0){ int repeat = 1; if(bLoop)repeat = 0; lpSoundDS->ChangeMusic(bgmHandle,pack_bgmfile,musicNum,FALSE,repeat); } hDC = ::GetDC(sysInf.hWnd); if(lpSrcSurface){ DrawSurface(GetDeviceCaps(hDC,BITSPIXEL)); }else{ if(srcWidth ==wWidth && srcHeight==wHeight){ BitBlt(hDC,0,0,srcWidth,srcHeight,g_DibInf.memDC,0,0,SRCCOPY); }else{ StretchBlt(hDC,0,0,wWidth,wHeight,g_DibInf.memDC,0,0,srcWidth,srcHeight,SRCCOPY); } } if(0==frame_cnt){ start_time = timeGetTime(); } frame_cnt ++; ::ReleaseDC(sysInf.hWnd,hDC); return TRUE; } // CMovie::DrawMovie()
void BigImage::Draw() { #define IMAGE_SPEED 32 switch(state) { case BI_SLIDE_IN: { imagex += IMAGE_SPEED; if (imagex > 0) { imagex = 0; state = BI_HOLD; } } break; case BI_SLIDE_OUT: { imagex -= IMAGE_SPEED; if (imagex < -images[imgno]->Width()) state = BI_CLEAR; } } // take up any unused space with blue if (state != BI_HOLD) FillRect(0, 0, SCREEN_WIDTH/2, SCREEN_HEIGHT, DK_BLUE); if (state != BI_CLEAR) DrawSurface(images[imgno], imagex, 0); }
void displayCallback() { if (showMap == 1) { DrawParabolicMapWithCube(); } else if (showMap == 2) { DrawParabolicMapWithSphere(); } else { glEnable(GL_SCISSOR_TEST); for (int view = 0; view < 4; view++) { SelectViewport(view, true); if (view == ROTATE) DrawSurface(); else DrawFrame(); DrawGrid(); if (view != ROTATE) DrawControlPoints(); } glDisable(GL_SCISSOR_TEST); if (saveScreens) ScreenShot(); } glutSwapBuffers(); }
/** @brief 오브젝트 렌더 함수 \n tiles의 정보를 화면에 그린다. */ void Wall::Draw() { DrawSurface(screen_, 0, 0, bg); for(int h=0; h < blocks.size(); h++) { for(int w=0; w<blocks.at(h).size(); w++) { if(blocks.at(h).at(w)=='#') ///< 타일의 정보가 #이면 { SDL_Surface* block = IMG_Load("block.bmp"); DrawSurface(screen_, w*20, h*20, block); ///< 블록 이미지 출력 SDL_FreeSurface(block); } } } }
void Graphics::DrawSelector(void) { ClearSelector(); for (int i=0; i < tileAmount; ++i) DrawSurface(tiles[i][currentPal][0], MainScreen->surface, selXMin + 8*(i%selectorWidth), 8*(i/selectorWidth - selTileYOffset)); //SDL_Flip(screen); MainScreen->ProcessDisplay(); }
/** @brief 문자열+숫자 형태의 문자열을 화면에 그려주는 함수. @param screen 그려질 화면(SDL_Surface)의 포인터 @param label 뿌려질 문자열 @param value 뿌려질 숫자 @param posx 뿌려질 화면의 좌표 x @param posy 뿌려질 화면의 좌표 y */ void ISnakeSingleScene::DrawTextFiledLabelWithValue(SDL_Surface* screen, std::string label, int value, int posx, int posy) { std::string str = TextFieldFactory::Shared()->StringAndInt(label, value); char *ch = const_cast<char*>(str.c_str()); SDL_Surface *textField = TextFieldFactory::Shared()->CreateTextFieldSurface(ch); DrawSurface(screen , posx, posy, textField); SDL_FreeSurface(textField); }
void UpdateCameras(Camera<T>& a_Camera) { a_Camera.Update(); SDL_GL_MakeCurrent(voWindows[a_Camera.GetWindowIndex()]->GetWindow(), glContext); glViewport( a_Camera.GetScreenPos().X, a_Camera.GetScreenPos().Y, a_Camera.GetDimensions().W, a_Camera.GetDimensions().H); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho( 0.0f, a_Camera.GetResolution().W, a_Camera.GetResolution().H, 0.0f, -1.0f, 1.0f); for (int i = 0; i < vglSurfaces.size(); ++i) { switch (vglSurfaces[i]->Tag) { case SurfaceUnion::INT: { if (vglSurfaces[i]->iGLSurface->bIsActive && a_Camera.GetWorldSpace() == vglSurfaces[i]->iGLSurface->uiWorldSpace) { DrawSurface(*vglSurfaces[i]->iGLSurface, a_Camera); } break; } case SurfaceUnion::FLOAT: { if (vglSurfaces[i]->fGLSurface->bIsActive && a_Camera.GetWorldSpace() == vglSurfaces[i]->fGLSurface->uiWorldSpace) { DrawSurface(*vglSurfaces[i]->fGLSurface, a_Camera); } break; } } } }
// ------------------------------------------------------------------------------------------------ void ProjectileBase :: Draw(Vector2df camPos) const { // Pre-conditions: assert(IsActive() && "ProjectileBase::Draw"); assert(surface && "ProjectileBase::Draw"); if(IsActive()) { Vector2df screenPos = Pos() - camPos; DrawSurface(screenPos.x - surface->w / 2, screenPos.y - surface->h / 2, surface); } } // ----------------------------------------------------------------------------------------------
void Button::Draw() { if(buttonType == IMAGE) { DrawSurface(collisionBox.x, collisionBox.y, content, mainScreen); } else if(buttonType == TEXT) { if(!mousedOver) { SDL_FillRect(mainScreen, &collisionBox, SDL_MapRGB(mainScreen->format, bgClr.r, bgClr.g, bgClr.b)); DrawSurface(collisionBox.x, collisionBox.y, content, mainScreen); rectangleRGBA(mainScreen, collisionBox.x , collisionBox.y, collisionBox.x + collisionBox.w, collisionBox.y + collisionBox.h, borderClr.r, borderClr.g, borderClr.b, 255); } else if(mousedOver) { SDL_FillRect(mainScreen, &collisionBox, SDL_MapRGB(mainScreen->format, hoverClr.r, hoverClr.g, hoverClr.b)); DrawSurface(collisionBox.x , collisionBox.y, content, mainScreen); rectangleRGBA(mainScreen, collisionBox.x, collisionBox.y, collisionBox.x + collisionBox.w, collisionBox.y + collisionBox.h, borderClr.r, borderClr.g, borderClr.b, 255); } } }
void Game::render(SDL_Surface *screen, SDL_Surface *brickParts[]) { for (int iy = 0; iy < map.size.y; iy++) for (int ix = 0; ix < map.size.x; ix++) if (map.map[iy][ix] >= 1 && map.map[iy][ix] <= 7) DrawSurface(screen, brickParts[map.map[iy][ix] - 1], 36 + ix * BRICK_SIZE, 36 + iy * BRICK_SIZE + PADDING_TOP); if (brick != nullptr) for (int iy = 0; iy < brick->map.size.y; iy++) for (int ix = 0; ix < brick->map.size.x; ix++) if(brick->map.map[iy][ix] != 0) DrawSurface(screen, brickParts[brick->brickType->type - 1], (brick->position.x + brick->brickType->getVectorFromCenter(V2D(ix, iy)).x + 1) * BRICK_SIZE + 12, (brick->position.y + brick->brickType->getVectorFromCenter(V2D(ix, iy)).y + 1) * BRICK_SIZE + PADDING_TOP + 12); if (nextBrick != nullptr) for (int iy = 0; iy < nextBrick->map.size.y; iy++) for (int ix = 0; ix < nextBrick->map.size.x; ix++) if (nextBrick->map.map[iy][ix] != 0) DrawSurface(screen, brickParts[nextBrick->brickType->type - 1], (16 + nextBrick->brickType->getVectorFromCenter(V2D(ix, iy)).x) * BRICK_SIZE + 12, (8 + nextBrick->brickType->getVectorFromCenter(V2D(ix, iy)).y) * BRICK_SIZE + PADDING_TOP); printGameTime(screen); if (pause) { pauseBox->render(); } }
void Graphics::ShowLoadingScreen() { NXSurface loading; char fname[MAXPATHLEN]; sprintf(fname, "%s/Loading.pbm", data_dir); if (loading.LoadImage(fname)) return; int x = (Graphics::SCREEN_WIDTH / 2) - (loading.Width() / 2); int y = (Graphics::SCREEN_HEIGHT / 2) - loading.Height(); ClearScreen(BLACK); DrawSurface(&loading, x, y); drawtarget->Flip(); }
void Renderer2::Render() const { glClearColor(0.5f, 0.5f, 0.5f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Set viewport glViewport(0, 0, m_surfaceSize.x, m_surfaceSize.y); // Enable depth glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); // Draw DrawSurface(); DrawRoom(); }
// Dessin void DrawList(Widget *w) { SDL_Surface *scr = w->construct->scr; wTHEME *t = w->construct->theme; ListArgs *args = w->args; wMENU *m = args->menu; Uint32 c = Darker(t->color1, 60); Uint32 c2 = args->isActive? t->request_c1:t->request_c2; if (!c2) c2 = t->color1; char *s; int ws = nSDL_GetStringWidth(t->font, m->title); int xw = (w->bounds.w*3)/5; if (!m->title) xw = w->bounds.w - 6; else if (xw + ws + 9 > w->bounds.w) xw = w->bounds.w - ws - 9; int x = w->bounds.x + w->bounds.w - xw - 3; if (m->title) DrawClippedStr(scr, t->font, w->bounds.x+3, w->bounds.y+6, m->title); DrawFillRectXY(scr, x, w->bounds.y + 3, xw, 14, c2); DrawRectXY(scr, x, w->bounds.y + 3, xw, 14, c); if (!args->isActive) SDL_SetAlpha(t->menus_right, SDL_SRCALPHA, 128); DrawSurface(t->menus_right, NULL, scr, &(SDL_Rect) {x+xw-8, w->bounds.y+6, 5, 7}); if (!args->isActive) SDL_SetAlpha(t->menus_right, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); if (args->nSelected) { s = wMenu_GetSelectedStr(m); SDL_Rect clip; SDL_GetClipRect(scr, &clip); SDL_SetClipRect(scr, &(SDL_Rect) {x+2, w->bounds.y, xw-11, w->bounds.h}); if (args->nSelected>1) { char str[strlen(s)+5]; sprintf(str, "%s,...", s); DrawClippedStr(scr, t->menus_font1, x+2, w->bounds.y+6, str); } else if (args->nSelected==1) DrawClippedStr(scr, t->menus_font1, x+2, w->bounds.y+6, s); SDL_SetClipRect(scr, &clip); } else { DrawClippedStr(scr, t->menus_font1, x+2 + (xw-4)/2, w->bounds.y+6, "-"); } }
void LevelMan::Draw(SDL_Rect *TileClips,SDL_Surface *tileSheet, Player *player, PSysMan *myPSysMan) { curLevel->Draw(TileClips,tileSheet); if(curLevel->MsgFadedIn() == true) { DrawSurface(curLevel->GetMsgX() - gameCamera.x, curLevel->GetMsgY() - gameCamera.y, curLevel->GetMsg(), mainScreen); } else if((curLevel->HasFadedIn() == true) && (curLevel->MsgFadedIn() == false)) { if((curLevel->GetID() != 5) && (curLevel->GetID() != 6) && (curLevel->GetID() != 7)) { curLevel->FadeMsgIn(MSG_FADE_SPEED, ((SCREEN_W - curLevel->GetMsg()->w)/2) - gameCamera.x, ((SCREEN_H - curLevel->GetMsg()->h)/4) - gameCamera.y); } else if((curLevel->GetID() == 5) || (curLevel->GetID() == 6)) { curLevel->FadeMsgIn(MSG_FADE_SPEED, ((SCREEN_W - curLevel->GetMsg()->w)/2) - gameCamera.x, (6 * TILE_H) - gameCamera.y); } else if(curLevel->GetID() == 7) { curLevel->FadeMsgIn(MSG_FADE_SPEED, ((SCREEN_W - curLevel->GetMsg()->w)/2) - gameCamera.x, ((SCREEN_H - curLevel->GetMsg()->h)/10) - gameCamera.y); } } player->Draw(curLevel); myPSysMan->Draw(); if(curLevel->HasFadedIn() == false) { curLevel->FadeIn(FADE_SPEED); } if(curLevel->isFinished()) { if((curLevel->HasFadedOut() == false)) { curLevel->FadeOut(FADE_SPEED); } } }
void Curves::reDraw() const { Slock(this->screen); DrawSurface(this->screen, this->back, 0, 0, 0, 0, this->back->w, this->back->h); vector<pair<curves::General *, CurveOptions *> >::const_iterator it; pair<curves::General *, CurveOptions *> currentPair; for (it = this->curves.begin(); it != this->curves.end(); it++) { currentPair = *it; if (currentPair.first) { currentPair.first->draw( this->screen, currentPair.second->pointColor, currentPair.second->pointRadius, currentPair.second->curveColor ); } } vector<pair<polygon::Point, PointOptions *> >::const_iterator jt; pair<polygon::Point, PointOptions *> currentPointPair; for (jt = this->points.begin(); jt != this->points.end(); jt++) { currentPointPair = *jt; drawCircle( this->screen, currentPointPair.first.first, currentPointPair.first.second, currentPointPair.second->pointColor, currentPointPair.second->pointRadius ); } Sulock(this->screen); SDL_Flip(this->screen); }
int OpenMenu(Widget *w, wMENU *m, int xr, int xl, int minWidth, int y) { if (!w || !m) return MENU_QUIT; if (!m->nItems || !m->items) return MENU_QUIT; SDL_Surface *scr = w->construct->scr; wTHEME *t = w->construct->theme; ListArgs *args = w->args; wITEM *itm; wMENU *menu; int x, l; SDL_Rect area; SDL_Surface *saveImage; Uint32 c = Darker(t->color1, 60); Uint32 cs1 = Darker(t->menus_c1, 15); // color selection args->cMenu = m; args->yItem = 0; args->cItem = 0; int dItems = min(args->dItems, m->nItems); if (!dItems) dItems = m->nItems; SDL_Rect clip; SDL_GetClipRect(scr, &clip); int b; int ok = ACTION_CONTINUE; // calcul de la hauteur int h = 10*dItems+2; while (h > 234) h-=10, dItems-=1; if (y+h > scr->h) y = scr->h - h; // calcul de la largeur int wd = 0; for (x=0; x < m->nItems; x++) { itm = m->items[x]; l = nSDL_GetStringWidth(t->menus_font1, itm->str); if (l > wd) wd = l; l = nSDL_GetStringWidth(t->menus_font2, itm->str); if (l > wd) wd = l; } wd += 10; if (m->nItems > dItems) wd += 7; // pour les scrollbars if (wd < minWidth) wd = minWidth; if (wd > scr->w) wd = scr->w; if (xr+wd > scr->w) { if (xl-wd > 0) xr = xl - wd; else xr = scr->w - wd; } // sauvegarde de l'image area = (SDL_Rect) {xr, y, wd, h}; saveImage = SDL_CreateRGBSurface(SDL_SWSURFACE, wd, h, 16, 0, 0, 0, 0); DrawSurface(scr, &area, saveImage, NULL); if ((ok=wExecCallback(w, SIGNAL_ACTION)) != ACTION_CONTINUE) { SDL_FreeSurface(saveImage); return ok; } do { // dessin !!! SDL_SetClipRect(scr, &area); DrawFillRect(scr, &area, t->menus_c1); DrawRect(scr, &area, c); for (x=0; x < dItems; x++) { itm = m->items[x + args->yItem]; if (x == args->cItem) DrawFillRectXY(scr, xr+1, y+1+10*x, wd-2, 10, cs1); if (itm->magicNumber == 1) { menu = (wMENU *) itm; if (wMenu_HasSelectedItemOrMenu(menu)) DrawClippedStr(scr, t->menus_font2, xr+2, y+2+10*x, menu->title); else DrawClippedStr(scr, t->menus_font1, xr+2, y+2+10*x, menu->title); DrawSurface(t->menus_right,NULL,scr, &(SDL_Rect){xr+wd - (m->nItems > dItems? 17:8), y+2+10*x, 5, 7}); } else { if (itm->isSelected) DrawClippedStr(scr, t->menus_font2, xr+2, y+2+10*x, itm->str); else DrawClippedStr(scr, t->menus_font1, xr+2, y+2+10*x, itm->str); } } if (m->nItems > dItems) DrawVScrollBar(scr, t, &area, 10*m->nItems+2, 10*args->yItem); SDL_SetClipRect(scr, &clip); // activation !!! itm = m->items[args->cItem + args->yItem]; ACTIVATION: SDL_Flip(scr); while ((any_key_pressed() && !K_CTRL()) || K_CLICK()); while (!any_key_pressed()); if (K_CLICK() || K_ENTER()) { if (K_ENTER() && args->maxSelected != 1) { ok = wExecCallback(w, SIGNAL_CLICK); break; } if (itm->magicNumber == 1) goto NEWMENU; if (args->maxSelected == 1) { if (args->nSelected) wMenu_DeselectAll(args->menu); wMenu_SelectItem(m, args->yItem + args->cItem); args->nSelected = 1; DrawSurface(saveImage, NULL, scr, &area); SDL_FreeSurface(saveImage); saveImage = NULL; ok = wExecCallback(w, K_CLICK() || K_ENTER()? SIGNAL_CLICK : SIGNAL_ACTION); break; } else if (args->maxSelected >= 0) { b = wMenu_IsSelected(m, args->yItem + args->cItem); if (!b && args->nSelected) if (args->nSelected == args->maxSelected) goto ACTIVATION; wMenu_SelectItem(m, args->yItem + args->cItem); if (b) args->nSelected--; else args->nSelected++; } if ((ok=wExecCallback(w, SIGNAL_CLICK)) != ACTION_CONTINUE) break; } else if (K_UP()) { if (!args->yItem && !args->cItem) { if (K_CTRL()) goto ACTIVATION; args->cItem = dItems-1; args->yItem = m->nItems-dItems; } else { if (args->cItem) args->cItem--; else args->yItem--; } if ((ok=wExecCallback(w, SIGNAL_ACTION)) != ACTION_CONTINUE) break; } else if (K_DOWN()) { if (args->yItem + args->cItem >= m->nItems-1) { if (K_CTRL()) goto ACTIVATION; args->cItem = 0; args->yItem = 0; } else { if (args->cItem < dItems-1) args->cItem++; else args->yItem++; } if ((ok=wExecCallback(w, SIGNAL_ACTION)) != ACTION_CONTINUE) break; } else if (K_RIGHT() && itm->magicNumber == 1) { NEWMENU:; int yI = args->yItem, cI = args->cItem; ok = OpenMenu(w, (wMENU *) itm, xr+wd-3, xr, minWidth, y+10*args->cItem); args->cMenu = m; args->yItem = yI; args->cItem = cI; if (K_ESC() || K_ENTER() || (K_CLICK() && args->maxSelected == 1) || ok != ACTION_CONTINUE) break; if ((ok=wExecCallback(w, SIGNAL_ACTION)) != ACTION_CONTINUE) break; } else if (K_LEFT()) break; } while (!K_ESC()); if (saveImage) { DrawSurface(saveImage, NULL, scr, &area); SDL_FreeSurface(saveImage); } return ok; }
void NXSurface::DrawSurface(NXSurface *src, int dstx, int dsty) { DrawSurface(src, dstx, dsty, 0, 0, src->Width(), src->Height()); }
void BoxBrowser::Draw() { if( !visible ) return; if( needToUpdateBoxes ) { needToUpdateBoxes = false; viewMode = viewFlow; Shift( 0 ); } if( viewMode == viewFlow ) { //draw text and any other 2D elements ( and leave it in 2D for the rest of the gui ) gameText->Draw(); //change to 3D context to draw boxes tiny3d_Project3D(); //draw the surface DrawSurface(); //update camera motion UpdateCamera(); for( int i = 0; i < NUM_BOXES; i++ ) { int mtxIdx = ( ( i * ANIMATION_FRAMES ) + animFrame ); if( mtxIdx >= (int)mtxBox.size() || mtxIdx < 0 ) { continue; } tiny3d_SetMatrixModelView( &mtxBox[ mtxIdx ] ); box[ i ]->DrawNoMtx(); } UpdateAnimation(); } else if( viewMode == viewZoom ) { //draw text and any other 2D elements ( and leave it in 2D for the rest of the gui ) if( bgImg2 ) { bgImg2->Draw(); } if( bgImg1 ) { //make sure this image is positioned correctly if( !bgLoaded && bgImg1->IsLoaded() ) { bgLoaded = true; //this image should either be 1000px wide or 1920 if( bgImg1->GetWidth() <= 1000 ) bgImg1->SetPosition( 124, 69, 0xfff0 );//these values seem to work for all my guitar hero & rockband games else bgImg1->SetPosition( 0, 0, 0xfff0 );//i dont have any games that fit this category, but i assume this is right } bgImg1->Draw(); } //change to 3D tiny3d_Project3D(); //update camera motion UpdateCamera(); //set matrix for zoomed box SetZoomMatrix(); //the center box hopefully is the selected one box[ NUM_BOXES / 2 ]->DrawNoMtx(); } //done in 3D mode, switch to 2D tiny3d_SetMatrixModelView( NULL ); // set matrix identity tiny3d_Project2D(); busy = false; inputIdx = 0; }
void Cube::Render() const { // Gera cubo centrado na origem // Ordem: face da frente, face de trás, lado esquerdo, lado direito, parte de cima, parte de baixo // Frente glPushMatrix(); glTranslatef(0, 0, 0.5); glColor3f(0, 0, 0); glNormal3f(0, 0, 1); DrawSurface(); glPopMatrix(); // Tras glPushMatrix(); glTranslatef(0, 0, -0.5); glColor3f(0, 1, 0); glNormal3f(0, 0, -1); DrawSurface(); glPopMatrix(); // Esquerda glPushMatrix(); glTranslatef(-0.5, 0, 0); glRotatef(90, 0, 1, 0); glColor3f(0, 0, 1); glNormal3f(0, 0, -1); DrawSurface(); glPopMatrix(); // Direita glPushMatrix(); glTranslatef(0.5, 0, 0); glRotatef(90, 0, 1, 0); glColor3f(1, 0, 0); glNormal3f(0, 0, 1); DrawSurface(); glPopMatrix(); // Cima glPushMatrix(); glTranslatef(0, 0.5, 0); glRotatef(90, 1, 0, 0); glColor3f(0.6, 0.5, 0.8); glNormal3f(0, 0, -1); DrawSurface(); glPopMatrix(); // Baixo glPushMatrix(); glTranslatef(0, -0.5, 0); glRotatef(90, 1, 0, 0); glColor3f(0.9, 0.1, 0.224); glNormal3f(0, 0, 1); DrawSurface(); glPopMatrix(); }
void TitleDraw() { DrawSurface(res.title, 0, 0, 640, 480); }