// 指定された矩形領域を塗りつぶす void CMglImage::Paint( RECT* rect, D3DCOLOR color ) { CreateCheck(); // Createチェック if ( m_bRenderTarget == TRUE ) { // 現在のレンダーを保持(勝手に書き換えちゃマズいからなw) IDirect3DSurface8* bkupRender; d3d->GetRenderTarget( &bkupRender ); SetRender(); //d3d->Clear( 0, NULL, D3DCLEAR_TARGET, color, 1.0f, 0 ); // |D3DCLEAR_ZBUFFER m_myudg->Paint( rect, color ); // |D3DCLEAR_ZBUFFER // レンダーを元に戻す MyuAssert( d3d->SetRenderTarget( bkupRender, NULL ), D3D_OK, //m_myudg->lpZbuffer "CMglImage::Clear() レンダーを戻すのに失敗" ); } else { // 別にクリアされたサーフェスを作成してそこからコピー、と言う面倒な処理(´Д`) CMglImage workSurface; workSurface.Init( m_myudg ); workSurface.Create(); // レンダリング先はTRUEにしないと無限再帰してしまう workSurface.Paint( rect, color ); CopyRectToThis( &workSurface ); } }
void CMglTexture::Clear__( D3DCOLOR color ) { CreateCheck(); // Createチェック LockedCheck(); if ( m_bRenderTarget == TRUE ) { // 現在のレンダーを保持(勝手に書き換えちゃマズいからなw) _MGL_IDirect3DSurface* bkupRender; #if _MGL_DXVER == 9 d3d->GetRenderTarget( 0, &bkupRender ); #else d3d->GetRenderTarget( &bkupRender ); #endif SetRender(); //d3d->Clear( 0, NULL, D3DCLEAR_TARGET, color, 1.0f, 0 ); // |D3DCLEAR_ZBUFFER m_myudg->Clear( color ); // |D3DCLEAR_ZBUFFER // D3DCOLOR_FULLALPHA // レンダーを元に戻す #if _MGL_DXVER == 9 MyuAssert( d3d->SetRenderTarget( 0, bkupRender ), D3D_OK, #else MyuAssert( d3d->SetRenderTarget( bkupRender, NULL ), D3D_OK, //m_myudg->lpZbuffer #endif "CMglTexture::Clear() レンダーを戻すのに失敗" ); }
// 絵画(CopyRectを使用) void CMglImage::CopyRectToOther( CMglImage* destSurface, RECT *srcRect, int x, int y ) { CreateCheck(); // Createチェック //if ( m_pSurface == NULL ) // MyuThrow( 0, "CMglImage::CopyRectToOther() m_pSurfaceが取得されていません。"); // srcRectにNULLを指定された場合はフルで絵画 D3DXLoadSurfaceFromSurface( destSurface->GetSurfacePtr(), NULL, NULL, m_pSurface, NULL, NULL, D3DX_FILTER_POINT, 0 ); /* RECT _srcRect; if ( srcRect == NULL ) { srcRect = &_srcRect; _Rect( m_nBmpSizeX, m_nBmpSizeY, srcRect ); } POINT destPoint; destPoint.x = x; destPoint.y = y; // そのうちクリッピングさぽーとさせるぅ if ( m_pSurface == destSurface->GetSurfacePtr() ) MyuThrow(0,"CMglImage::CopyRectToOther() destSurfaceに自分自身のサーフェスを指定することは出来ません。"); //if (FAILED(d3d->CopyRects(m_pSurface, srcRect, 1, destSurface, &destPoint))) { //MyuAssert( d3d->CopyRects(m_pSurface, NULL, 1, destSurface, NULL), D3D_OK, MyuAssert( d3d->CopyRects(m_pSurface, srcRect, 1, destSurface->GetSurfacePtr(), &destPoint), D3D_OK, "CMglImage::CopyRectToOther() CopyRect()に失敗" ); */ }
// 絵画先をこのサーフェスに設定する void CMglImage::SetRender() { CreateCheck(); // Createチェック MyuAssert( d3d->SetRenderTarget( m_pSurface, NULL ), D3D_OK, //m_myudg->lpZbuffer "CMglImage::SetRender() SetRenderTarget()に失敗" ); }
void CMgl3dSquare::SetTexture(int no, CMglD3dTexture &tex) { InitCheck(); CreateCheck(); m_texList[no] = &tex; //MGLTUTV tutv = m_tex->GetTuTv(); SetTuTv(no, tex.GetTuTv()); }
// DrawPrimitiveUP void CMglTexture::DrawPrimitiveUP( D3DPRIMITIVETYPE primitiveType, UINT nPrimitiveCount, const void *pVertexStreamZeroData, UINT nVertexStreamZeroStride ) { CreateCheck(); // Createチェック LockedCheck(); // 絵画 MyuAssert( d3d->DrawPrimitiveUP( primitiveType, nPrimitiveCount, pVertexStreamZeroData, nVertexStreamZeroStride ), D3D_OK, "CMglImage::TextureDrawPrimitive() DrawPrimitiveUP()に失敗" ); }
void CMglImage::TextureDrawPrimitive() { CreateCheck(); // Createチェック // テクスチャの設定 MyuAssert( d3d->SetTexture(0, m_pTexture), D3D_OK, "CMglImage::TextureDrawPrimitive() SetTexture()に失敗" ); // 絵画 MyuAssert( d3d->DrawPrimitiveUP( D3DPT_TRIANGLEFAN, 2, m_vertices, sizeof(MYU_VERTEX) ), D3D_OK, "CMglImage::TextureDrawPrimitive() DrawPrimitiveUP()に失敗" ); }
// 絵画先をこのサーフェスに設定する void CMglTexture::SetRender() { CreateCheck(); // Createチェック LockedCheck(); #if _MGL_DXVER == 9 MyuAssert( d3d->SetRenderTarget( 0, m_pSurface ), D3D_OK, #else MyuAssert( d3d->SetRenderTarget( m_pSurface, NULL ), D3D_OK, //m_myudg->lpZbuffer #endif "CMglTexture::SetRender() SetRenderTarget()に失敗" ); }
bool CUpdateUtil::GetSpecialDirectory(int nFolder, CString &strPath) { CString strFullPath; LPTSTR lpszSystemInfo; // pointer to system information string TCHAR tchBuffer[MAX_PATH] = { 0, }; // buffer for expanded string lpszSystemInfo = tchBuffer; int nSize; switch (nFolder) { case UPDATE_SYSTEM: nSize = ::GetSystemDirectory(lpszSystemInfo, MAX_PATH+1); break; case UPDATE_WINDOWS: nSize = ::GetWindowsDirectory(lpszSystemInfo, MAX_PATH+1); break; case UPDATE_PROGRAM_FILES: nSize = ::GetWindowsDirectory(lpszSystemInfo, MAX_PATH+1); break; case UPDATE_TEMP: TCHAR szTempFilePath[MAX_PATH] = { 0, }; //TCHAR szTempFileLongPath[MAX_PATH+1]; DWORD dwPathLength; dwPathLength = ::GetTempPath(MAX_PATH, szTempFilePath); // ::GetFullPathName(szTempFilePath, sizeof(szTempFileLongPath)/sizeof(szTempFileLongPath[0]), szTempFileLongPath, NULL); // ::GetLongPathName((LPCTSTR)szTempFilePath, (LPTSTR)szTempFileLongPath, sizeof(szTempFileLongPath)/sizeof(szTempFileLongPath[0])); GetLongPathNameEx(szTempFilePath, strFullPath); strcpy(szTempFilePath, strFullPath); lpszSystemInfo = szTempFilePath; break; } if(nSize == 0) { return false; } strPath = (LPCTSTR)lpszSystemInfo; if(nFolder == UPDATE_PROGRAM_FILES) { CString strTmp = strPath.Left( strPath.Find( '\\' ) ); // C:\ // strTmp += "\\Program Files"; if(!CreateCheck(strTmp)) { return false; } strPath = strTmp; } return true; }
// 描画 void CMgl3dSquare::Draw() { InitCheck(); CreateCheck(); /*if ( m_tex != NULL ) m_tex->SetD3dStageTexture();*/ for(int i=0; i<MGL_TEXTURE_STAGE_MAX; i++ ){ if ( m_texList[i] != NULL ){ m_texList[i]->SetD3dStageTexture(i); m_tss.Sets(i); } } CMglVertexManagerX::Draw(D3DPT_TRIANGLESTRIP); }
BOOL CUpdateUtil::CheckFolder(CString strPath) { CString strFindPath = strPath; CString strTmp; BOOL bSuccess = TRUE; int nFind = 3; int nEnd = strPath.ReverseFind('\\'); while(nFind <= nEnd && bSuccess) { nFind = strPath.Find('\\', nFind); strTmp = strFindPath.Left( nFind ); bSuccess = CreateCheck(strTmp); nFind++; } if(!bSuccess) return FALSE; return TRUE; }
// 描画(頂点数不定) void CMglTexture::Draw( MYU_VERTEX *pMyuVertex, UINT nPrimitiveCount, BOOL bVertexRevise ) { CreateCheck(); // Createチェック LockedCheck(); // 頂点補正 if ( bVertexRevise ) //MglMoveVertexs1( (MYU_VERTEX1*)pMyuVertex, TEXTURE_FLOAT_ADJ, TEXTURE_FLOAT_ADJ, 2+nPrimitiveCount ); MglMoveVertexs( pMyuVertex, TEXTURE_FLOAT_ADJ, TEXTURE_FLOAT_ADJ, TEXTURE_FLOAT_ADJ, 2+nPrimitiveCount ); /* // テクスチャの設定 MyuAssert( d3d->SetTexture(0, m_pTexture), D3D_OK, "CMglImage::TextureDrawPrimitive() SetTexture()に失敗" ); */ SetD3dStageTexture(); DrawPrimitiveUP( D3DPT_TRIANGLEFAN, nPrimitiveCount, pMyuVertex, sizeof(MYU_VERTEX) ); // 絵画 /*MyuAssert( d3d->DrawPrimitiveUP( D3DPT_TRIANGLEFAN, nPrimitiveCount, pMyuVertex, sizeof(MYU_VERTEX) ), D3D_OK, "CMglImage::TextureDrawPrimitive() DrawPrimitiveUP()に失敗" );*/ }
BOOL CHttpFileDownload::CheckFolder(CString strPath) { CString strFindPath = strPath; CString strTmp; BOOL bSuccess = TRUE; int nFind = 3; int nEnd = strPath.ReverseFind('\\'); HTTP_CANCEL(); while(nFind <= nEnd && bSuccess) { HTTP_CANCEL(); nFind = strPath.Find('\\', nFind); strTmp = strFindPath.Left( nFind ); bSuccess = CreateCheck(strTmp); nFind++; } if(!bSuccess) return FALSE; return TRUE; /* if(_chdir((LPCSTR)(LPCTSTR)strPath) == 0) return TRUE; else{ if(_mkdir((LPCSTR)(LPCTSTR)strPath) == 0) return TRUE; else{ // ErrMsgBox("Failed to Create Download Directory!"); return FALSE; } } */ }
char Proc_Display(char *NC) { CHECK_BOX Disp_Check[3] ; char key,Event,temp[1],active_digit,rx_char ; char index,down_id=0xFF,i,flicker = 0 ; union { unsigned int pos[2] ; char byte[4] ; }TPoint ; Color = Black ; Color_BK = 0xEF9F ; Clear_LCD(Color_BK) ; DrawRectFill(0,0,240,25,Blue) ; DrawRectFill(0,295,240,25,Blue) ; ShowIcon24(217,0,24,23,ICON_CLOSE) ; Color = 0xFFFF ; Color_BK = Blue ; PutStringCN16(4,4,"数码管控制") ; PutStringCN16(200,300,"退出") ; Color = Black ; Color_BK = WINDOW_BK_COLOR ; DrawFrame(3,80,232,48) ; DrawRectFill(4,81,232,46,Black) ; DrawPanel(6,160,228,72,"") ; CreateButton(1,"<",15, 175,45,20) ; CreateButton(2,">",70, 175,45,20) ; CreateButton(3,"+",125,175,45,20) ; CreateButton(4,"-",180,175,45,20) ; for(active_digit=1;active_digit<9;active_digit++) { temp[0] = Find_Data(LED[active_digit-1].data) ; if(!(LED[active_digit-1].mode&DIGIT_OFF)) Draw7Seg2436(temp[0],(active_digit-1)*29+5, 87,Red,Black ) ; if(!(LED[active_digit-1].data&SEGDP)) DrawRectFill((active_digit-1)*29+30,120, 3,3,Red) ; } for(active_digit=1;active_digit<9;active_digit++) { DrawFrame((active_digit-1)*29+14,139,11,11) ; DrawRectFill((active_digit-1)*29+15,140,10,10,Dark_Grey); } DrawRectFill(15,140,10,10,Green) ; active_digit = 1 ; CreateCheck(&Disp_Check[0],25 ,210,12,12,"闪烁") ; CreateCheck(&Disp_Check[1],90 ,210,12,12,"消隐") ; CreateCheck(&Disp_Check[2],150,210,12,12,"小数点") ; if(LED[active_digit-1].mode&DIGIT_FLICKER) CheckCheck(&Disp_Check[0]) ; if(LED[active_digit-1].mode&DIGIT_OFF) CheckCheck(&Disp_Check[1]) ; if(!(LED[active_digit-1].data&SEGDP)) CheckCheck(&Disp_Check[2]) ; temp[0] = 0x00 ; for(;;) { OS_WaitMail(&MBKeyTP) ; OS_GetMail1(&MBKeyTP, &Event) ; OS_GetMail1(&MBKeyTP, &key) ; OS_GetMail1(&MBKeyTP, &rx_char) ; OS_GetMail1(&MBKeyTP, &TPoint.byte[0]) ; OS_GetMail1(&MBKeyTP, &TPoint.byte[1]) ; OS_GetMail1(&MBKeyTP, &TPoint.byte[2]) ; OS_GetMail1(&MBKeyTP, &TPoint.byte[3]) ; if(Event&EVENT_TP_TOUCHED) { index = InScopeButton(TPoint.pos[0], TPoint.pos[1] ) ; if(index==0xFF) { OS_Use(&SemaLCD) ; SetButtonUp(down_id) ; down_id = index ; OS_Unuse(&SemaLCD) ; } else if(index!=down_id) { OS_Use(&SemaLCD) ; SetButtonUp(down_id) ; down_id = index ; SetButtonDown(down_id) ; OS_Unuse(&SemaLCD) ; } } else if(Event&EVENT_TP_PRESSED) { index = InScopeButton(TPoint.pos[0], TPoint.pos[1] ) ; OS_Use(&SemaLCD) ; SetButtonUp(index) ; down_id = 0xFF ; OS_Unuse(&SemaLCD) ; switch(index) { case 1: if(active_digit>1) { active_digit-- ; DrawRectFill((active_digit)*29+15,140,10,10,Dark_Grey); DrawRectFill((active_digit-1)*29+15,140,10,10,Green); if(LED[active_digit-1].mode&DIGIT_FLICKER) CheckCheck(&Disp_Check[0]) ; else unCheckCheck(&Disp_Check[0]) ; if(LED[active_digit-1].mode&DIGIT_OFF) CheckCheck(&Disp_Check[1]) ; else unCheckCheck(&Disp_Check[1]) ; if(!(LED[active_digit-1].data&SEGDP)) CheckCheck(&Disp_Check[2]) ; else unCheckCheck(&Disp_Check[2]) ; } break ; case 2: if(active_digit<8) { active_digit++ ; DrawRectFill((active_digit-2)*29+15,140,10,10,Dark_Grey); DrawRectFill((active_digit-1)*29+15,140,10,10,Green); if(LED[active_digit-1].mode&DIGIT_FLICKER) CheckCheck(&Disp_Check[0]) ; else unCheckCheck(&Disp_Check[0]) ; if(LED[active_digit-1].mode&DIGIT_OFF) CheckCheck(&Disp_Check[1]) ; else unCheckCheck(&Disp_Check[1]) ; if(!(LED[active_digit-1].data&SEGDP)) CheckCheck(&Disp_Check[2]) ; else unCheckCheck(&Disp_Check[2]) ; } break ; case 3: temp[0] = Find_Data(LED[active_digit-1].data); if(++temp[0]>9) temp[0] = 0 ; LED[active_digit-1].data |= 0x7F ; LED[active_digit-1].data &= SMG[temp[0]] ; Draw7Seg2436(temp[0],(active_digit-1)*29+5, 87,Red,Black ) ; break ; case 4: temp[0] = Find_Data(LED[active_digit-1].data); if(--temp[0]>250) temp[0] = 9 ; LED[active_digit-1].data |= 0x7F ; LED[active_digit-1].data &= SMG[temp[0]] ; Draw7Seg2436(temp[0],(active_digit-1)*29+5, 87,Red,Black ) ; break ; } for(i=0;i<3;i++) { if(!InCheckScope(TPoint.pos[0], TPoint.pos[1], &Disp_Check[i])) { if(Disp_Check[i].status&CHECK_CHECKED) { unCheckCheck(&Disp_Check[i]) ; switch(i) { case 0: LED_Flicker_Digit(active_digit,0) ; temp[0] = Find_Data(LED[active_digit-1].data) ; if(!(LED[active_digit-1].mode&DIGIT_OFF)) { Draw7Seg2436(temp[0],(active_digit-1)*29+5, 87,Red,Black ) ; if(!(LED[active_digit-1].data&SEGDP)) DrawRectFill((active_digit-1)*29+30,120,3,3,Red) ; } break ; case 1: temp[0] = Find_Data(LED[active_digit-1].data) ; Draw7Seg2436(temp[0],(active_digit-1)*29+5, 87,Red,Black ) ; if(!(LED[active_digit-1].data&SEGDP)) DrawRectFill((active_digit-1)*29+30,120,3,3,Red) ; LED[active_digit-1].mode &=~DIGIT_OFF ; break ; case 2: LED[active_digit-1].data |= SEGDP ; DrawRectFill((active_digit-1)*29+30,120, 3,3,Black) ; break ; } } else { CheckCheck(&Disp_Check[i]) ; switch(i) { case 0: LED_Flicker_Digit(active_digit,1) ; break ; case 1: temp[0] = Find_Data(LED[active_digit-1].data) ; Draw7Seg2436(temp[0],(active_digit-1)*29+5, 87,Black,Black ) ; DrawRectFill((active_digit-1)*29+30,120, 3,3,Black) ; LED[active_digit-1].mode |= DIGIT_OFF ; break ; case 2: LED[active_digit-1].data &=~SEGDP ; DrawRectFill((active_digit-1)*29+30,120, 3,3,Red) ; break ; } } break ; } } if( (TPoint.pos[0]<230&&TPoint.pos[0]>200&&TPoint.pos[1]>295) ||(TPoint.pos[0]>220&&TPoint.pos[1]<20 )) break ; } else if(Event&EVENT_FLICKER) { if(flicker++>0) { for(i=1;i<9;i++) { temp[0] = Find_Data(LED[i-1].data) ; if( !(LED[i-1].mode&DIGIT_OFF) && (LED[i-1].mode&DIGIT_FLICKER)) { Draw7Seg2436(temp[0],(i-1)*29+5, 87,Red,Black ) ; if(!(LED[i-1].data&SEGDP)) DrawRectFill((i-1)*29+30,120,3,3,Red) ; } } flicker = 0x00 ; } else { for(i=1;i<9;i++) { temp[0] = Find_Data(LED[i-1].data) ; if( !(LED[i-1].mode&DIGIT_OFF) && (LED[i-1].mode&DIGIT_FLICKER)) { Draw7Seg2436(temp[0],(i-1)*29+5, 87,Black,Black ) ; if(!(LED[i-1].data&SEGDP)) DrawRectFill((i-1)*29+30,120,3,3,Black) ; } } } } } DeleteButton(1) ; DeleteButton(2) ; DeleteButton(3) ; DeleteButton(4) ; return 0x00 ; }
FontWindow::FontWindow(int a,int b,int c,char *name,char *style,BRect rct):BWindow(rct,GetMessage(msg_font),B_TITLED_WINDOW_LOOK,B_MODAL_APP_WINDOW_FEEL,B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_ASYNCHRONOUS_CONTROLS) { BRect rect(Bounds()); BView *xt; BMenu *menu; int nb; bool size = false; char tmp[512]; sprintf(&tmp[0],"%s, %s",name,style); this->AddShortcut('W',0,new BMessage(B_QUIT_REQUESTED)); xt = CreateView(rect); menu = CreateMenu(this,&choice_font[0],5000,0); b0 = new BMenuField(MyRect(10,10,260,25),"","Font",menu); SetChoiceInMenu(b0->Menu(),a,true); SetDivider(b0,16); menu = CreateMenu(this); nb = AddFontMenu(&tmp[0],menu,6000,this); b1 = new BMenuField(MyRect(10,35,260,25),"","Style",menu); SetChoiceInMenu(b1->Menu(),nb,true); SetDivider(b1,16); menu = CreateMenu(this); for(int32 i = 0; i < 9; i++) { if (!size && b == kFontSizeSet[i]) { b = i; size = true; } sprintf(&buf[0],"%d",kFontSizeSet[i]); AddItemInMenu(menu,&buf[0],7000); } b2 = new BMenuField(MyRect(10,60,260,25),"","Size",menu); if (size) { SetChoiceInMenu(b2->Menu(),b,true); } SetDivider(b2,16); b3 = CreateCheck(MyRect(10,85,100,25),"Antiliasing",8000,false); b3->SetValue(c); xt->AddChild(b0); xt->AddChild(b1); xt->AddChild(b2); xt->AddChild(b3); AddChild(xt); }
void cMenu::InitMenu() { //Create Tabs. CreateTab("Aim"); CreateTab("Gun"); CreateTab("ESP"); CreateTab("Misc"); CreateTab("Chat"); //Create Check Boxes. CreateCheck("Aim", "Aimbot", &M_AimEnable); CreateCheck("Aim", "Silent Aim", &M_Aim_Silent); CreateCheck("Aim", "Teamkill", &M_Aim_TeamKill); CreateCheck("Aim", "Kill Players", &M_Aim_KillPlayer); CreateCheck("Aim", "Kill NPCs", &M_Aim_KillNPC); CreateCheck("Aim", "Triggerbot", &M_TriggerBot); CreateCheck("Gun", "Auto Pistol", &M_AutoPistol); CreateCheck("Gun", "Auto Reload", &M_AutoReload); CreateCheck("Gun", "No Spread", &M_NoSpread); CreateCheck("ESP", "Enable", &M_ESP); CreateCheck("ESP", "Name", &M_ESP_Name); CreateCheck("ESP", "Health", &M_ESP_Health); CreateCheck("ESP", "Health Bar", &M_ESP_HealthBar); CreateCheck("ESP", "3D Boxes", &M_ESP_3D); CreateCheck("ESP", "NPCs", &M_ESP_NPCs); CreateCheck("ESP", "Players", &M_ESP_Players); CreateCheck("ESP", "Weapons", &M_ESP_Weapons); CreateCheck("ESP", "View ESP", &M_ESP_ViewESP); CreateCheck("Misc", "Name Changer", &M_NameChanger); CreateCheck("Misc", "Bunny Hop", &M_Bhop); CreateCheck("Misc", "Freeze Hack", &M_FreezeHack); CreateCheck("Misc", "Fake Lag", &M_FakeLag); CreateCheck("Misc", "Fast Join", &M_FastJoin); CreateCheck("Misc", "Disconnect Spam", &M_DisconnectSpam); CreateCheck("Misc", "Speedhake", &M_Speed); CreateCheck("Chat", "Voice Imitator", &M_VoiceChatImitator ); CreateCheck("Chat", "Text Imitator", &M_TextChatImitator ); CreateCheck("Chat", "Team-Text", &M_TextChatTeam ); CreateCheck("Chat", "Chat Spam", &M_ChatSpam ); CreateCheck("Chat", "Voice Spam", &M_VoiceChatSpam ); //Create Sliders CreateSlider("Misc", "Speed", 100, &S_Speed); CreateSlider("Misc", "Crosshair", 5, &S_CrossHair); //Create Text Boxes CreateTextBox("ESP", "Custom ESP", &T_CustomESP); CreateTextBox("Chat", "Chat Spam", &T_ChatSpam); //M_ClientSpectate }
// Texture(DrawPrimitiveUP)で絵画 void CMglImage::TextureDraw( float x, float y, RECT* srcRect, float fScaleX, float fScaleY, float fRotationCenterX, float fRotationCenterY, float fAngle, VERTEX_COLORS* vertexColors, DWORD dwAlphaOption ) { CreateCheck(); // Createチェック // srcRectを考慮したBMPサイズ int nBmpSrcX = m_nBmpSizeX; int nBmpSrcY = m_nBmpSizeY; // 転送元もどきの設定 if ( srcRect == NULL ) { m_vertices[VERTEXNO_LT].tu = m_vertices[VERTEXNO_LB].tu = 0.0f; m_vertices[VERTEXNO_LT].tv = m_vertices[VERTEXNO_RT].tv = 0.0f; //m_vertices[VERTEXNO_RB].tu = m_vertices[VERTEXNO_RT].tu = 1.0f; //m_vertices[VERTEXNO_RB].tv = m_vertices[VERTEXNO_LB].tv = 1.0f; m_vertices[VERTEXNO_RT].tu = m_vertices[VERTEXNO_RB].tu = fRealTexTu; m_vertices[VERTEXNO_LB].tv = m_vertices[VERTEXNO_RB].tv = fRealTexTv; } else { float fLeftTu = ((float)srcRect->left / m_nBmpSizeX) * fRealTexTu; float fRightTu = ((float)srcRect->right / m_nBmpSizeX) * fRealTexTu; float fTopTv = ((float)srcRect->top / m_nBmpSizeY) * fRealTexTv; float fBottomTv = ((float)srcRect->bottom / m_nBmpSizeY) * fRealTexTv; /* m_vertices[VERTEXNO_LT].tu = m_vertices[VERTEXNO_LB].tu = fLeftTu; m_vertices[VERTEXNO_RT].tu = m_vertices[VERTEXNO_RB].tu = fRightTu; m_vertices[VERTEXNO_LT].tv = m_vertices[VERTEXNO_RT].tv = fTopTv; m_vertices[VERTEXNO_LB].tv = m_vertices[VERTEXNO_RB].tv = fBottomTv; */ m_vertices[VERTEXNO_LT].tu = m_vertices[VERTEXNO_LB].tu = fLeftTu; m_vertices[VERTEXNO_RT].tu = m_vertices[VERTEXNO_RB].tu = fRightTu; m_vertices[VERTEXNO_LT].tv = m_vertices[VERTEXNO_RT].tv = fTopTv; m_vertices[VERTEXNO_LB].tv = m_vertices[VERTEXNO_RB].tv = fBottomTv; nBmpSrcX = srcRect->right - srcRect->left; nBmpSrcY = srcRect->bottom - srcRect->top; } // 中心基点絵画機能 if ( m_bCenterDraw == TRUE ) { int nSizeX = srcRect->right - srcRect->left; int nSizeY = srcRect->bottom - srcRect->top; x -= (nSizeX/2) * fScaleX; y -= (nSizeY/2) * fScaleY; } // 絵画先位置、及び伸縮率の設定 m_vertices[VERTEXNO_LT].x = m_vertices[VERTEXNO_LB].x = x + X_ADJ; // 絵画先位置X m_vertices[VERTEXNO_LT].y = m_vertices[VERTEXNO_RT].y = y + Y_ADJ; // 絵画先位置Y m_vertices[VERTEXNO_RB].x = m_vertices[VERTEXNO_RT].x = x + X_ADJ + nBmpSrcX * fScaleX; // 伸縮率X m_vertices[VERTEXNO_RB].y = m_vertices[VERTEXNO_LB].y = y + Y_ADJ + nBmpSrcY * fScaleY; // 伸縮率Y // 色 m_vertices[VERTEXNO_LT].color = vertexColors->leftTop; m_vertices[VERTEXNO_RT].color = vertexColors->rightTop; m_vertices[VERTEXNO_LB].color = vertexColors->leftBottom; m_vertices[VERTEXNO_RB].color = vertexColors->rightBottom; // アルファオプション m_myudg->SetAlphaMode( dwAlphaOption ); // 絵画 TextureDrawPrimitive(); }
// 回転・スケーリング・アルファオプション付き絵画(スプライトを使用) void CMglImage::DrawEx( float fScaleX, float fScaleY, float fRotationCenterX, float fRotationCenterY, float fAngle, float x, float y, RECT *srcRect, D3DCOLOR color ) // float x, float y, RECT *srcRect, D3DCOLOR color, DWORD dwAlphaOption ) { CreateCheck(); // Createチェック // srcRectにNULLを指定された場合はフルで絵画 RECT _srcRect; if ( srcRect == NULL ) { srcRect = &_srcRect; _Rect( 0, 0, m_nBmpSizeX, m_nBmpSizeY, srcRect ); } // 中心基点絵画機能 if ( m_bCenterDraw == TRUE ) { int nSizeX = srcRect->right - srcRect->left; int nSizeY = srcRect->bottom - srcRect->top; x -= (nSizeX/2) * fScaleX; y -= (nSizeY/2) * fScaleY; } // x, yをD3DXVECTOR2構造体に格納 D3DXVECTOR2 vctPos; vctPos.x = x; vctPos.y = y; // スケール D3DXVECTOR2 vctScale; vctScale.x = fScaleX; vctScale.y = fScaleY; // 回転の中心 D3DXVECTOR2 vctRtCenter; vctRtCenter.x = (srcRect->right - srcRect->left) * fRotationCenterX * fScaleX; vctRtCenter.y = (srcRect->bottom - srcRect->top) * fRotationCenterY * fScaleY; /* スプライトはアルファオプション効かないっぽい // アルファオプション DWORD dwAlphaOptionBkup=0; if ( dwAlphaOption != MGL_ALPHA_OPT_NOCHANGE ) { // 戻す時のためにバックアップを取っておく dwAlphaOptionBkup = m_myudg->GetAlphaMode(); m_myudg->SetAlphaMode( dwAlphaOption ); }*/ // 角度からRadianに。更に左回転になっているので右回転に float fRad = AngleToRad(-fAngle); // 絵画 MyuAssert( m_pSprite->Draw( m_pTexture, srcRect, &vctScale, &vctRtCenter, fRad, &vctPos, color ), D3D_OK, "CMglImage::Draw() m_pSprite->Draw()に失敗" ); /* スプライトはアルファオプション効かないっぽい // アルファオプションを元に戻す if ( dwAlphaOption != MGL_ALPHA_OPT_NOCHANGE ) { m_myudg->SetAlphaMode( dwAlphaOptionBkup ); }*/ }