//自由変形描画 void DrawImpl::modi(const Vector2& pos1, const Vector2& pos2, const Vector2& pos3, const Vector2& pos4, int GrHandle, int alpha, int blendMode){ SetDrawBlendMode(blendMode, alpha); DrawModiGraph( pos1.x + dx, pos1.y + dy, pos2.x + dx, pos2.y + dy, pos3.x + dx, pos3.y + dy, pos4.x + dx, pos4.y + dy, GrHandle, 1); }
void FrontendBossGauge::Draw() const { if (!target || !target->GetExist()) return; int hpw = 490 * target->GetHP() / target->GetHPMax(); DrawGraph(70, 40, Image::Instance()->Load("boss_gauge")->at(0), FALSE); DrawModiGraph(75, 46, 75 + hpw, 46, 75 + hpw, 46 + 24, 75, 46 + 24, Image::Instance()->Load("boss_meter")->at(0), FALSE); }
void FrontendPlayerGauge::Draw() const { const int x = 8, y = WINDOW_HEIGHT - 86; SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255); DrawGraph(x + 2, y + 2, Image::Instance()->Load("weapon_icon")->at(type), FALSE); BulletParam param = PlayerBullet::GetBulletParam(type); int alpha = 128; if (mp < param.cost) { //弾切れ SetDrawBlendMode(DX_BLENDMODE_ALPHA, 200); DrawGraph(x + 2, y + 2, Image::Instance()->Load("uicover")->at(1), TRUE); alpha = 32; } else if (fire%param.delay > 2) { //ディレイ SetDrawBlendMode(DX_BLENDMODE_ALPHA, 128); DrawGraph(x + 2, y + 2, Image::Instance()->Load("uicover")->at(1), TRUE); alpha = 32; } SetDrawBlendMode(DX_BLENDMODE_ADD, alpha); DrawGraph(x + 5, y + 60 - (stateCnt % 120) / 2, Image::Instance()->Load("uiline")->at(0), TRUE); SetDrawBlendMode(DX_BLENDMODE_ADD, 96); DrawGraph(x + 5, y + 5, Image::Instance()->Load("uicover")->at(0), TRUE); int hpw = (int)((float)hp / hpmax * HP_WIDTH); int mpw = (int)((float)mp / mpmax * MP_WIDTH); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255); DrawGraph(x, y, Image::Instance()->Load("player_gauge")->at(0), TRUE); DrawModiGraph(x + 88, y + 42, x + 88 + hpw, y + 42, x + 88 + hpw, y + 42 + HP_HEIGHT, x + 88, y + 42 + HP_HEIGHT, Image::Instance()->Load("hpmeter")->at(0), FALSE); DrawModiGraph(x + 85, y + 58, x + 85 + mpw, y + 58, x + 85 + mpw, y + 58 + MP_HEIGHT, x + 85, y + 58 + MP_HEIGHT, Image::Instance()->Load("mpmeter")->at(0), FALSE); DrawGraph(x + 9, y + 59, Image::Instance()->Load("weapon_name")->at(type), TRUE); }
int DrawExtendGraph(int x1,int y1,int x2,int y2,int gh,int trans) { if((x2 < x1 || y2 < y1) && !(x2 < x1 && y2 < y1))return DrawModiGraph(x1,y1,x2,y1,x2,y2,x1,y2,gh,trans);//X方向反転画像がうまく動作しないので(GU_SPRITESを使ったのが原因と思われる)強引に回避 DXPGRAPHICSHANDLE* gptr; GHANDLE2GPTR(gptr,gh) if(dxpGraphicsSetup2DTex(gptr->tex,trans) < 0)return -1; int sw = dxpPsm2SliceSize[gptr->tex->psm][0]; int sh = dxpPsm2SliceSize[gptr->tex->psm][1]; int u[2],v[2]; int count = ((gptr->u1 - gptr->u0 + sw - 1) / sw) * ((gptr->v1 - gptr->v0 + sh - 1) / sh); DXP_FVF_2DTEX *vtxbuf = (DXP_FVF_2DTEX*)dxpGuGetMemory(sizeof(DXP_FVF_2DTEX) * 2 * count); float uscale = (float)(x2 - x1) / (float)(gptr->u1 - gptr->u0); float vscale = (float)(y2 - y1) / (float)(gptr->v1 - gptr->v0); u[0] = gptr->u0; while(u[0] < gptr->u1) { u[1] = MIN(u[0] + sw,gptr->u1); v[0] = gptr->v0; while(v[0] < gptr->v1) { v[1] = MIN(v[0] + sh,gptr->v1); vtxbuf->u = u[0]; vtxbuf->v = v[0]; vtxbuf->x = x1 + uscale * (u[0] - gptr->u0); vtxbuf->y = y1 + vscale * (v[0] - gptr->v0); vtxbuf->z = dxpGraphicsData.z_2d; ++vtxbuf; vtxbuf->u = u[1]; vtxbuf->v = v[1]; vtxbuf->x = x1 + uscale * (u[1] - gptr->u0); vtxbuf->y = y1 + vscale * (v[1] - gptr->v0); vtxbuf->z = dxpGraphicsData.z_2d; ++vtxbuf; v[0] += sh; } u[0] += sw; } vtxbuf -= count * 2; sceGuDrawArray(GU_SPRITES,DXP_VTYPE_2DTEX | GU_TRANSFORM_2D,2 * count,NULL,vtxbuf); return 0; }
Scene* SceneStageSelect::Update() { MoveCursorY(STAGE_MAX); switch (state) { case 0: if (Bright::Instance()->ChangeBright(255, 60)) { state++; } case 1: if (input->Get(INPUT_Z) == 1) { Sound::Instance()->Play("決定"); state++; stateCnt = 0; } if (input->Get(INPUT_X) == 1) { Sound::Instance()->Play("戻る"); return new SceneTitle(backScroll); } break; case 2: if (Bright::Instance()->ChangeBright(0, 60)) { stage = std::make_shared<Stage>(); stage->SetStageMapNum(curY, 0); ClearDrawScreen(); state++; } break; case 3: Bright::Instance()->ChangeBright(255); DrawString(0, 0, "Now Loading ...", 0xffffff); ScreenFlip(); ClearDrawScreen(); stage->LoadBGM(); Bright::Instance()->ChangeBright(0); return new SceneStageStart(stage); } SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255); DrawModiGraph(0, 0, WINDOW_WIDTH, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0, WINDOW_HEIGHT, images[0], FALSE); int ofs = ++backScroll % 48; for (int x = 0; x < WINDOW_WIDTH / 48 + 1; ++x) { for (int y = 0; y < WINDOW_HEIGHT / 48 + 1; ++y) { DrawGraph(x * 48 - ofs, y * 48 - ofs, images[1], TRUE); } } switch (curY) { case 0: DrawGraph(435, 0, images[5], TRUE); break; case 1: DrawGraph(296, 0, images[6], TRUE); break; } DrawGraph(0, 55, images[2], TRUE); DrawGraph(40 + 17, 40 + 17, images[3], TRUE); DrawGraph(40, 40, images[4], TRUE); fonts[0]->DrawFontString(40 + 60, 40 + 27, 0xffffff, "ステージセレクト"); DrawGraph(410, 280, images[8], TRUE); switch (curY) { case 0: fonts[1]->DrawFontString(420, 290, 0xffffff, "操作説明です。"); break; case 1:fonts[1]->DrawFontString(420, 290, 0xffffff, "ハイスコア :"); fonts[1]->DrawFontString(420, 310, 0xffffff, " %d", Save::Instance()->GetHighScore(curY)); fonts[1]->DrawFontString(420, 330, 0xffffff, "クリアタイム :"); fonts[1]->DrawFontString(420, 350, 0xffffff, " %s", stage->GetTimerToString(Save::Instance()->GetClearTime(curY))); break; } DWORD col; int sx = 80, sy = 120, dist = 45; for (int i = 0; i < STAGE_MAX; i++) { if (i == 2) SetDrawBlendMode(DX_BLENDMODE_ALPHA, 128); DrawGraph(sx - 8, sy - 8 + dist*i, images[7], TRUE); col = (curY == i) ? 0xffffff : 0xaaaaaa; if (curFlag[i]) { fonts[0]->DrawFontString(sx, sy + i*dist, col, "STAGE%d", i); } else { fonts[0]->DrawFontString(sx, sy + i*dist, 0x666666, "---"); } } return this; }
Scene * SceneTitle::Update() { MoveCursorY(4); switch (state) { case 0: if (Bright::Instance()->ChangeBright(255, 30)) { ++state; } break; case 1: if (input->Get(INPUT_Z) == 1) { Sound::Instance()->Play("決定"); switch (curY) { case 0: // はじめから Save::Instance()->LoadDefaultData(); return new SceneStageSelect(backScroll); case 1: // つづきから Save::Instance()->LoadSaveData(); return new SceneStageSelect(backScroll); case 2: // 設定 return nullptr; //curX = m_cfg.GetWinFlag(); //return OPTION; case 3: // 終了 return nullptr; } } break; } SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255); DrawModiGraph(0, 0, WINDOW_WIDTH, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0, WINDOW_HEIGHT, images[0], FALSE); int ofs = ++backScroll % 48; for (int x = 0; x < WINDOW_WIDTH / 48 + 1; ++x) { for (int y = 0; y < WINDOW_HEIGHT / 48 + 1; ++y) { DrawGraph(x * 48 - ofs, y * 48 - ofs, images[1], TRUE); } } DrawGraph(0, 0, images[3], TRUE); DrawGraph(120, 40, images[2], TRUE); const char* menu_name[] = { { "はじめから" }, { "つづきから" }, { "設定" }, { "終了" }, }; DWORD col; int sx = 40, sy = 190, dist = 60; for (int i = 0; i < 4; ++i) { DrawGraph(sx + 17, sy + 17 + dist*i, images[4], TRUE); DrawGraph(sx, sy + dist*i, images[5], TRUE); col = (curY == i) ? 0xffffff : 0xaaaaaa; if (!curFlag[i]) col = 0x777777; fonts[0]->DrawFontString(sx + 60, sy + 27 + dist*i, col, menu_name[i]); } return this; }