Esempio n. 1
0
void Shooting::action(){
  popUp();
  gameClock++;
  // ボール君
	{
    for (int i=0; i<(int)heros.size(); i++){
      heros[i].move();
      if( heros[i].fire()) heroBullets.push_back( HeroBullet( heros[i].getPosx(), heros[i].getPosy()));
      heros[i].transitionState();
    }
  }
  // 四角君
  {
    for (int i=0; i<(int)enemys.size(); i++) enemys[i].action();
    for (int i=0; i<(int)enemys.size(); i++){
      if( !enemys[i].isValid()) {
        enemys.erase( enemys.begin()+i);
        i--;
      }
    }

  }
  // 弾
  {
    for (int i=0; i<(int)heroBullets.size(); i++) heroBullets[i].move();
    for (int i=0; i<(int)heroBullets.size(); i++){
      if( !heroBullets[i].isValid()) {
        heroBullets.erase( heroBullets.begin()+i);
        i--;
      }
    }
  }

  draw();
  calibrateFps();
}
Esempio n. 2
0
void CSelectionView::MouseDown(BPoint where)
{
	ulong btns;
	BPoint cur;
	
	GetMouse(&cur, &btns);

	if (IsOptionalClick(Window()->CurrentMessage()))
	{
		BPopUpMenu popUp("gotomenu");
		popUp.SetFont(be_plain_font);
		CNameTable& names = *fCellView->GetNameTable();
		
		if (names.size() == 0)
			popUp.AddItem(new BMenuItem(GetMessage(msgNoNames), 0));
		else
		{
			namemap::iterator i;
			
			for (i = names.begin(); i != names.end(); i++)
				popUp.AddItem(new BMenuItem((*i).first, 0));
		}
		
		BMenuItem *item = popUp.Go(ConvertToScreen(where));
		
		if (item)
		{
			BMessage msg(msg_GoTo);
			msg.AddString("name", item->Label());
			Window()->PostMessage(&msg, fCellView);
		}
	}
	else
	{
		bool isIn = true;
		BRect frame(Bounds());
		
		frame.InsetBy(1.0, 1.0);
		FillRect3D(this, frame, true, true, fText);

		while (btns)
		{
			if (frame.Contains(cur))
			{
				if (!isIn)
				{
					isIn = true;
					FillRect3D(this, frame, true, true, fText);
				}
			}
			else
			{
				if (isIn)
				{
					isIn = false;
					FillRect3D(this, frame, false, true, fText);
				}
			}
			GetMouse(&cur, &btns);
		}
	
		FillRect3D(this, frame, false, true, fText);
		
		if (isIn)
			Window()->PostMessage(msg_GoToCmd, fCellView);
	}
} /* CSelectionView::MouseDown */