void ClosingCinematicScreen::draw(float dt) { if (currentScene == Scenes::GROTESQUE_CLOSEUP) { currentSprite->Render(0.0, 0.0); if (timeInScene > 1.5) { tongueAngle -= 1.3 * dt; tongueOffset -= 550.0 * dt; //tongueAngle -= 1.7 * dt; //tongueOffset -= 900.0 * dt; smh->resources->GetSprite("hugeTongue")->RenderEx(-100, tongueOffset, tongueAngle, 1.0, 1.0); } } smh->drawScreenColor(Colors::BLACK, fadeInAlpha); if (currentScene > 0) { currentSprite->SetColor(ARGB(fadeOutAlpha, 255, 255, 255)); currentSprite->Render(512.0 - 220.0, 284.0 - 170.0 + pictureOffset); smh->resources->GetFont("inventoryFnt")->SetColor(ARGB(textAlpha, 255.0, 255.0, 255.0)); smh->resources->GetFont("inventoryFnt")->printf(512.0, 600.0, HGETEXT_CENTER, text.c_str()); smh->resources->GetFont("inventoryFnt")->SetColor(ARGB(255.0, 255.0, 255.0, 255.0)); } }
void SimplePopup::Render() { mClosed = false; float modX = (SCREEN_WIDTH_F / 2)-5; JRenderer *r = JRenderer::GetInstance(); string detailedInformation = getDetailedInformation(mDeckInformation->getFilename()); #if !defined (PSP) JQuadPtr statsholder = WResourceManager::Instance()->RetrieveTempQuad("statsholder.png");//new graphics statsholder //const float textHeight = mTextFont->GetHeight() * mMaxLines; //r->FillRect(0,0,SCREEN_WIDTH_F,SCREEN_HEIGHT_F,ARGB(220,15,15,15)); if(statsholder.get()) r->RenderQuad(statsholder.get(),0,0,0,SCREEN_WIDTH_F/statsholder->mWidth,SCREEN_HEIGHT_F/statsholder->mHeight); #endif r->FillRoundRect(mX+modX+3, mY + 7, 190.f, 148.f, 0, ARGB( 240, 15, 15, 15 ) ); // currently causes a crash on the PSP when drawing the corners. // TODO: clean up the image ot make it loook cleaner. Find solution to load gfx to not crash PSP #if 0 r->DrawRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 125, 255, 0) ); drawBoundingBox( mX-3, mY, mWidth + 3, textHeight ); #endif mTextFont->DrawString(detailedInformation.c_str(), modX+mX + 9 , mY + 15); }
GUIAppListBox::GUIAppListBox ( int _id, float x, float y, float w, float h, const char *btn11, const char *btn12, const char *btn13, const char *btn21, const char *btn22, const char *btn23) : GUIAppObject () { bStatic=false; bVisible=true; bEnabled=true; id = _id; rect.Set(x,y,x+w,y+h); bgColor = ARGB(0xaf,0xA0,0xA0,0xA0); frameColor = ARGB(0xff,0xFF,0xFF,0xFF); selColor = ARGB(0xaf,0xF0,0xF0,0xF0); sepHeight = 1; oldVValue = 0; oldHValue = 0; selectIndex = 0; // scrollers vscroll = new GUIAppScrollBar(VSCROLL,GUIAppScrollBar::V_SCROLL,x+w,y,h,btn11,btn12,btn13); vscroll->SetParent(this); hscroll = new GUIAppScrollBar(HSCROLL,GUIAppScrollBar::H_SCROLL,x,y+h,w,btn21,btn22,btn23); hscroll->SetParent(this); // moving vscroll->Move(vscroll->GetWidth(),0); hscroll->Move(0,hscroll->GetHeight()); // set size SetupSize(w,h); SetupSelection(); }
void AStar::render() { _Recorder::render(); // 绘制路径 if (m_navigator->getSearchResult() == Navigator::SearchResult_Completed) { CellCoord prevCellCoord = g_Game.getStartCoord(); std::list<int> path; m_navigator->getPath(path); for (std::list<int>::iterator it = path.begin(); it != path.end(); ++it) { Location prevCenterLocation = util::cellCoordToLocation(prevCellCoord); prevCenterLocation += Location(CELL_SIZE_X/2, CELL_SIZE_Y/2); CellCoord currentCellCoord = g_Board.toNodeCoord(*it); Location currentCenterLocation = util::cellCoordToLocation(currentCellCoord); currentCenterLocation += Location(CELL_SIZE_X/2, CELL_SIZE_Y/2); g_HGE->Gfx_RenderLine(prevCenterLocation.x, prevCenterLocation.y, currentCenterLocation.x, currentCenterLocation.y, ARGB(255, 132, 38, 64) ); g_HGE->Gfx_RenderLine(prevCenterLocation.x, prevCenterLocation.y+1, currentCenterLocation.x, currentCenterLocation.y+1, ARGB(255, 132, 38, 64) ); prevCellCoord = currentCellCoord; } g_Font.printf(2, 2, HGETEXT_LEFT, "path total cost: %d", m_navigator->getPathCost()); } }
void DamagerDamaged::Render(CombatStep mode) { TransientCardView::Render(); WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); mFont->SetBase(0); switch (mode) { case BLOCKERS: case TRIGGERS: case ORDER: mFont->SetColor(ARGB(92,255,255,255)); break; case FIRST_STRIKE: case END_FIRST_STRIKE: case DAMAGE: case END_DAMAGE: mFont->SetColor(ARGB(255, 255, 64, 0)); break; } char buf[6]; sprintf(buf, "%i", sumDamages()); mFont->DrawString(buf, actX - 14 * actZ + 5, actY - 14 * actZ); }
bool Garden::Garden_Render_GOODS(int j, int i) { //显示光环 for(int k = 0; k < 30; ++k) { if(goods[k].first == 0 && goods[k].vis == true && goods[k].eat == false && goods[k].x == i && goods[k].y == j) { int id = 11; bgQuads[id]->v[0].x = mx[j][i] - 25.0f, bgQuads[id]->v[0].y = my[j][i] - 10.0f; bgQuads[id]->v[1].x = mx[j][i] + 25.0f, bgQuads[id]->v[1].y = my[j][i] - 10.0f; bgQuads[id]->v[2].x = mx[j][i] + 25.0f, bgQuads[id]->v[2].y = my[j][i] + 40.0f; bgQuads[id]->v[3].x = mx[j][i] - 25.0f, bgQuads[id]->v[3].y = my[j][i] + 40.0f; hge->Gfx_RenderQuad(bgQuads[id]); } } //显示物品 for(int k = 0; k < 30; ++k) { int id = goods[k].id + 8; float xx = mx[j][i]; float yy = my[j][i]; if(goods[k].skill) { xx = goods[k].xx; yy = goods[k].yy; } bgQuads[id]->v[0].x = xx - 15.0f, bgQuads[id]->v[0].y = yy; bgQuads[id]->v[1].x = xx + 15.0f, bgQuads[id]->v[1].y = yy; bgQuads[id]->v[2].x = xx + 15.0f, bgQuads[id]->v[2].y = yy + 30.0f; bgQuads[id]->v[3].x = xx - 15.0f, bgQuads[id]->v[3].y = yy + 30.0f; for(int p = 0; p < 4; ++p) bgQuads[id]->v[p].col = ARGB(0x5f, 0xff, 0xff, 0xff); if(goods[k].free == true && goods[k].eat == false && goods[k].x == i && goods[k].y == j) { for(int p = 0; p < 4; ++p) bgQuads[id]->v[p].col = ARGB(0xff, 0xff, 0xff, 0xff); hge->Gfx_RenderQuad(bgQuads[id]); } if(goods[k].first == 0 && goods[k].vis == true && goods[k].eat == false && goods[k].x == i && goods[k].y == j) { hge->Gfx_RenderQuad(bgQuads[id]); } if(goods[k].first == 1 && goods[k].eat == false && goods[k].x == i && goods[k].y == j) { //方案一,移动 id = goods[k].id + 8; hge->Gfx_RenderQuad(bgQuads[id]); //方案二,光束 id = 12; hge->Gfx_RenderQuad(bgQuads[id]); } } return false; }
/** * Draws all silly pads that have been created. */ void SpecialTileManager::drawSillyPads(float dt) { std::list<SillyPad>::iterator i; for(i = sillyPadList.begin(); i != sillyPadList.end(); i++) { //Fade out during the last 2 seconds float timeLeft = (float)SILLY_PAD_TIME - smh->timePassedSince(i->timePlaced); if (timeLeft < 1.0f) { smh->resources->GetSprite("sillyPad")->SetColor(ARGB((timeLeft/1.0f)*255.0f,255,255,255)); } smh->resources->GetSprite("sillyPad")->Render(smh->getScreenX(i->gridX*64.0), smh->getScreenY(i->gridY*64.0)); smh->resources->GetSprite("sillyPad")->SetColor(ARGB(255,255,255,255)); } }
void CCockpit::DrawArrow( Sint32 bx , Sint32 by ) { //------------------------------------ //アロー表示 //------------------------------------ Sint32 z = PRIO_GAMETOP; Float32 fScl=1.f; Sint32 sCol = 0xA0*m_sArrowWait/100; Sint32 sRot = viiSub::GameCounter()%360;//m_sArrowWait; Sint32 x,y; fScl = 1.f+m_sArrowWait/100.f; x = bx; y = by; if( m_sArrowRot == 1000 ) { //ビックリマーク // viiSub::MenuSprite( x,y,z, enTexPageSystemUI,16,80 ,16,32,8,16 ,ATR_DFLT, ARGB((0xA0-sCol),0xFF,0xFF,0xFF) , 0 ); // viiSub::MenuSprite( x,y,z, enTexPageGrowObj,0,208 ,192,48,96,24 ,ATR_DFLT, ARGB((sCol),0xFF,0xFF,0xFF) , 0 , 2.f , 1.f); viiSub::MenuSprite( x,y,z, enTexPageGrowObj,0,208 ,192,48,96,24 ,ATR_DFLT, ARGB((sCol),0xFF,0xFF,0xFF) , 0 , 0.5f , 0.5f); return; } else if( m_sArrowRot == 2000 ) { viiSub::MenuSprite( WINDOW_W-64,WINDOW_H/2,z, enTexPageGrowObj,0,208 ,192,48,96,24 ,ATR_DFLT, ARGB((sCol),0xFF,0xFF,0xFF) , 0 , 0.5f , 0.5f); return; } else if( m_sArrowRot == 3000 ) { viiSub::MenuSprite( WINDOW_W/2,WINDOW_H-32,z, enTexPageGrowObj,0,208 ,192,48,96,24 ,ATR_DFLT, ARGB((sCol),0xFF,0xFF,0xFF) , 0 , 0.5f , 0.5f); return; } else if( m_sArrowRot == 4000 ) { viiSub::MenuSprite( 64,WINDOW_H/2,z, enTexPageGrowObj,0,208 ,192,48,96,24 ,ATR_DFLT, ARGB((sCol),0xFF,0xFF,0xFF) , 0 , 0.5f , 0.5f); return; } else { //アロー Sint32 ax = (viiMath::Cos100(m_sArrowRot)*(100-m_sArrowWait))/1000; Sint32 ay = (viiMath::Sin100(m_sArrowRot)*(100-m_sArrowWait))/1000; viiSub::MenuSprite( x+ax,y+ay,z, enTexPageSystemUI,32,80 ,16,32,8,16 ,ATR_DFLT, ARGB((sCol),251,245,198) , m_sArrowRot*1.f ); } viiSub::MenuSprite( x,y,z, enTexPageSystemUI,48,80 ,32,32,16,16 ,ATR_DFLT, ARGB(sCol,32,243,198) , sRot*1.f ,fScl,fScl); // viiSub::MenuSprite( x,y,z, enTexPageSystemUI,48,80 ,32,32,16,16 ,ATR_DFLT, ARGB(sCol,0xFF,0xFF,0xFF) ,-sRot*1.f ,fScl); }
void GuiGameZone::Render() { //Texture JQuadPtr quad = WResourceManager::Instance()->GetQuad(kGenericCardThumbnailID); float scale = defaultHeight / quad->mHeight; quad->SetColor(ARGB((int)(actA),255,255,255)); if(type == GUI_EXILE) { quad->SetColor(ARGB((int)(actA),255,240,255)); } JRenderer::GetInstance()->RenderQuad(quad.get(), actX, actY, 0.0, scale * actZ, scale * actZ); float x0 = actX; if (x0 < SCREEN_WIDTH / 2) { x0 += 7; } if (mHasFocus) JRenderer::GetInstance()->FillRect(actX, actY, quad->mWidth * scale * actZ, quad->mHeight * scale * actZ, ARGB(abs(128 - wave),255,255,255)); //Number of cards WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); char buffer[11]; int mAlpha = (int) (actA); /*if(type == GUI_GRAVEYARD) sprintf(buffer, "%i\ng", zone->nb_cards); else if(type == GUI_LIBRARY) sprintf(buffer, "%i\nl", zone->nb_cards); else if(type == GUI_OPPONENTHAND) sprintf(buffer, "%i\nh", zone->nb_cards); else if(type == GUI_EXILE) sprintf(buffer, "%i\ne", zone->nb_cards); else*/ sprintf(buffer, "%i", zone->nb_cards); mFont->SetColor(ARGB(mAlpha,0,0,0)); mFont->DrawString(buffer, x0 + 1, actY + 1); if (actA > 120) mAlpha = 255; mFont->SetColor(ARGB(mAlpha,255,255,255)); mFont->DrawString(buffer, x0, actY); if (showCards) cd->Render(); for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it) (*it)->Render(); PlayGuiObject::Render(); }
void DrawWorkMeter( AGDrawBuffer* DBuf ) { u32 Start = 32; u32 DrawWidth = g_FBWidth - 32*2; u32 Height = g_FBHeight; u32 Width; int i; int j; int dw; if( aglGetMainDisplay() == 0 ) { // 表示A Width = AG4REG.DSPAVPRM0.VSC * g_VWidth; dw = AG4REG.DSPAVPRM0.VSC*DrawWidth; } else { Width = AG4REG.DSPBVPRM0.VSC * g_VWidth; dw = AG4REG.DSPBVPRM0.VSC*DrawWidth; }; AG_DRAW_SETATEST( *DBuf , 0 , 7 , 0 ); AG_DRAW_SETDTEST( *DBuf , 7 , 0 ); for( i=0 ; i<WorkMeterCount ; i++ ) { u32 Pos = WorkMeterPos[i] * DrawWidth / Width + 32; AG_DRAW_SETFCOLOR_ARGB( *DBuf , WorkMeterColor[i] ); AG_DRAW_RECTANGLE( *DBuf , Start<<2 , (Height-32)<<2 , Pos<<2 , (Height-32+5)<<2 ); Start = Pos; }; for( i=0 ; i<=g_VWidth ; i++ ) { AG_DRAW_SETFCOLOR_ARGB( *DBuf , ARGB( 255 , 255 , 255 , 255 ) ); AG_DRAW_RECTANGLE( *DBuf , (i*dw/Width+32)<<2 , (Height-32-2)<<2 , (i*dw/Width+32+1)<<2 , (Height-32+5+2)<<2 ); if( i < g_VWidth ) { AG_DRAW_SETFCOLOR_ARGB( *DBuf , ARGB( 255 , 128 , 128 , 128 ) ); for( j=1 ; j<10 ; j++ ) { int dh = 0; if( j == 5 ) { dh = 1; }; AG_DRAW_RECTANGLE( *DBuf , ((i*dw + (dw*j/10))/Width+32)<<2 , (Height-32-dh)<<2 , ((i*dw + (dw*j/10))/Width+32+1)<<2 , (Height-32+5+dh)<<2 ); }; }; }; }
int main(void) { BImage img1 = { 966, 1165, (BColor*)malloc(966 * 1165 * sizeof(BColor)) }; BImage img2 = { 966, 1165, (BColor*)malloc(966 * 1165 * sizeof(BColor)) }; for (int i = 0; i < 966 * 1165; i++) { img1.data[i] = ARGB((byte)255, (byte)255, (byte)255, (byte)0); img2.data[i] = ARGB((byte)255, (byte)255, (byte)255, (byte)0); } auto diffResult = diff_img_byte(img1, img2, DiffOptions{ ARGB((byte)255, (byte)0, (byte)0, (byte)255), 0.2f, 1.0f, OverlayType::Flat, 0, 0 }); free_img_mem(diffResult.img.data); }
void OptionKey::Overlay() { JRenderer * renderer = JRenderer::GetInstance(); WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT); mFont->SetColor(ARGB(255, 0, 0, 0)); if (grabbed) { static const float x = 30, y = 45; renderer->FillRoundRect(x, y, SCREEN_WIDTH - 2 * x, 50, 2, ARGB(200, 200, 200, 255)); string msg = _("Press a key to associate."); mFont->DrawString(msg, (SCREEN_WIDTH - mFont->GetStringWidth(msg.c_str())) / 2, y + 20); } else if (btnMenu) btnMenu->Render(); }
void Damage::Render() { WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); mFont->SetBase(0); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); char buffer[200]; sprintf(buffer, _("Deals %i damage to").c_str(), damage); //mFont->DrawString(buffer, x + 20, y, JGETEXT_LEFT); mFont->DrawString(buffer, x + 32, y + GetVerticalTextOffset(), JGETEXT_LEFT); JRenderer * renderer = JRenderer::GetInstance(); JQuadPtr quad = WResourceManager::Instance()->RetrieveCard(source, CACHE_THUMB); if (quad.get()) { //float scale = 30 / quad->mHeight; //renderer->RenderQuad(quad.get(), x, y, 0, scale, scale); quad->SetColor(ARGB(255,255,255,255)); float scale = mHeight / quad->mHeight; renderer->RenderQuad(quad.get(), x + (quad->mWidth * scale / 2), y + (quad->mHeight * scale / 2), 0, scale, scale); } else { //mFont->DrawString(_(source->getName()).c_str(), x, y - 15); mFont->DrawString(_(source->getName()).c_str(), x, y + GetVerticalTextOffset() - 15); } quad = target->getIcon(); if (quad.get()) { //float scale = 30 / quad->mHeight; //renderer->RenderQuad(quad.get(), x + 150, y, 0, scale, scale); float backupX = quad->mHotSpotX; float backupY = quad->mHotSpotY; quad->SetColor(ARGB(255,255,255,255)); quad->SetHotSpot(quad->mWidth / 2, quad->mHeight / 2); float scale = mHeight / quad->mHeight; renderer->RenderQuad(quad.get(), x + 130, y - 0.5f + ((mHeight - quad->mHeight) / 2) + quad->mHotSpotY, 0, scale, scale); quad->SetHotSpot(backupX, backupY); } else { //if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE) //mFont->DrawString(_(((MTGCardInstance *) target)->getName()).c_str(), x + 120, y); if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE) mFont->DrawString(_(((MTGCardInstance *) target)->getName()).c_str(), x + 35, y+15 + GetVerticalTextOffset()); else if(target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER) mFont->DrawString(_(((Player *) target)->getDisplayName()).c_str(), x + 35, y+15 + GetVerticalTextOffset()); } }
void Button_t::paint() { cr = graphics.getContext(); clearSurface(); bounds = getBounds(); if (enabled) { if (shapeColor == ARGB(120, 211, 211, 211)) shapeColor = previous; if (state.focused) border = RGB(0, 200, 0); else border = RGB(180, 180, 180); } else { previous = shapeColor; shapeColor = ARGB(120, 211, 211, 211); } // prepare double x = 0.5; double y = 0.5; double width = bounds.width - 1; double height = bounds.height - 1; double radius = 2.5; double degrees = M_PI / 180.0; cairo_new_sub_path(cr); cairo_arc(cr, x + width - radius, y + radius, radius, -90 * degrees, 0 * degrees); cairo_arc(cr, x + width - radius, y + height - radius, radius, 0 * degrees, 90 * degrees); cairo_arc(cr, x + radius, y + height - radius, radius, 90 * degrees, 180 * degrees); cairo_arc(cr, x + radius, y + radius, radius, 180 * degrees, 270 * degrees); cairo_close_path(cr); cairo_set_source_rgba(cr, ARGB_TO_CAIRO_PARAMS(shapeColor)); cairo_fill_preserve(cr); cairo_set_source_rgba(cr, ARGB_TO_CAIRO_PARAMS(border)); cairo_set_line_width(cr, 1); cairo_stroke(cr); if (pathToLoad) { pngSurface = graphics.getContext(); cairo_set_source_surface(pngSurface, png, pngPosition.x, pngPosition.y); cairo_paint(pngSurface); } }
void drawSet(AGDrawBuffer* DBuf, struct Field* field, struct Player* player) { int i; //Init agDrawBufferInit( DBuf , DrawBuffer ); agDrawSETDAVR( DBuf , 0 , 0 , aglGetDrawFrame() , 0 , 0 ); agDrawSETDAVF( DBuf, 0, 0, s(FB_WIDTH), s(FB_HEIGHT) ); //白背景 agDrawSETFCOLOR( DBuf, ARGB( 255, 255, 255, 255 ) ); agDrawSETDBMODE( DBuf, 0xff, 0, 0, 1 ); agDrawSPRITE( DBuf, 0, 0, 0, s(FB_WIDTH), s(FB_HEIGHT) ); //フィールド drawField( DBuf, field); //戦艦 for(i=0;i<5;i++){ drawBattleShip(DBuf, &(player->battleShip[i])); } /* //数字を描画する場所の白い四角 agDrawSETFCOLOR( DBuf, ARGB( 255, 255, 255, 255 ) ); agDrawSETDBMODE( DBuf, 0xff, 0, 0, 1 ); agDrawSPRITE( DBuf, 0, 100-20, 100-20, 100+50*10+20, 100+90+20); //数字の描画 drawNumberGraph(20131120, 100,100,50,90,10,DBuf); */ }
void GameStateLoading::Render() { mRenderer->ClearScreen(ARGB(255,0,0,0)); float p = ((float)mStage/8); mRenderer->RenderQuad(gBgQuad,0,0); mRenderer->RenderQuad(gLogoQuad,0,0); mRenderer->FillRect(SCREEN_WIDTH*p,0,SCREEN_WIDTH*(1-p),SCREEN_HEIGHT,ARGB(200,0,0,0)); /*mRenderer->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,ARGB(255-(int)(p*255),0,0,0)); mRenderer->FillRect(SCREEN_WIDTH_2-200,SCREEN_HEIGHT_2-4,400,8,ARGB(255,100,100,100)); mRenderer->FillRect(SCREEN_WIDTH_2-200,SCREEN_HEIGHT_2-4,400*p,8,ARGB(255,255,255,255));*/ }
void Graph_ClearShadowArea( LCUI_PaintContext paint, LCUI_Rect *box, LCUI_BoxShadow *shadow ) { int i; LCUI_Graph canvas; LCUI_Rect rect, box_area, rects[4]; rect.w = box->w; rect.h = box->h; rect.x = rect.y = 0; /* 获取内容框区域 */ box_area.x = box->x + BoxShadow_GetBoxX( shadow ); box_area.y = box->y + BoxShadow_GetBoxY( shadow ); box_area.w = BoxShadow_GetBoxWidth( shadow, box->w ); box_area.h = BoxShadow_GetBoxHeight( shadow, box->h ); /* 获取内容框外的阴影区域 */ LCUIRect_CutFourRect( &box_area, &rect, rects ); for( i=0; i<4; ++i ) { if( LCUIRect_GetOverlayRect( &paint->rect, &rects[i], &rects[i] ) ) { rects[i].x -= paint->rect.x; rects[i].y -= paint->rect.y; Graph_Quote( &canvas, &paint->canvas, &rects[i] ); Graph_FillRect( &canvas, ARGB(0,0,0,0), NULL, TRUE ); } } }
void Clock::Render() { POINT p; p.x = 0; p.y = 12 * scale; Campus::GetInst()->Add(imageList[BACK], pos.x - dst[BACK].w*scale / 2 + dst[BACK].x*scale, pos.y - dst[BACK].h*scale / 2 + dst[BACK].y*scale, dst[BACK].w*scale, dst[BACK].h*scale, src[BACK].x, src[BACK].y, src[BACK].w, src[BACK].h); Campus::GetInst()->Add(imageList[HOUR], pos.x - dst[HOUR].w*scale / 2 + dst[HOUR].x*scale, pos.y - dst[HOUR].h*scale / 2 + dst[HOUR].y*scale, dst[HOUR].w*scale, dst[HOUR].h*scale, src[HOUR].x, src[HOUR].y, src[HOUR].w, src[HOUR].h, p, hourAngle); Campus::GetInst()->Add(imageList[MINUTE], pos.x - dst[MINUTE].w*scale / 2 + dst[MINUTE].x*scale, pos.y - dst[MINUTE].h*scale / 2 + dst[MINUTE].y*scale, dst[MINUTE].w*scale, dst[MINUTE].h*scale, src[MINUTE].x, src[MINUTE].y, src[MINUTE].w, src[MINUTE].h, p, minuteAngle); //卍成功演出用時計 if (state == State::SUCCESS&&SuccessCnt > 0){ DWORD S_Alpha = ARGB((int)((float)SuccessCnt / (float)SUCCESS_EFFECT_TIME*127.0f) , 255, 255, 255); float AddScale = (float)Mine_SChain / (float)CHAIN_EFFECT_MAX*CHAIN_MAX_SCALE; AddScale *= 1.0f - (float)SuccessCnt / (float)SUCCESS_EFFECT_TIME; Campus::GetInst()->Add(imageList[BACK], pos.x - dst[BACK].w*(AddScale + scale) / 2 + dst[BACK].x*(AddScale + scale), pos.y - dst[BACK].h*(AddScale + scale) / 2 + dst[BACK].y*(AddScale + scale), dst[BACK].w*(AddScale + scale), dst[BACK].h*(AddScale + scale), src[BACK].x, src[BACK].y, src[BACK].w, src[BACK].h, GetPoint(0, 0), 0, 1, RS_COPY, (DWORD)S_Alpha, 0.0f); } }
void setValue(float v) { value=v; for(int i=0;i<=1024;++i) { int tr=(int)((1.0f-value)*255); int tg=(int)(value*255); DWORD tcolor=ARGB(alpha,tr,tg,0); smColorHSVA *tc=new smColorHSVA(tcolor); if(tc->v<0.85)tc->v=0.85; tcolor=color?SETA(color,alpha):SETA(tc->getHWColor(),alpha); delete tc; if((float)i/1024.<=value) { circle->setColor(i,2,tcolor); circle->setColor(i,1,SETA(0x00FFFFFF,alpha)); circle->setColor(i,0,tcolor); } else { circle->setColor(i,2,0); circle->setColor(i,1,0); circle->setColor(i,0,0); } } }
void PutInGraveyard::Render() { WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT); mFont->SetBase(0); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); if (!removeFromGame) { mFont->DrawString(_("goes to graveyard").c_str(), x + 30, y, JGETEXT_LEFT); } else { mFont->DrawString(_("is exiled").c_str(), x + 30, y, JGETEXT_LEFT); } JRenderer * renderer = JRenderer::GetInstance(); JQuadPtr quad = observer->getResourceManager()->RetrieveCard(card, CACHE_THUMB); if (quad.get()) { quad->SetColor(ARGB(255,255,255,255)); float scale = 30 / quad->mHeight; renderer->RenderQuad(quad.get(), x, y, 0, scale, scale); } else { mFont->DrawString(_(card->name).c_str(), x, y - 15); } }
// 渲染游戏画面,返回0退出游戏 int CGame::OnRender(void) { m_pGrp->Clear(ARGB(255,0,0,0)); m_pGrp->BeginScene(); // 画地图,人物,对象,怪物... //m_pGrp->DrawText("网络大地图演示", 10, 10, RGB(255,0,0)); list<LINE*>::iterator it = m_listLine.begin(); list<LINE*>::iterator itEnd = m_listLine.end(); while(it != itEnd) { LINE* pPT = *it; m_pGrp->RenderLine(pPT->x0,pPT->y0,pPT->x1,pPT->y1); it++; } // // 画鼠标 // m_objMouse.Render( &m_grp ); /* m_pGrp->SwapBuffers();*/ m_pGrp->EndScene(); m_pFps->Show(); Sleep(1); return 1; }
/** * Initialize the textbox for hints. */ void TextBox::setHint() { textBoxType = TextBoxTypes::HINT_TYPE; init(); smh->soundManager->playMusic("hintMusic"); npcID = BILL_CLINTON_TEXT_ID; //bill clinton's text id and npc id are the same textID = smh->saveManager->getCurrentHint(); paramString = "Hint"; paramString += Util::intToString(textID); paramString += "Pages"; numPages = atoi(smh->gameData->getGameText(paramString.c_str())); currentPage = 1; strcpy(text, "-"); fadeAlpha = 0.0; //Set distortion mesh for psychedelic background distortion =new hgeDistortionMesh(PSYCHEDELIC_GRANULARITY, PSYCHEDELIC_GRANULARITY); distortion->SetTexture(smh->resources->GetTexture("psychedelicTx")); distortion->SetTextureRect(0,0,1054,798); distortion->SetBlendMode(BLEND_COLORADD | BLEND_ALPHABLEND | BLEND_ZWRITE); distortion->Clear(0xFF000000); for (int i = 0; i < PSYCHEDELIC_GRANULARITY; i++) { for(int j = 0; j < PSYCHEDELIC_GRANULARITY; j++) { distortion->SetColor(i, j, ARGB(fadeAlpha, 0, 0, 0)); } } }
/*********************************************************************** * execute a menu action, based on line(current selected menu entry) ***********************************************************************/ static void do_leftright_action(uint16_t curpad) { if(view == 1) // only on second screen { switch(line) { case 2: // 3: Alpha (curpad & PAD_LEFT) ? a-- : a++; break; case 3: // 4: Red (curpad & PAD_LEFT) ? r-- : r++; break; case 4: // 5: Green (curpad & PAD_LEFT) ? g-- : g++; break; case 5: // 6: Blue (curpad & PAD_LEFT) ? b-- : b++; break; default: // do nothing return; } // update second screen bg_color bg_color_menu[view] = ARGB(a, r, g, b); play_rco_sound("system_plugin", "snd_cursor"); } }
static void DrawHorzTreeDot(suic::DrawingContext * drawing, int bx, int ex, int y) { for (int i = bx; i <= ex; ++i) { drawing->SetPixel(i++, y, ARGB(255,180,180,180)); } }
void Object::callRender(const hgeRect & clipRect) { if(!visible) return; if( layoutChanged ) updateLayout(); HGE * hge = getHGE(); hgeRect clip = hgeRect::Intersect(getRect(),clipRect); // if avialable area is zero - return if(clip.IsClean()) return; // craw self const bool uiDebug = false; // draw children if( clipChildren ) hge->Gfx_SetClipping(clip.x1, clip.y1, clip.x2 - clip.x1, clip.y2 - clip.y1); if(uiDebug) drawRect(hge, getRect(), ARGB(255,64,255,64)); onRender(); // turn off clipping if( clipChildren ) hge->Gfx_SetClipping(); //clip = hgeRect::Intersect(getClientRect(),clipRect); // render children for(Children::iterator it = children.begin(); it != children.end(); ++it) { Object * object = it->get(); if(object) object->callRender(clip); } }
static void DrawVertTreeDot(suic::DrawingContext * drawing, int by, int ey, int x) { for (int i = by; i <= ey; ++i) { drawing->SetPixel(x, i++, ARGB(255,180,180,180)); } }
void ETHRenderEntity::DrawCollisionBox(SpritePtr pOutline, const Color& dwColor, const Vector2 &zAxisDirection) const { VideoPtr video = m_provider->GetVideo(); const bool collidable = (m_properties.collision); const Vector3 v3Size = (collidable) ? m_properties.collision->size : Vector3(32,32,32); const Vector3 v3Pos = (collidable) ? (m_properties.collision->pos + GetPosition()) : GetPosition(); const Vector2 v2Pos = ETHGlobal::ToScreenPos(v3Pos, zAxisDirection)/* + Vector2(0, v3Size.y/2)*/; pOutline->SetOrigin(Sprite::EO_CENTER); const Video::ALPHA_MODE alphaMode = video->GetAlphaMode(); video->SetAlphaMode(Video::AM_PIXEL); const bool zBuffer = video->GetZBuffer(); video->SetZBuffer(false); const bool zWrite = video->GetZWrite(); video->SetZWrite(false); ShaderPtr pVS = video->GetVertexShader(); video->SetVertexShader(ShaderPtr()); const Color dwH = ARGB(150,dwColor.r,dwColor.g,dwColor.b); const float depth = video->GetSpriteDepth(); // base video->SetSpriteDepth(1.0f); pOutline->DrawShaped(v2Pos, Vector2(v3Size.x, v3Size.y), dwH, dwH, dwH, dwH, GetAngle()); video->SetZBuffer(zBuffer); video->SetZBuffer(zWrite); video->SetAlphaMode(alphaMode); video->SetVertexShader(pVS); video->SetSpriteDepth(depth); }
ScoreAnimation::ScoreAnimation(int score, float positionX, float positionY) :score(score), positionX(positionX), positionY(positionY),isMoving(false), speed(TOTAL_SCORE_POS_X - positionX, TOTAL_SCORE_POS_Y - positionY) { speed.Normalize(); acceleration = speed; speed.x = speed.x * initSpeedValue; speed.y = speed.y * initSpeedValue; acceleration.x *= accelerationValue; acceleration.y *= accelerationValue; fnt = new hgeFont("font/score1.fnt"); fnt->SetZ(0.1f); fnt->SetColor(ARGB(255, 255, 200, 0)); particleSprite = new hgeSprite(ResourceFactory::GetTexture(PARTICLE_TEXTURE_INDEX), 32, 32, 32, 32); particleSprite->SetBlendMode(BLEND_COLORMUL | BLEND_ALPHAADD | BLEND_NOZWRITE); particleSprite->SetZ(0.01f); particleSprite->SetHotSpot(16,16); particleSystem = new hgeParticleSystem("particles/score1.psi", particleSprite); particleSystem->Fire(); particleSystem->MoveTo(positionX, positionY); }
bool hSensor::update(){ time += dt; b2Vec2 pos = body->GetPosition(); x = pos.x; y = 6.0f - pos.y; switch(type){ case hSensorPunch: time -= dt*2; break; case hSensorGetPunch: if (fadeout != 0xFF){ fadeout -= dt*300; color = ARGB (fadeout, 0xFF, 0xFF, 00); if (fadeout <= 0){ hSensor * it; it = this; std::swap( it, sensors.back() ); sensors.resize(sensors.size() - 1); delete this; } } break; } return false; }
void AIStats::Render() { GameObserver * g = player->getObserver(); float x0 = 10; if (player == g->players[1]) x0 = 280; JRenderer::GetInstance()->FillRoundRect(x0, 10, 200, 180, 5, ARGB(50,0,0,0)); WFont * f = g->getResourceManager()->GetWFont(Fonts::MAIN_FONT); int i = 0; char buffer[512]; list<AIStat *>::iterator it; for (it = stats.begin(); it != stats.end(); ++it) { if (i > 10) break; AIStat * stat = *it; if (stat->value > 0) { MTGCard * card = MTGCollection()->getCardById(stat->source); if (card) { sprintf(buffer, "%s %i", card->data->getName().c_str(), stat->value); f->DrawString(buffer, x0 + 5, 10 + 16 * (float) i); i++; } } } }