void AddUpdateRowHighlight(Point localPt) { int i, j; Rect currCellRect, oldCellRect; Cell currCell, oldCell; UInt8 hiliteVal; for (i=0; i<numRows; i++) { /* note: numComps above includes invisible components */ SetPt(&currCell, 0, i); LRect(&currCellRect, currCell, gControls->aw->compList); /* mouse move landed over this cell */ if (PtInRect( localPt, &currCellRect )) { if (!gControls->cfg->comp[rowToComp[i]].highlighted) { /* highlight this cell */ INVERT_HIGHLIGHT(&currCellRect); AddUpdateLongDesc(i); /* unhighlight old one */ for (j=0; j<numRows; j++) { if (gControls->cfg->comp[rowToComp[j]].highlighted) { SetPt(&oldCell, 0, j); LRect(&oldCellRect, oldCell, gControls->aw->compList); INVERT_HIGHLIGHT(&oldCellRect); gControls->cfg->comp[rowToComp[j]].highlighted = false; } } /* mark this row highlighted to prevent incorrect inversion */ gControls->cfg->comp[rowToComp[i]].highlighted = true; } } } }
/* -----------------------------------------------------------------------------*/ short PointToDrvIndex (WindowPtr win, Point p, ListHandle list) { Cell c; Rect r; short i; c.h = c.v = 0; for (i = 0; i < 64; i++, c.v++) { LRect (&r, c, list); if (PtInRect(p, &r)) { return ListIndexToDrvIndex (i, list); } } return -1; }
//--------------------------------------------------------------------- // ● 選択している項目を変更した //--------------------------------------------------------------------- void SceneGameover::_onSelectIndex() { mPointCursor->moveTo( COMMAND_POS_X - 38, COMMAND_POS_Y + mSelectIndex * 32 + 16 ); mDescContents->Clear( Color32( 0, 0, 0, 0 ) ); if ( mSelectIndex == 0 ) { mDescContents->DrawText("Continue", LRect(8, 2, 256, 256), mDescTitleFont, Color32::White, Color32::Black, 0, TextAlignment::Left); mFormatText.setText( "ステージの最初からやり直します。\n\nスコアが 0 にリセットされます。" ); mFormatText.build(); } else { mDescContents->DrawText("End", LRect(8, 2, 256, 256), mDescTitleFont, Color32::White, Color32::Black, 0, TextAlignment::Left); mFormatText.setText( "タイトル画面に戻ります。" ); mFormatText.build(); } }
//--------------------------------------------------------------------------- bool BottomWall::Update() { ++this->m_nFrame; this->mPanel->SetPosition(this->mPosition); //発動条件(適当)//上下差が200以下 かつ 左右差が10以下 const int y = 150; const int x = 100; LVector3 myPos = this->mPosition; myPos.x += 50; myPos.y -= 100; if(abs(myPos.y - GameManager::getInstance()->getPlayer()->getPosition().y) <= y && abs(myPos.x - GameManager::getInstance()->getPlayer()->getPosition().x) <= x && this->m_bActive && !this->m_bStart) { GameAudio::PlaySE("./Data/Sound/SE/don01.wav",0.75,1.00); GameAudio::PlaySE("./Data/Sound/SE/don01.wav",0.90,0.70); GameAudio::PlaySE("./Data/Sound/SE/don01.wav",0.90,0.60); this->m_bStart = true; } if(this->m_bActive) { if(this->m_bStart) { //窓アニメーション if(!(this->m_nFrame % 2)) { if(this->m_nAnime < 8) { this->m_nAnime++; this->mPanel->SetSrcRect(LRect(this->m_nAnime * 160.0f,0,160.0f,160.0f)); } } //敵出現 if(!(this->m_nFrame % 6)) //2フレームに1回 { if(this->m_nEnemyNum) { Enemy* pEnemy = Enemy::createRandom(); pEnemy->setPosition(LVector3(this->mPosition.x + 65,this->mPosition.y - 130,this->mPosition.z)); pEnemy->setDefPosition(LVector3(this->mPosition.x + 65,this->mPosition.y - 130,this->mPosition.z)); pEnemy->setVelocity(LVector3(::rand() % 10 - 5,0,0)); this->m_nEnemyNum -= 1; } } } } return true; }
//--------------------------------------------------------------------------- bool BottomWall::Initialize() { this->Release(); LTexture t = Assets::LoadTexture(g_szBottomWallFilePath); //this->mPanel = Sprite3D::Create(160.0f,160.0f,LN_PANELDIR_UPPER_REFT); this->mPanel = Sprite3D::Create(160.0f,160.0f); this->mPanel->SetCenter(-80, 80, 0); this->mPanel->SetTexture(t); this->mPanel->SetSrcRect(LRect(0,0,160,160)); this->mPanel->SetPosition(this->mPosition); this->mPanel->SetVisible(true); return true; }
void AddInitRowHighlight(int row) { Cell hlCell; Rect hlCellRect; UInt8 hiliteVal; int i = 0; /* reset all highlighted markers */ for (i=0; i<numRows; i++) { gControls->cfg->comp[rowToComp[i]].highlighted = false; } /* highlight and set marker for row to init */ SetPt(&hlCell, 0, row); LRect(&hlCellRect, hlCell, gControls->aw->compList); INVERT_HIGHLIGHT(&hlCellRect); AddUpdateLongDesc(row); gControls->cfg->comp[rowToComp[row]].highlighted = true; }
void InAdditionsContent(EventRecord* evt, WindowPtr wCurrPtr) { Point localPt; Rect r, currCellRect, checkbox; ControlPartCode part; int i; Cell currCell; UInt8 hiliteVal; PixPatHandle ppH; GrafPtr oldPort; GetPort(&oldPort); SetPort(wCurrPtr); localPt = evt->where; GlobalToLocal( &localPt); /* Mouse Up */ /* scroll */ SetRect(&r, gControls->aw->compListBox.right, gControls->aw->compListBox.top, gControls->aw->compListBox.right + kScrollBarWidth, gControls->aw->compListBox.bottom); if ((evt->what == mouseUp) && (PtInRect( localPt, &r))) { LClick(localPt, evt->modifiers, gControls->aw->compList); SetRect(&r, gControls->aw->compListBox.left, gControls->aw->compListBox.top, gControls->aw->compListBox.right + 1, gControls->aw->compListBox.bottom); FrameRect(&r); } /* or un/check components */ if ((evt->what == mouseUp) && (PtInRect( localPt, &gControls->aw->compListBox))) { LClick(localPt, evt->modifiers, gControls->aw->compList); AddUpdateRowHighlight(localPt); /* invert the checkbox rect */ for (i=0; i<numRows; i++) { SetPt(&currCell, 0, i); LRect(&currCellRect, currCell, gControls->aw->compList); if (PtInRect(localPt, &currCellRect)) { SetRect(&checkbox, currCellRect.left+4, currCellRect.top+2, currCellRect.left+16, currCellRect.top+14); INVERT_HIGHLIGHT(&checkbox); break; } } AddSetOptInfo(false); } /* Mouse Down */ if ((evt->what == mouseDown) && (PtInRect( localPt, &gControls->aw->compListBox))) { /* show depressed button state */ for (i=0; i<numRows; i++) { SetPt(&currCell, 0, i); LRect(&currCellRect, currCell, gControls->aw->compList); if (PtInRect(localPt, &currCellRect)) { SetRect(&checkbox, currCellRect.left+4, currCellRect.top+2, currCellRect.left+16, currCellRect.top+14); ppH = GetPixPat(rGrayPixPattern); FillCRect(&checkbox, ppH); FrameRect(&checkbox); if (gControls->cfg->comp[rowToComp[i]].selected) { /* draw check mark */ MoveTo(checkbox.left+1, checkbox.top+1); LineTo(checkbox.right-2, checkbox.bottom-2); MoveTo(checkbox.right-2, checkbox.top+1); LineTo(checkbox.left+1, checkbox.bottom-2); } /* create 3D depression */ MoveTo(checkbox.left+1, checkbox.top+1); LineTo(checkbox.left+1, checkbox.bottom-1); MoveTo(checkbox.left+1, checkbox.top+1); LineTo(checkbox.right-1, checkbox.top+1); ForeColor(whiteColor); MoveTo(checkbox.right-1, checkbox.top+1); LineTo(checkbox.right-1, checkbox.bottom-1); MoveTo(checkbox.left+1, checkbox.bottom-1); LineTo(checkbox.right-1, checkbox.bottom-1); ForeColor(blackColor); if (ppH) DisposePixPat(ppH); break; } } } HLock((Handle)gControls->backB); r = (**(gControls->backB)).contrlRect; HUnlock((Handle)gControls->backB); if (PtInRect( localPt, &r)) { /* reset all rows to be not highlighted */ for (i=1; i<numRows; i++) gControls->cfg->comp[rowToComp[i]].highlighted = false; part = TrackControl(gControls->backB, evt->where, NULL); if (part) { /* extra handling since we used DrawString for static text msg * and framed our own listbox etc. */ gControls->aw->compListBox.top = 0; EraseRect(&gControls->aw->compListBox); ClearDiskSpaceMsgs(); KillControls(gWPtr); ShowComponentsWin(); return; } } HLock((Handle)gControls->nextB); r = (**(gControls->nextB)).contrlRect; HUnlock((Handle)gControls->nextB); if (PtInRect( localPt, &r)) { /* reset all rows to be not highlighted */ for (i=0; i<numRows; i++) gControls->cfg->comp[rowToComp[i]].highlighted = false; part = TrackControl(gControls->nextB, evt->where, NULL); if (part) { if (!VerifyDiskSpace()) return; gControls->aw->compListBox.top = 0; EraseRect(&gControls->aw->compListBox); ClearDiskSpaceMsgs(); KillControls(gWPtr); ShowTerminalWin(); return; } } SetPort(oldPort); }
//--------------------------------------------------------------------- // ● 開始処理 //--------------------------------------------------------------------- void SceneGameover::onStart() { LTexture tex = Texture2D::Create( 32, 32 ); tex->Clear( Color32( 0, 0, 0 ) ); mBlindSprite = Sprite2D::Create( tex ); mBlindSprite->SetScale( 20 ); mBlindSprite2 = Sprite2D::Create( tex ); mBlindSprite2->SetScale( 20 ); mBlindSprite2->SetPosition( 0, 240 ); mBlindSprite2->SetOpacity( 0 ); // 説明ウィンドウ LTexture fe_tex = Assets::LoadTexture( "Data/Graphics/Frontend/Frontend_1.png" ); mDescWindowSprite = Sprite2D::Create( fe_tex ); mDescWindowSprite->SetPosition( 60, 280 ); mDescWindowSprite->SetSrcRect( 272, 368, 240, 144 ); mDescWindowSprite->SetOpacity( 0 ); mDescContents = Texture2D::Create( 240, 144 ); mDescContentsSprite = Sprite2D::Create( mDescContents ); mDescContentsSprite->SetPosition( 60, 280 ); mDescContentsSprite->SetOpacity( 0 ); mDescTitleFont = Font::Create(); mDescTitleFont->SetSize( 12 ); // コマンド mCommandSprite[ 0 ] = Sprite2D::Create( fe_tex ); mCommandSprite[ 0 ]->SetSrcRect( 272, 304, 128, 32 ); mCommandSprite[ 0 ]->SetPosition( COMMAND_POS_X, COMMAND_POS_Y ); mCommandSprite[ 0 ]->SetOpacity( 0 ); mCommandSprite[ 1 ] = Sprite2D::Create( fe_tex ); mCommandSprite[ 1 ]->SetSrcRect( 272, 336, 128, 32 ); mCommandSprite[ 1 ]->SetPosition( COMMAND_POS_X, COMMAND_POS_Y + 32 ); mCommandSprite[ 1 ]->SetOpacity( 0 ); // 制御文字列描画クラス LFont desc_text = Font::Create(); desc_text->SetSize( 15 ); mFormatText.setFont( desc_text ); mFormatText.setDrawRect( LRect( 12, 20, 224, 120 ) ); // GameOver mLogoSprite = Sprite2D::Create( fe_tex ); mLogoSprite->SetSrcRect( 160, 224, 352, 64 ); mLogoSprite->SetPosition( 320, 128 ); mLogoSprite->SetCenter( 352 / 2, 64 / 2 ); mLogoSprite->SetOpacity( 0 ); // カーソル mPointCursor = NEW PointCursor(); // BGM フェードアウト GameAudio::StopBGM( 5.0f ); mStep = 0; mFrameCount = 0; mSelectIndex = 0; }