////////////////////////////////////////// //Render ///////////////////////////////////////// void CSceneManager::Render() { m_pCamera->SetTransform(); m_pBG->Render(0,0); //debug//////////////// static bool show = false; if(m_pHge->Input_KeyDown(HGEK_M)) show = !show; if(show) { for(int i = 0;i < m_pMap->m_row;i ++) { for(int j = 0;j < m_pMap->m_col;j ++) { if(!(m_pMap->m_dynamicMap)[i*m_pMap->m_col+j]) m_pRs->GetSprite("Tile")->Render((float)j*m_pMap->m_tileWidth, (float)i*m_pMap->m_tileHeight); } } } ////////////////////// switch(m_scene) { case ON_SELECT: m_pSltSpr->RenderEx(SCREEN_WIDTH/2.0f, SCREEN_HEIGHT/2.0f + m_pSltSpr->GetHeight()*2, 0.f,2.0f,2.0f); break; case GAME_SCENE: for(OBJ_ITR itr = m_objs.begin();itr != m_objs.end();itr ++) { (*itr)->Render(); } m_pSelectSqure->Render(); break; } m_pCamera->EndTransform(); m_pGUI->Render(); if(m_alpha != 0) { m_pMask->SetColor(ARGB(m_alpha, 0x00, 0x00, 0x00)); m_pMask->Render(0,0); } m_pRs->GetFont("MoneyFont")->printf(5, 100, HGETEXT_LEFT, "FPS:%d\nmouseX:%.0f mouseY:%.0f", m_pHge->Timer_GetFPS(),GetMousePoint().x,GetMousePoint().y); }
//途中経過表示 //int&,Parameters&,bool&はBG,numbers,words,Parameters,next,endの順 //BG 背景画像のハンドル //numbers 数字画像のハンドル //words 文字画像のハンドル //Parameters ゲームパラメーター //next 次の年に進ませるフラグ //end ゲーム終了フラグ void Display::result(int& BG, int& numbers, int& words, Parameters& object, bool& next, bool& end){ Mouse mouse; GetMousePoint(&mouse.x, &mouse.y); DrawGraph(0, 0, BG, true); dispNum(200, 200, 18, 37, 0, 0, year, 0, numbers);//x年目が終わりました if (year > 9){ DrawRectGraph(228 + 18, 200, 0, 100, 396, 37, words, true, false); } else DrawRectGraph(228, 200, 0, 100, 396, 37, words, true, false); DrawRectGraph(200, 300, 0, 150, 540, 37, words, true, false);//今年はこんぐらい稼げました if (Mouse_Sq(200, 400, 288, 37, mouse)){//次の年へ進む SetDrawBright(255, 0, 0); if (GetMouseInput_Once(Mouse_Buttons::Left)){ next = true; } } else SetDrawBright(255, 255, 255); DrawRectGraph(200, 400, 0, 200, 288, 37, words, true, false); if (Mouse_Sq(200, 500, 324, 37, mouse)){//一旦きゅ〜け〜 SetDrawBright(255, 0, 0); if (GetMouseInput_Once(Mouse_Buttons::Left)){ end = true; } } else SetDrawBright(255, 255, 255); DrawRectGraph(200, 500, 0, 250, 324, 37, words, true, false); SetDrawBright(255, 255, 255);//描画する画像の色光度を再設定 }
bool MyInput::UpdateMouse(){ int tmpMouse = GetMouseInput(); //マウスの入力状態 int tmpMouseX, tmpMouseY; //マウスの座標 GetMousePoint(&tmpMouseX, &tmpMouseY); //マウスの座標を取得 mousePoint = Pos(tmpMouseX, tmpMouseY); for (int i = 0; i < MouseButNum; i++){ if (tmpMouse & MouseMasks[i]){ //ボタンが押されていれば mouseReleasedPrevCnt[i] += mouseReleasedCnt[i]; mouseReleasedCnt[i] = 0; ++mousePressedCnt[i]; if (mousePressedCnt[i] == 1) { ++mousePressCnt[i]; if (mousePressCnt[i] > 2) { mousePressCnt[i] = 0; } } if (mouseReleasedPrevCnt[i] > InputInterval ) { mouseReleasedPrevCnt[i] = 0; mousePressCnt[i] = 0; } } else{ //ボタンが押されていなければ mousePressedCnt[i] = 0; ++mouseReleasedCnt[i]; mouseReleasedPrevCnt[i] = 0; } } mouseRot = GetMouseWheelRotVol(); //マウスホイールの回転量を取得 mouseRotSum += mouseRot; return true; }
void CWndCommand::OnDraw( C2DRender* p2DRender ) { CWndListBox::OnDraw( p2DRender ); if( ::GetLanguage() == LANG_KOR ) { CPoint pt(3,3); int nFontHeight = GetFontHeight() + 3; pt.y -= ( nFontHeight ) * m_wndScrollBar.GetScrollPos(); LPLISTITEM pListItem; CRect rectHittest; CPoint point; CRect rect = GetWindowRect(); CString string; for(int i = 0; i < m_listItemArray.GetSize(); i++) { pListItem = (LPLISTITEM)m_listItemArray.GetAt(i); point = GetMousePoint(); rectHittest.SetRect( 0, pt.y - 3 , 0 + rect.Width(), pt.y + nFontHeight - 3 ); if( rectHittest.PtInRect( point ) ) { TextCmdFunc* pTextCmdFunc = (TextCmdFunc*)pListItem->m_dwData; CPoint point2 = point; ClientToScreen( &point2 ); ClientToScreen( &rectHittest ); string += pTextCmdFunc->m_pszDesc; g_toolTip.PutToolTip( i + 1000, string, rectHittest, point2, 3 ); break; } pt.y += nFontHeight; } } }
void mouse(Graph graph[15]){ int pointX, pointY; static int i; static int clickFlg; static int graphClickFlg=-1;//-1:クリックされてない,0-14:画像をクリックした static int graphStatus[15] = { 0 }; //左クリックされたかどうか if ((GetMouseInput() & MOUSE_INPUT_LEFT) != 0 && !clickFlg){ GetMousePoint(&pointX, &pointY); clickFlg = 1; if (graphClickFlg >= 0){ graphStatus[graphClickFlg] = 2; graphClickFlg = -1; }else{ //当たり判定を以て画像の状態を変更する for (i = 0; i < 15; i++){ if (collision_rect(graph[i].x, graph[i].y, graph[i].width, graph[i].height, pointX, pointY)){ graphStatus[i] = 1; graphClickFlg = i; }else{ graphStatus[i] = 0; } } } }else if ((GetMouseInput() & MOUSE_INPUT_LEFT) == 0){ clickFlg = 0; }else{ } graph_click(graph,graphStatus); }
void InputMouse::Impl::UpdatePosition() { if( GetMousePoint( &m_x , &m_y ) == FunctionFailure ) { exit( DxLib_Failure ); } }
void suken::CMouse::Loop(){ GetMousePoint( &mouseX, &mouseY ); preMouseInput = mouseInput; if(IsLeft){ mouseInput = (bool)( GetMouseInput() & MOUSE_INPUT_LEFT ); }else{ mouseInput = (bool)( GetMouseInput() & MOUSE_INPUT_RIGHT ); } }
void CWndShopCtrl::OnDraw(C2DRender* p2DRender) { CPoint pt( 3, 3 ); CRect rect = GetClientRect(); for( int i = 0; i < MAX_CART; i++ ) { int x = i % 6; int y = i / 6; CItemBase* pItemBase = m_pItemElem[ i ]; if( pItemBase ) { if( ((CItemElem*)pItemBase)->IsFlag( CItemElem::expired ) ) pItemBase->GetTexture()->Render2( p2DRender, CPoint( x * 35, y * 35 ), D3DCOLOR_ARGB( 255, 255, 100, 100 ) ); else pItemBase->GetTexture()->Render( p2DRender, CPoint( x * 35, y * 35 ) ); CRect rectHittest = CRect( x * 35, y * 35 + 3, x * 35 + 35, y * 35 + 35 + 3); CPoint point = GetMousePoint(); if( rectHittest.PtInRect( point ) ) { CPoint point2 = point; ClientToScreen( &point2 ); ClientToScreen( &rectHittest ); g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest ); } CItemElem* pItemElem = (CItemElem*)pItemBase; if( pItemElem->GetProp()->dwPackMax > 1 ) { //short n = m_nBuy[i]; //if( IsUsingItem( pItemBase ) ) // n = pItemBase->GetExtra(); short m_nItemNum = pItemElem->m_nItemNum; if( pItemElem->GetExtra() > 0 ) m_nItemNum -= (short)pItemElem->GetExtra(); TCHAR szTemp[ 35 ]; _stprintf( szTemp, "%d", m_nItemNum ); //_stprintf( szTemp, "%d", n ); CD3DFont* pOldFont = p2DRender->GetFont();//adeilson p2DRender->SetFont( CWndBase::m_Theme.m_pFontWndNewTitle ); CSize size = m_p2DRender->m_pFont->GetTextExtent( szTemp ); m_p2DRender->TextOut( x * 35 + 35 - size.cx, y * 35 + 35 - size.cy, szTemp, 0xFF000000 ); m_p2DRender->TextOut( x * 35 + 34 - size.cx, y * 35 + 34 - size.cy, szTemp, 0xFF85FF8A ); p2DRender->SetFont( pOldFont ); //_stprintf( szTemp, "%d", n ); //CSize size = p2DRender->m_pFont->GetTextExtent( szTemp ); //p2DRender->TextOut( x * 35 + 35 - size.cx, y * 35 + 35 - size.cy, szTemp, 0xff1010ff ); } } } }
void CWndGuildMeritCtrl::OnDraw( C2DRender* p2DRender ) { if( m_pItemContainer.size() <= 0 ) return; CRect rect = GetClientRect(); int nWidth = rect.Width() / 32; int nHeight = rect.Height() / 32; // 스크롤바 관련 CPoint pt( 0, 0 ); nWidth = 6; int nPage = nHeight; int nRange = m_pItemContainer.size() / nWidth;// - nPage; if( m_pItemContainer.size() % nWidth ) nRange++; m_wndScrollBar.SetScrollRange( 0, nRange ); m_wndScrollBar.SetScrollPage( nPage ); pt.y = 0; pt.y += m_wndScrollBar.GetScrollPos() * nWidth; for( int i = pt.y; i < (int)( m_pItemContainer.size() ); i++ ) { int x = ( i - pt.x ) % 6; int y = ( i - pt.y ) / 6; CItemBase* pItemBase = m_pItemContainer[i]; if( pItemBase ) { pItemBase->GetTexture()->Render( p2DRender, CPoint( x * 32 + 13, y * 32 + 7 ) ); CRect rectHittest = CRect( x * 32 + 13, y * 32 + 7, x * 32 + 13 + 32, y * 32 + 32 + 7 ); CPoint point = GetMousePoint(); if( rectHittest.PtInRect( point ) ) { CPoint point2 = point; ClientToScreen( &point2 ); ClientToScreen( &rectHittest ); g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest, APP_VENDOR ); } if( i == m_nCurSel ) p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff ); CItemElem* pItemElem = (CItemElem*)pItemBase; if( pItemElem->GetProp()->dwPackMax > 1 ) { short nItemNum = pItemBase->GetExtra(); TCHAR szTemp[32]; _stprintf( szTemp, "%d", nItemNum ); CSize size = p2DRender->m_pFont->GetTextExtent( szTemp ); p2DRender->TextOut( x * 32 + 32 - size.cx + 17, y * 32 + 32 - size.cy + 10, szTemp, 0xff1010ff ); } } } }
// ---------------------------------------------------- // Mouse::CheckMouseEvent // ---------------------------------------------------- void Mouse::_CheckMouseEvent() { // マウスのX, Y座標を取得するための変数 int MouseX, MouseY; // ------------------------------------------------ // もしマウスが押されていて if(GetMouseInput() & MOUSE_INPUT_LEFT){ // 初めて押されてたなら if(_MousePushTimeLeft < 0){ // 0にリセット _MousePushTimeLeft = 0; } // インクリメントする _MousePushTimeLeft++; } // もしマウスが押されていなくて else{ // 初めて離されたなら if(_MousePushTimeLeft > 0){ // 0にリセット _MousePushTimeLeft = 0; } // デクリメントする _MousePushTimeLeft--; } // もしマウスが押されていて if(GetMouseInput() & MOUSE_INPUT_RIGHT){ // 初めて押されてたなら if(_MousePushTimeRight < 0){ // 0にリセット _MousePushTimeRight = 0; } // インクリメントする _MousePushTimeRight++; } // もしマウスが押されていなくて else{ // 初めて離されたなら if(_MousePushTimeRight > 0){ // 0にリセット _MousePushTimeRight = 0; } // デクリメントする _MousePushTimeRight--; } // 現在位置を取得 GetMousePoint( &MouseX, &MouseY ); // 現在の座標を保存 _MouseBeforeLoc = _MouseLocation; // 取得した結果を代入する _MouseLocation( MouseX, MouseY); // 終了 return; }
bool FallingObject::HitJudge() { MouseInput = GetMouseInput(); if(( MouseInput & MOUSE_INPUT_LEFT ) == 1 ){ GetMousePoint(&mousex, &mousey); if(sqrt(pow(((double)mousex-x), 2)+pow(((double)mousey-y), 2)) <= 30){ return true; }else{ return false; } } }
bool MusicApple::HitJudge() { MouseInput = GetMouseInput(); if(( MouseInput & MOUSE_INPUT_LEFT ) == 1 ){ GetMousePoint(&mousex, &mousey); if(sqrt(pow(((double)mousex-x), 2)+pow(((double)mousey-y), 2)) <= hit_area){ StopSoundMem(sound_h_demo); return true; }else{ return false; } } }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { SetOutApplicationLogValidFlag(FALSE);//Log.txtを生成しないように設定 ChangeWindowMode(TRUE);//非全画面にセット SetGraphMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32);//画面サイズ指定 if (DxLib_Init() == 1) { return -1; }//初期化に失敗時にエラーを吐かせて終了 SetDrawScreen(DX_SCREEN_BACK);//描画先を裏画面に fontHandle = CreateFontToHandle("Segoe UI", 20, 5, DX_FONTTYPE_ANTIALIASING_4X4);//フォントを読み込み std::vector<Enemy> vec; while (ProcessMessage() == 0) { ClearDrawScreen();//裏画面消す GetMousePoint(&mouseX, &mouseY); //マウス座標更新 keyUpdate();//(自作関数)キー更新 // Zキーが押されたらランダムな座標に敵を生成 if (keyState[KEY_INPUT_Z] == 1) { vec.emplace_back(Enemy(GetRand(SCREEN_WIDTH), GetRand(SCREEN_HEIGHT))); // 敵をインスタンス化 } // 画面外の敵を削除 auto iter = vec.begin(); while (iter != vec.end()) { if (iter->x < 0 || iter->x > SCREEN_WIDTH || iter->y < 0 || iter->y > SCREEN_HEIGHT) { //画面外に出ているか確認 iter = vec.erase(iter); } else { iter++; } } for (auto i = vec.begin(); i < vec.end(); i++) { i->update(); } for (auto i = vec.begin(); i < vec.end(); i++) { i->draw(); } DrawFormatStringToHandle(20, 20, GetColor(255, 255, 255), fontHandle, "Zキーで敵を生成 敵の数:%d", vec.size()); ScreenFlip();//裏画面を表画面にコピー } DxLib_End(); return 0; }
BOOL CWndNeuz::OnSetCursor( CWndBase* pWndBase, UINT nHitTest, UINT message ) { if( IsWndStyle( WBS_THICKFRAME ) && ( IsFullMax() == FALSE || m_nWinSize != WSIZE_MAX ) ) { if( m_bLButtonDown == FALSE ) { CPoint point = GetMousePoint(); ClientToScreen( &point ); CRect rectWindow = GetWindowRect( TRUE ); point -= rectWindow.TopLeft(); int nResizeDir = GetResizeDir( point ); if( nResizeDir ) { // 1 = top // 2 = bottom // 3 = left // 4 = right // 5 = topLeft // 6 = topRight // 7 = bottomLeft // 8 = bottomRigh; switch( nResizeDir ) { case 1: case 2: SetMouseCursor( CUR_RESIZE_VERT ); break; case 3: case 4: SetMouseCursor( CUR_RESIZE_HORI ); break; case 5: case 8: SetMouseCursor( CUR_RESIZE_HV1 ); break; case 6: case 7: SetMouseCursor( CUR_RESIZE_HV2 ); break; } } else CWndBase::OnSetCursor( pWndBase, nHitTest, message ); } } else CWndBase::OnSetCursor( pWndBase, nHitTest, message ); return TRUE; }
void MenuScreen::print() { int MouseX, MouseY; GetMousePoint(&MouseX, &MouseY); botan[4]->print(); botan[0]->print(); botan[2]->moveTo(0.3,120, 200); botan[2]->print(MouseX,MouseY); botan[5]->moveTo(1, 400, 200); botan[5]->print(); botan[1]->moveTo(1, 430, 200); botan[1]->print(); }
void Mouse::Update() { Mouse& ins = Instance(); int x, y; GetMousePoint(&x, &y); ins.m_position.x = x; ins.m_position.y = y; ins.m_scrollValue = GetMouseWheelRotVol(); ins.m_previousBuffer = ins.m_currentBuffer; ins.m_currentBuffer = GetMouseInput(); }
void CWndPiercing::OnDraw( C2DRender* p2DRender ) { for( int i=0; i<3; i++ ) { if( m_pItemElem[i] && m_pItemElem[i]->GetTexture() ) { m_pItemElem[i]->GetTexture()->Render( p2DRender, m_Rect[i].TopLeft(), 255 ); if( m_pItemElem[i]->m_nItemNum > 1 ) { TCHAR szTemp[32]; _stprintf( szTemp, "%d", m_pItemElem[i]->GetExtra() ); p2DRender->TextOut( m_Rect[i].right-11, m_Rect[i].bottom-11 , szTemp, 0xff1010ff ); } //* CRect hitrect = m_Rect[i]; CPoint point = GetMousePoint(); if( m_Rect[i].PtInRect( point ) ) { CPoint point2 = point; ClientToScreen( &point2 ); ClientToScreen( &hitrect ); g_WndMng.PutToolTip_Item( (CItemBase*)m_pItemElem[i], point2, &hitrect ); } /**/ } } CWndStatic* pWndFocusStatic = (CWndStatic*)GetDlgItem(WIDC_STATIC9); if( m_pItemElem[0] ) { int nCost = 0; ItemProp* pItemProp = m_pItemElem[0]->GetProp(); if( pItemProp ) #if __VER >= 12 // __EXT_PIERCING nCost = 100000; #else // __EXT_PIERCING nCost = pItemProp->dwItemRare * ( 200 + ( m_pItemElem[0]->GetPiercingSize()+1) * 200 ); #endif // __EXT_PIERCING char buff[10] = { 0 }; pWndFocusStatic->SetTitle( itoa( nCost, buff, 10 ) ); } else { pWndFocusStatic->SetTitle( "0" ); } }
void MusicApple::Draw() { GetMousePoint(&mousex, &mousey); if(sqrt(pow(((double)mousex-x), 2)+pow(((double)mousey-y), 2)) <= hit_area){ hit_area = 90; //DrawCircle(this->x, this->y, hit_area, this->color, true); DrawGraph(this->x-100, this->y-108, graphic_h_b, true); }else{ hit_area = 30; //DrawCircle(this->x, this->y, MUSICAPPLE_HIT_AREA, this->color, true); DrawGraph(this->x-34, this->y-37, graphic_h_s, true); } //DrawCircle(this->x, this->y, 30, this->color, true); }
void CommandButton::Judge(){ if( !(GetMouseInput() & MOUSE_INPUT_LEFT) ){ return; } int x; int y; GetMousePoint( &x , &y ); if ( x > Left && y > Top && x < Left+Width && y < Top + Height ){ if( Func != NULL ){ Func(); } else { Click(); } } }
void CWndRepairItemCtrl::OnDraw( C2DRender* p2DRender ) { if( NULL == m_pdwIdRepair ) return; CMover* pMover = CMover::GetActiveMover(); if( !pMover ) return; CRect rect = GetClientRect(); int nWidth = rect.Width() / 32; int nHeight = rect.Height() / 35; for( int i = 0; i < MAX_REPAIRINGITEM; i++ ) { int x = i % 5; int y = i / 5; if( m_pdwIdRepair[i] != NULL_ID ) { CItemElem* pItemElem = pMover->m_Inventory.GetAtId( m_pdwIdRepair[i] ); if( pItemElem ) { pItemElem->GetTexture()->Render( p2DRender, CPoint( x * 32 + 6, y * 32 + 10 ) ); CRect rectHittest = CRect( x * 32, y * 32 + 3, x * 32 + 32, y * 32 + 32 + 3 ); CPoint point = GetMousePoint(); if( rectHittest.PtInRect( point ) ) { CPoint point2 = point; ClientToScreen( &point2 ); ClientToScreen( &rectHittest ); g_WndMng.PutToolTip_Item( pItemElem, point2, &rectHittest, 276 ); // APP_REPAIR } if( i == m_nCurSel ) p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff ); } } } }
void CWndRegVend::OnLButtonUp( UINT nFlags, CPoint point ) { { CPoint point2 = GetMousePoint(); LPWNDCTRL lpWndCtrl = GetWndCtrl( WIDC_SELLNUM ); CRect rectCtrl = lpWndCtrl->rect; if( rectCtrl.PtInRect( point2 ) ) { m_dwFocus = 0; return; } lpWndCtrl = GetWndCtrl(WIDC_SELLPRI); rectCtrl = lpWndCtrl->rect; if( rectCtrl.PtInRect( point2 ) ) { m_dwFocus = 1; return; } } }
//タイトル表示 //int&,bool&はTitle_Words,New,Contの順 //Title_Words タイトル文字の画像ハンドル //New,Cont はじめから、もしくはつづきから判定 void Display::title(int& Title_Words,bool& New,bool& Cont){//タイトル表示 Mouse mouse;//マウスポイント格納集合体 GetMousePoint(&mouse.x, &mouse.y);//マウスポイント取得 SetDrawBright(255, 153, 51);//描画する画像の色光度を設定 DrawRectGraph(240, 100, 0, 0, 800, 81, Title_Words, true, false);//新米ふぁ〜む //はじめから //描画する色の分岐処理 if (Mouse_Sq(370, 400, 540, 81, mouse)){ SetDrawBright(255, 102, 102); if (GetMouseInput_Once(Mouse_Buttons::Left)){//マウスボタン押されたら、アドレス先にtrueを返す New = true; } } else { SetDrawBright(102, 178, 255); } DrawRectGraph(370, 400, 0, 100, 540, 61, Title_Words, true, false);//はじめから //つづきから //描画する色の分岐処理 if (Mouse_Sq(370, 600, 540, 81, mouse)){ SetDrawBright(255, 102, 102); if (GetMouseInput_Once(Mouse_Buttons::Left)){//マウスボタン押されたら、アドレス先にtrueを返す Cont = true; } } else { SetDrawBright(102, 178, 255); } DrawRectGraph(370, 600, 0, 200, 540, 61, Title_Words, true, false);//つづきから SetDrawBright(255, 255, 255);//描画する画像の色光度を再設定 }
void CWndItemTransy::OnDraw( C2DRender* p2DRender ) { if( m_pItemElem[0] ) { if( m_pItemElem[0]->GetTexture() ) m_pItemElem[0]->GetTexture()->Render( p2DRender, m_Rect[0].TopLeft(), 255 ); CTexture Texture1; Texture1.LoadTexture(g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, m_pItemElemChange.GetProp()->szIcon ), 0xffff00ff ); Texture1.Render( p2DRender, m_Rect[1].TopLeft(), 255 ); } CPoint Point = GetMousePoint(); CRect HitRect = m_Rect[0]; CPoint Point2 = Point; if( m_Rect[0].PtInRect( Point ) ) { ClientToScreen( &Point2 ); ClientToScreen( &HitRect ); if( m_pItemElem[0] ) g_WndMng.PutToolTip_Item( (CItemBase*)m_pItemElem[0], Point2, &HitRect ); else g_toolTip.PutToolTip( 100, prj.GetText( TID_GAME_TRANSITEM_PUT ), *HitRect, Point2, 0 ); } HitRect = m_Rect[1]; if( m_Rect[1].PtInRect( Point ) ) { ClientToScreen( &Point2 ); ClientToScreen( &HitRect ); if( m_pItemElem[0] ) g_WndMng.PutToolTip_Item( (CItemBase*)&m_pItemElemChange, Point2, &HitRect ); else g_toolTip.PutToolTip( 100, prj.GetText( TID_GAME_TRANSITEM_PUT1 ), *HitRect, Point2, 0 ); } }
void Game::Play(){//ゲーム全体の各処理 int zx, zy,check=0; DX_Init(true, zx, zy,check);//DX初期化 if (check == -1){ return; } int Title_BG = Load_Title_Rand();//背景決め while (1){ //デバッグコマンド //1-タイトル //2-本編 //3-途中経過 //4-ゲーム終了 if (CheckHitKey(KEY_INPUT_1)){ Change_Phase(GAME_TITLE); } if (CheckHitKey(KEY_INPUT_2)){ Change_Phase(GAME_PLAY); } if (CheckHitKey(KEY_INPUT_3)){ Change_Phase(GAME_PAUSE); } if (CheckHitKey(KEY_INPUT_4)){ Change_Phase(GAME_END); } switch (game_phase){ case 1://タイトル ClearDrawScreen();//描画、画面初期化 DrawGraph(0, 0, Title_BG, false);//背景描画 ScreenFlip();//描画、画面切り替え break; case 2://本編 ClearDrawScreen();//描画、画面初期化 Mouse mouse; GetMousePoint(&mouse.x, &mouse.y); //田んぼ DrawFillBox(20, 20, 620, 520, Colors::Brown); //ステータス DrawFillBox(20, 560, 1004, 748, Colors::White); //ボタン if (Mouse_Sq(660, 20, 300, 100, mouse)){ DrawFillBox(660, 20, 960, 120, Colors::Red); } else DrawFillBox(660, 20, 960, 120, Colors::White); if (Mouse_Sq(660, 140, 300, 100, mouse)){ DrawFillBox(660, 140, 960, 240, Colors::Blue); } else DrawFillBox(660, 140, 960, 240, Colors::White); if (Mouse_Sq(660, 260, 300, 100, mouse)){ DrawFillBox(660, 260, 960, 360,Colors::Green); } else DrawFillBox(660, 260, 960, 360, Colors::White); if (Mouse_Sq(660, 380, 300, 100, mouse)){ DrawFillBox(660, 380, 960, 480, Colors::Yellow); } else DrawFillBox(660, 380, 960, 480, Colors::White); ScreenFlip();//描画、画面切り替え break; case 3://途中経過 ClearDrawScreen();//描画、画面初期化 DrawFillBox(zx, zy, zx + 20, zy + 20, 0xff00ff); ScreenFlip();//描画、画面切り替え break; case 4://ゲーム終了 ClearDrawScreen();//描画、画面初期化 DrawFillBox(zx, zy, zx + 20, zy + 20, 0xffff00); ScreenFlip();//描画、画面切り替え break; } } }
void CWndSummonAngel::OnDraw( C2DRender* p2DRender ) { //Render Icon ItemProp* pItemProp; CTexture* pTexture; pItemProp = prj.GetItemProp( II_GEN_MAT_ORICHALCUM01 ); if(pItemProp != NULL) { pTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, pItemProp->szIcon), 0xffff00ff ); if(pTexture != NULL) pTexture->Render( p2DRender, CPoint( 30, 218 ) ); } pItemProp = prj.GetItemProp( II_GEN_MAT_MOONSTONE ); if(pItemProp != NULL) { pTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, pItemProp->szIcon), 0xffff00ff ); if(pTexture != NULL) pTexture->Render( p2DRender, CPoint( 30, 306 ) ); } CPoint point = GetMousePoint(); int testnum = HitTest( point ); if( testnum != -1) { if( CWndBase::m_GlobalShortcut.m_dwData ) { m_nSelecCtrl = testnum; CRect rect; rect = m_MatDie[m_nSelecCtrl].wndCtrl->rect; p2DRender->RenderFillRect( rect, 0x60ffff00 ); } } else m_nSelecCtrl = -1; for(int i=0; i<MAX_MATDIE; i++) { if(m_MatDie[i].isUse) { if(m_MatDie[i].pItemElem) { pItemProp = prj.GetItemProp( m_MatDie[i].pItemElem->GetProp()->dwID ); if(pItemProp != NULL) { pTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, pItemProp->szIcon), 0xffff00ff ); if(pTexture != NULL) pTexture->Render( p2DRender, CPoint( m_MatDie[i].wndCtrl->rect.left, m_MatDie[i].wndCtrl->rect.top ) ); } } } } // '%' int y = 206; int nNext = 24; DWORD dwColor = 0xff2e70a9; CD3DFont* pOldFont = p2DRender->GetFont(); p2DRender->SetFont( CWndBase::m_Theme.m_pFontText ); p2DRender->TextOut( 415, y, "%", dwColor); y += nNext; p2DRender->TextOut( 415, y, "%", dwColor); y += nNext; p2DRender->TextOut( 415, y, "%", dwColor); y += nNext; p2DRender->SetFont( pOldFont ); }
void CWndVendorCtrl::OnDraw( C2DRender* p2DRender ) { if( m_pMover == NULL ) return; CRect rect = GetClientRect(); int nWidth = rect.Width() / 32; int nHeight = rect.Height() / 35; for( int i = 0; i < MAX_VENDITEM; i++ ) { int x = i % 6; int y = i / 6; //p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff ); CRect rectHittest = CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ); CPoint point = GetMousePoint(); if( rectHittest.PtInRect( point ) ) { if( CWndBase::m_GlobalShortcut.m_dwData ) { m_nCurSel = -1; CPoint ptx = CPoint(x * 32 + 7, y * 32 + 11); { m_pTex->Render( p2DRender, ptx ); } } } CItemBase* pItemBase = GetItem( i ); if( pItemBase ) { if( ((CItemElem*)pItemBase)->IsFlag( CItemElem::expired ) ) { pItemBase->GetTexture()->Render2( p2DRender, CPoint( x * 32 + 6, y * 32 + 10 ), D3DCOLOR_XRGB( 255, 100, 100 ) ); } else { pItemBase->GetTexture()->Render( p2DRender, CPoint( x * 32 + 6, y * 32 + 10 ) ); } CPoint point = GetMousePoint(); if( rectHittest.PtInRect( point ) ) { CPoint point2 = point; ClientToScreen( &point2 ); ClientToScreen( &rectHittest ); g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest, APP_VENDOR ); } if( i == m_nCurSel ) p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff ); CItemElem* pItemElem = (CItemElem*)pItemBase; if( pItemElem->GetProp()->dwPackMax > 1 ) { short nItemNum = pItemBase->GetExtra(); TCHAR szTemp[32]; _stprintf( szTemp, "%d", nItemNum ); CSize size = p2DRender->m_pFont->GetTextExtent( szTemp ); p2DRender->TextOut( x * 32 + 32 - size.cx+5, y * 32 + 32 - size.cy+12, szTemp, 0xff1010ff ); } } } }
void CWndVendorCtrl::OnDraw( C2DRender* p2DRender ) { if( m_pMover == NULL ) return; CRect rect = GetClientRect(); int nWidth = rect.Width() / 32; int nHeight = rect.Height() / 35; #if __VER >= 8 //__S8_VENDOR_REVISION for( int i = 0; i < MAX_VENDOR_REVISION; i++ ) #else //__S8_VENDOR_REVISION for( int i = 0; i < MAX_VENDITEM; i++ ) #endif //__S8_VENDOR_REVISION { int x = i % 2; int y = i / 2; int nX; int nY = y * 32 + 8 + y * 4; if( x == 0 ) nX = x * 32 + 15; else nX = 235; CRect rectHittest = CRect( nX, nY, nX + 180, nY + 32 ); CPoint point = GetMousePoint(); if( rectHittest.PtInRect( point ) ) { if( CWndBase::m_GlobalShortcut.m_dwData ) { m_nCurSel = -1; { CPoint ptx = CPoint(nX, nY); m_pTex->Render( p2DRender, ptx ); // 아이템 테두리 그리기 } } } CItemBase* pItemBase = GetItem( i ); if( pItemBase ) { // 툴팁 float fScal = 1.0f; CPoint point = GetMousePoint(); if( rectHittest.PtInRect( point ) ) { fScal = 1.15f; CPoint point2 = point; ClientToScreen( &point2 ); ClientToScreen( &rectHittest ); g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest, APP_VENDOR ); } // 아이템 아이콘 if( ((CItemElem*)pItemBase)->IsFlag( CItemElem::expired ) ) pItemBase->GetTexture()->Render2( p2DRender, CPoint( nX, nY ), D3DCOLOR_XRGB( 255, 100, 100 ) ); else pItemBase->GetTexture()->Render2( p2DRender, CPoint( nX, nY ), D3DCOLOR_XRGB( 255, 255, 255 ), fScal, fScal ); // 아이템 이름, 판매가격 OnDrawItemInfo( p2DRender, ((CItemElem*)pItemBase), nX, nY ); if( i == m_nCurSel ) p2DRender->RenderRect( CRect( nX, nY, nX + 32, nY + 32 ), 0xff00ffff ); CItemElem* pItemElem = (CItemElem*)pItemBase; if( pItemElem->GetProp()->dwPackMax > 1 ) { short nItemNum = pItemBase->GetExtra(); TCHAR szTemp[32]; _stprintf( szTemp, "%d", nItemNum ); CSize size = p2DRender->m_pFont->GetTextExtent( szTemp ); p2DRender->TextOut( nX - 7 + 32 - size.cx+5, nY - 11 + 32 - size.cy+12, szTemp, 0xff1010ff ); } } } }
//ループごとにやる最初の処理 void First_process() { GetMousePoint(&Mx, &My); }
void CameraWorkManager::Update_RotateCamOnGazePoint( double timeslice ) { static const double DrugMoveScale=0.005; // ドラッグ量に対する視点の移動量のパラメータ static Vector2D ScreenDrugStartPoint; // マウスでドラッグを開始したスクリーン上の座標を格納 static Vector2D SavedCamDist; // マウスでドラッグを開始したときの、m_dTilt、m_dHead を保持 static bool nowDruging=false; // 今ドラッグ中か? // キー入力から、m_dTilt と m_dHead を更新 //getKeyInput(); // スクロール操作から、カメラと注視点の距離を更新 getMouseWheelInput(timeslice); // マウスによるドラッグ操作により、m_dTilt と m_dHead を更新 if( nowDruging ) { // 今ドラッグ中 // ドラッグ終了したかを判定 if( ( GetMouseInput() & MOUSE_INPUT_LEFT ) == 0 ) { // ドラッグ終了 nowDruging = false; } else { // 今のマウス位置を取得 Point2D pos; GetMousePoint( &(pos.x) , &(pos.y) ); Vector2D CurMousePos( (double)pos.x, (double)pos.y); // m_dTilt と m_dHead を更新 Vector2D NewCamDist = -DrugMoveScale*(CurMousePos-ScreenDrugStartPoint)+SavedCamDist; m_dTilt = NewCamDist.y; m_dHead = NewCamDist.x; } } else { // ドラッグ中でない // ドラッグ開始したかを判定 int button; Point2D pos; if( GetMouseInputLog( &button, &pos.x, &pos.y, TRUE )==0 && ( button & MOUSE_INPUT_LEFT ) != 0 ) { // ドラッグが開始された // ドラッグ開始時の マウス座標を ScreenDrugStartPoint に保持 ScreenDrugStartPoint = pos.toRealVector(); // ドラッグ開始時の m_dTilt、m_dHead の値を SavedCamDist に保持 SavedCamDist.y = m_dTilt; SavedCamDist.x = m_dHead; // ドラッグフラグを立てる nowDruging = true; } } // m_dHead と m_dTilt から、(GazingPointを原点とした)カメラの位置を計算する Vector3D Hedding3D( 1.0, 0, 0 ); Hedding3D = VTransform( Hedding3D.toVECTOR(), MGetRotZ( (float)m_dTilt ) ); // もしかしたら、マイナスにしないと駄目かも Hedding3D = VTransform( Hedding3D.toVECTOR(), MGetRotY( -1*(float)m_dHead ) ); Vector3D toCamPos3D = m_dCamDistFrmFP * Hedding3D ; // ### ビュー行列を生成を確認 // カメラの座標変換行列のz軸向き(=カメラの向き) Vector3D vViewBaseZ = -1 * Hedding3D; // カメラの座標変換行列のy軸向きを仮置き Vector3D vViewBaseY( 0.0, 1.0, 0.0 ); // カメラの座標変換行列のx軸向き(= y × z ) Vector3D vViewBaseX = VCross( vViewBaseY.toVECTOR(), vViewBaseZ.toVECTOR() ); vViewBaseX = vViewBaseX.normalize(); // カメラの座標変換行列のy軸向きを再調整 vViewBaseY = VCross( vViewBaseZ.toVECTOR(), vViewBaseX.toVECTOR() ); // 基底を組み合わせてカメラ座標変換行列(Entityローカル座標)を生成 MATRIX MCamTransMatLocal = MGetAxis1( //MakeMatrixFromBaseVec( vViewBaseX.toVECTOR(), vViewBaseY.toVECTOR(), vViewBaseZ.toVECTOR(), toCamPos3D.toVECTOR() ); MCamTransMatLocal.m[3][1] += m_TrgtHight; // Entity位置だけシフトしたものがワールド座標でのカメラ座標変換行列 MATRIX MCamTransMatWorld = MCamTransMatLocal; MCamTransMatWorld.m[3][0] += m_TargetPos.x; //MCamTransMatWorld.m[3][1] += m_TrgtHight; <- MCamTransMatLocal の段階でシフト MCamTransMatWorld.m[3][2] += m_TargetPos.z; // 逆行列がビュー行列 m_MViewLocal = MInverse( MCamTransMatLocal ); m_MViewWorld = MInverse( MCamTransMatWorld ); // 背景パノラマ球の描画に使用しているため m_vFinalCamPos を参照している m_vFinalCamPos = VTransform( Vector3D( 0,0,0 ).toVECTOR(), MCamTransMatWorld ); };
int intro(AI_T *ai){ AI_T *init_ai = ai; static int gametitle = LoadGraph("media\\chofu_fes2.bmp"); static int start=0; if(start==0){ start=1; // テンプレ // extern void !初期化関数名!(AI_T &myAi); // !初期化関数名!(ai[!aiの番号!]); // extern Action !移動関数名!(int view[2*VISIBLE+1][2*VISIBLE+1]); // init_ai->moveFunc = !移動関数名!; //!!![重要]!!!!一番初め(aiSample)以外、最初にinit_ai++;を書く!!!!!!!!!! //関数名などが被ると駄目です 名前は早い者勝ちで(基本自分のハンドルネーム) // Player extern void PlayerInit(AI_T &myAi); PlayerInit(*init_ai); extern Action Player(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc = Player; // Player // AI0 (aiSample) init_ai++; extern void aiSampleInit(AI_T &myAi); aiSampleInit(*init_ai); extern Action aiSample(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc = aiSample; // AI0 // AI1 (aiTest) init_ai++; extern void aiTestInit(AI_T &myAi); aiTestInit(*init_ai); extern Action aiTest(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc = aiTest; // AI1 //kuzumi init_ai++; extern void kuzumiInit(AI_T &myAi); kuzumiInit(*init_ai); extern Action kuzumi(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=kuzumi; // //AI_MsZero init_ai++; extern void AI_MsZeroInit(AI_T &myAi); AI_MsZeroInit(*init_ai); extern Action AI_MsZero(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=AI_MsZero; // init_ai++; extern void taoaiInit(AI_T &myAi); taoaiInit(*init_ai); extern Action taoai(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=taoai; init_ai++; extern void AINomeaningInit(AI_T &myAi); AINomeaningInit(*init_ai); extern Action AINomeaning(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=AINomeaning; init_ai++; extern void toshi_aiInit(AI_T &myAi); toshi_aiInit(*init_ai); extern Action toshi_ai(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=toshi_ai; init_ai++; extern void nununuInit(AI_T &myAi); nununuInit(*init_ai); extern Action nununu(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=nununu; init_ai++; extern void KenkinoInit(AI_T &myAi); KenkinoInit(*init_ai); extern Action Kenkino(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=Kenkino; init_ai++; extern void hotaInit(AI_T &myAi); hotaInit(*init_ai); extern Action hota(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=hota; //11 init_ai++; extern void hentekoInit(AI_T &myAi); hentekoInit(*init_ai); extern Action henteko(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=henteko; //12 init_ai++; extern void TsuuroInit(AI_T &myAi); TsuuroInit(*init_ai); extern Action Tsuuro(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=Tsuuro; /*AI追加欄 init_ai++; extern void AI名Init(AI_T &myAi); AI名Init(*init_ai); extern Action AI名(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=AI名; */ } int entryX=320,entryY=315; int startX=320,startY=360; static int step=0,window=0,input=0,time=0,bright=255; int mx,my; int en=0; GetMousePoint(&mx,&my); time++; if(time>30)time=0; if(step==0){ if(GetMouseInput()==1){ step=1; } } if(step==1){ if(window<230)window+=23; if(GetMouseInput()==1 && input==0){ if(window>=230){ for(int i= 0; i < AI_NUM ;i++){ int x=20+201*(i%3),y=70+50*(int)(i/3); if(mx>=x && mx<=x+200 && my>=y && my<=y+50){ if(ai[i].entry==0)ai[i].entry=1; else ai[i].entry=0; } } if(mx>=30 && my>=400 && mx<=610 && my<=450){ step=2; window=0; } } } } if(step==2){ bright-=10; if(bright<=0){ SetDrawBright(255,255,255); return 1; } } for(int i=0;i<AI_NUM;i++){ if(ai[i].entry==1)en++; } if(GetMouseInput()==1 && input==0){ input=1; } if(GetMouseInput()==0 && input==1){ input=0; } ClearDrawScreen(); SetDrawBright(bright,bright,bright); DrawGraph(0,0,gametitle,FALSE); int cr=GetColor(125,255,205); if(step==0){ if(time%30<=15){ DrawString(240,350,"Click to start",cr,0); } } /* DrawString(entryX,entryY,"ENTRY AI",cr,0); DrawBox(entryX-80,entryY-20,entryX+80,entryY+20,cr,0); cr=GetColor(255,100,50); DrawString(startX,startY,"START!",cr,0); DrawBox(startX-100,startY-20,startX+100,startY+20,cr,0); */ if(step==1){ cr=GetColor(0,0,0); SetDrawBlendMode( DX_BLENDMODE_ALPHA,200); DrawBox(10,240-window,630,240+window,cr,1); SetDrawBlendMode( DX_BLENDMODE_ALPHA,255); cr=GetColor(255,255,255); DrawBox(10,240-window,630,240+window,cr,0); if(window>=230){ cr=GetColor(125,255,205); DrawString(240,30,"ENTRY AI",cr,0); cr=GetColor(255,255,255); for(int i= 0; i < AI_NUM ;i++){ if(ai[i].entry==0) SetDrawBright(100,100,100); int x=20+201*(i%3),y=70+50*(int)(i/3); DrawBox(x,y,x+200,y+50,cr,0); DrawBox(x,y,x+50,y+50,cr,0); DrawString(x+50,y+25,ai[i].name,GetColor(0,255,255),0); DrawRotaGraph(x+25,y+25,1,0,ai[i].Graph,FALSE,0); SetDrawBright(255,255,255); } cr=GetColor(255,100,50); DrawBox(30,400,610,450,cr,0); DrawString(240,425,"START!",cr,0); } } return 0; //WaitKey(); //WaitTimer(1000/60); }