Пример #1
0
// -----------------------------------------------------------------------------
// Recalculates the calltip text and size
// -----------------------------------------------------------------------------
void SCallTip::updateSize()
{
	updateBuffer();
	SetSize(buffer_.GetWidth() + UI::scalePx(24), buffer_.GetHeight() + UI::scalePx(16));

	// Get screen bounds and window bounds
	auto      index = (unsigned)wxDisplay::GetFromWindow(this->GetParent());
	wxDisplay display(index);
	auto      screen_area = display.GetClientArea();
	auto      ct_area     = GetScreenRect();

	// Check if calltip extends off the right of the screen
	if (ct_area.GetRight() > screen_area.GetRight())
	{
		// Move back so we're within the screen
		int offset = ct_area.GetRight() - screen_area.GetRight();
		SetPosition(wxPoint(GetPosition().x - offset, GetPosition().y));
	}

	Update();
	Refresh();
}
Пример #2
0
CAccessControlListRight* CAccessControlList::AddRight ( const char* szRightName, CAccessControlListRight::ERightType eRightType, bool bAccess )
{
    CAccessControlListRight* pRight = GetRight ( szRightName, eRightType );

    if ( !pRight )
    {
        pRight = new CAccessControlListRight ( szRightName, eRightType, bAccess, m_pACLManager );
        m_Rights.push_back ( pRight );
        OnChange ();
    }

    return pRight;
}
Пример #3
0
D3DXVECTOR3	Camera::GetParallelForward() const
{
	D3DXVECTOR3 up, returnedValue;

	//Point "up"
	up.x = 0.0f;
	up.y = 1.0f;
	up.z = 0.0f;

	D3DXVec3Cross(&returnedValue, &GetRight(), &up);

	return returnedValue;
}
Пример #4
0
/* -------------- MB_SELECTION Message -------------- */
static void SelectionMsg(WINDOW wnd, PARAM p1, PARAM p2)
{
    int wd, mx, my;
    MENU *mnu;

	if (!p2)	{
	    ActiveMenuBar->ActiveSelection = -1;
    	SendMessage(wnd, PAINT, 0, 0);
	}
    Selecting = TRUE;
    mnu = ActiveMenu+(int)p1;
    if (mnu->PrepMenu != NULL)
        (*(mnu->PrepMenu))(GetDocFocus(), mnu);
    wd = MenuWidth(mnu->Selections);
    if (p2)    {
		int brd = GetRight(wnd);
        mx = GetLeft(mwnd) + WindowWidth(mwnd) - 1;
		if (mx + wd > brd)
			mx = brd - wd;
        my = GetTop(mwnd) + mwnd->selection;
    }
    else    {
        int offset = menu[(int)p1].x1 - 4 * (int)p1;
        if (mwnd != NULL)
            SendMessage(mwnd, CLOSE_WINDOW, 0, 0);
        ActiveMenuBar->ActiveSelection = (int) p1;
        if (offset > WindowWidth(wnd)-wd)
            offset = WindowWidth(wnd)-wd;
        mx = GetLeft(wnd)+offset;
        my = GetTop(wnd)+1;
    }
    mwnd = CreateWindow(POPDOWNMENU, NULL,
                mx, my,
                MenuHeight(mnu->Selections),
                wd,
                NULL,
                wnd,
                NULL,
                SHADOW);
	if (!p2)	{
	    Selecting = FALSE;
    	SendMessage(wnd, PAINT, 0, 0);
	    Selecting = TRUE;
	}
    if (mnu->Selections[0].SelectionTitle != NULL)    {
        SendMessage(mwnd, BUILD_SELECTIONS, (PARAM) mnu, 0);
		SendMessage(mwnd, SETFOCUS, TRUE, 0);
		SendMessage(mwnd, SHOW_WINDOW, 0, 0);
    }
    Selecting = FALSE;
}
CString CReportEntityLine::GetString() const
/* ============================================================
	Function :		CReportEntityLine::GetString
	Description :	Creates a string representing this object.
	Access :		Public

	Return :		CString	-	Resulting string
	Parameters :	none

	Usage :			Call to save this object to file.

   ============================================================*/
{


	CRect rect = GetRect();

	double oldleft = GetLeft();
	double oldright = GetRight();
	double oldtop = GetTop();
	double oldbottom = GetBottom();

	double left = CUnitConversion::PixelsToInches( rect.left );
	double right = CUnitConversion::PixelsToInches( rect.right );
	double top = CUnitConversion::PixelsToInches( rect.top );
	double bottom = CUnitConversion::PixelsToInches( rect.bottom );

	CReportEntityLine* const local = const_cast< CReportEntityLine* const >( this );
	local->SetLeft( left );
	local->SetRight( right );
	local->SetTop( top );
	local->SetBottom( bottom );

	CString str;

	double thickness = CUnitConversion::PixelsToInches( GetBorderThickness() );
	str.Format( _T( ",%f,%i" ),
		thickness,
		GetBorderColor( ) );

	str += _T( ";" );
	str = GetDefaultGetString() + str;

	local->SetLeft( oldleft );
	local->SetRight( oldright );
	local->SetTop( oldtop );
	local->SetBottom( oldbottom );

	return str;

}
Пример #6
0
	void Frame::MoveMoseToFrame()
	{
		int sw=65536;
		int sh= 65536;
		float b=GetBottom()*sh/FrameManager::GetScreenHeigth();
		float t=GetTop()*sh/FrameManager::GetScreenHeigth();
		float l=GetLeft()*sw/FrameManager::GetScreenWidth();
		float r=GetRight()*sw/FrameManager::GetScreenWidth();
		float w=r-l;
		float h=t-b;
		float x=l+w/2;
		float y=sh-t+h/2;
		Process::MoveMouse((unsigned)x,(unsigned)y);
	}
void CObject::MoveRelative(const D3DXVECTOR3 *d3dxVec)
{
	D3DXVECTOR3 d3dxvPosition = *GetPosition();

	D3DXVECTOR3 d3dxvRight = *GetRight();
	D3DXVECTOR3 d3dxvUp = *GetUp();
	D3DXVECTOR3 d3dxvLookAt = *GetLookAt();

	d3dxvPosition += d3dxVec->x * d3dxvRight;
	d3dxvPosition += d3dxVec->y * d3dxvUp;
	d3dxvPosition += d3dxVec->z * d3dxvLookAt;

	MoveAbsolute(&d3dxvPosition);
}
void CObject::MoveRelative(const float fx, const float fy, const float fz)
{
	D3DXVECTOR3 d3dxvPosition = *GetPosition();

	D3DXVECTOR3 d3dxvRight = *GetRight();
	D3DXVECTOR3 d3dxvUp = *GetUp();
	D3DXVECTOR3 d3dxvLookAt = *GetLookAt();

	d3dxvPosition += fx * d3dxvRight;
	d3dxvPosition += fy * d3dxvUp;
	d3dxvPosition += fz * d3dxvLookAt;

	MoveAbsolute(&d3dxvPosition);
}
Пример #9
0
void nsStyleSides::AppendToString(nsString& aBuffer) const
{
  aBuffer.AppendLiteral("left: ");
  GetLeft().AppendToString(aBuffer);

  aBuffer.AppendLiteral("top: ");
  GetTop().AppendToString(aBuffer);

  aBuffer.AppendLiteral("right: ");
  GetRight().AppendToString(aBuffer);

  aBuffer.AppendLiteral("bottom: ");
  GetBottom().AppendToString(aBuffer);
}
Пример #10
0
void wxRect2DInt::ConstrainTo( const wxRect2DInt &rect )
{
    if ( GetLeft() < rect.GetLeft() )
        SetLeft( rect.GetLeft() );

    if ( GetRight() > rect.GetRight() )
        SetRight( rect.GetRight() );

    if ( GetBottom() > rect.GetBottom() )
        SetBottom( rect.GetBottom() );

    if ( GetTop() < rect.GetTop() )
        SetTop( rect.GetTop() );
}
Пример #11
0
// Tilt the camera horisontally: look left/right
void Camera::TurnHorizontal(const GameTime& gameTime, bool turnLeft)
{
	float angle = (float)gameTime.GetTimeSinceLastTick().Milliseconds * C_TILTING_SPEED;
	if(turnLeft)
		angle = -angle;

	D3DXVECTOR3 up;
	D3DXVec3Cross(&up, &mDirection, &GetRight());
	D3DXMATRIX rotation;

	D3DXMatrixRotationAxis(&rotation, &up, angle);
	D3DXVec3TransformCoord(&mDirection, &mDirection, &rotation);
	D3DXVec3Normalize(&mDirection, &mDirection);
}
Пример #12
0
	void Camera::Update()
	{
		//更新输入
		POINT curCursorPos;
		GetCursorPos(&curCursorPos);
		static POINT lastCursorPos = curCursorPos;

		long dx = curCursorPos.x - lastCursorPos.x;
		long dy = curCursorPos.y - lastCursorPos.y;

		float yawDelta = 0, pitchDelta = 0;
		if(dx) yawDelta = -dx/5.0f;
		if(dy) pitchDelta = -dy/5.0f;

		lastCursorPos = curCursorPos;

		if(!m_bActive)
			return;

		//相机旋转
		if(dx)
		{
			Yaw(yawDelta);
		}
		if(dy)
		{
			MAT44 rotX;
			rotX.FromAxisAngle(VEC3::UNIT_X, pitchDelta);
			//pitch
			m_matRot = Common::Multiply_Mat44_By_Mat44(m_matRot, rotX);
		}

		//相机移动
		VEC4 forward = GetDirection();
		VEC4 right = GetRight();

		forward = Common::Multiply_Vec4_By_K(forward, m_moveSpeed);
		right = Common::Multiply_Vec4_By_K(right, m_moveSpeed);
		
		if(GetAsyncKeyState('W') < 0)		m_viewPt = Add_Vec4_By_Vec4(m_viewPt, forward);
		else if(GetAsyncKeyState('S') < 0)	m_viewPt = Sub_Vec4_By_Vec4(m_viewPt, forward);
		if(GetAsyncKeyState('A') < 0)		m_viewPt = Sub_Vec4_By_Vec4(m_viewPt, right);
		else if(GetAsyncKeyState('D') < 0)	m_viewPt = Add_Vec4_By_Vec4(m_viewPt, right);

		m_viewPt.w = 1;

		_BuildViewMatrix();
		_BuildProjMatrix();
	}
Пример #13
0
int IsBST(struct TNode* root){
if(!root){
return 1;
}

if(root->left && root->data< GetRight(root->left)->data){
return 0;
}

if(root->right && root->data > GetLeft(root->right)->data){
return 0;
}
return IsBST(root->left) && IsBST(root->right);
//return 1;
}
Пример #14
0
void Scrollbar::Thumb::Arrange()
{
  if (auto sb = _scrollbar.lock())
  {
    auto scrollDelegate = sb->GetScrollDelegate();

    auto p = GetParent();
    SetLeft(p->GetLeft());
    SetRight(p->GetRight());
    auto trackHeight = p->GetHeight();
    auto height      = scrollDelegate->GetThumbSizePercent() * trackHeight;
    auto top         = p->GetTop() + (scrollDelegate->GetCurrentOffsetPercent() * trackHeight);
    SetTop(std::round(top));
    SetBottom(std::round(top + height));
  }
}
Пример #15
0
void FreeMove::ProcessInput(const Input& input, float delta)
{
	float movAmt = m_speed;

	if (input.GetKeyUp(m_forwardKey))
		Move(GetForward(*GetTransform()->GetRot()), movAmt);
	if (input.GetKeyUp(m_backKey))
		Move(GetBack(*GetTransform()->GetRot()), movAmt);
	if ( input.GetKeyUp ( m_leftKey ) )
		Move(GetLeft(*GetTransform()->GetRot()), movAmt);
	if ( input.GetKeyUp ( m_rightKey ) )
		Move(GetRight(*GetTransform()->GetRot()), movAmt);



}
Пример #16
0
void CDiagramEntity::MoveRect( double x, double y )
/* ============================================================
	Function :		CDiagramEntity::MoveRect
	Description :	Moves the object rect.
					
	Return :		void
	Parameters :	double x	-	Move x steps horizontally.
					double y	-	Move y steps vertically.
					
	Usage :			Call to move the object on screen.

   ============================================================*/
{

	SetRect( GetLeft() + x, GetTop() + y, GetRight() + x, GetBottom() + y );

}
Пример #17
0
CRect CDiagramEntity::GetRect() const
/* ============================================================
	Function :		CDiagramEntity::GetRect
	Description :	Returns the object rect.
					
	Return :		CRect	-	The object rect.
	Parameters :	none

	Usage :			Call to get the object position and size. 
					Will round of fractions.

   ============================================================*/
{

	CRect rect( ( int ) GetLeft(), ( int ) GetTop(), ( int ) GetRight(), ( int ) GetBottom() );
	return rect;

}
Пример #18
0
wxArraySheetCoords wxSheetBlock::GetArrayCoords() const
{
    wxArraySheetCoords arrCoords;
    if (IsEmpty())
        return arrCoords;
    
    arrCoords.Alloc(GetWidth()*GetHeight());
    const int bottom = GetBottom(), right = GetRight();
    wxSheetCoords coords;
    
    for (coords.m_row = m_row; coords.m_row <= bottom; coords.m_row++)
    {
        for (coords.m_col = m_col; coords.m_col <= right; coords.m_col++)
            arrCoords.Add(coords);
    }
    
    return arrCoords;
}
Пример #19
0
void VRect::Union (const VRect& inRect)
{
	if (IsEmpty())
	{
		fX = inRect.fX;
		fY = inRect.fY;
		fWidth = inRect.fWidth;
		fHeight = inRect.fHeight;
	}
	else if (!inRect.IsEmpty())
	{
		GReal	newLeft = Min(fX, inRect.fX);
		GReal	newTop = Min(fY, inRect.fY);
		GReal	newRight = Max(GetRight(), inRect.GetRight());
		GReal	newBottom = Max(GetBottom(), inRect.GetBottom());
		
		SetCoords(newLeft, newTop, newRight - newLeft, newBottom - newTop);
	}
}
Пример #20
0
void nsStyleSides::AppendToString(nsString& aBuffer) const
{
  nsStyleCoord  temp;

  GetLeft(temp);
  aBuffer.AppendLiteral("left: ");
  temp.AppendToString(aBuffer);

  GetTop(temp);
  aBuffer.AppendLiteral("top: ");
  temp.AppendToString(aBuffer);

  GetRight(temp);
  aBuffer.AppendLiteral("right: ");
  temp.AppendToString(aBuffer);

  GetBottom(temp);
  aBuffer.AppendLiteral("bottom: ");
  temp.AppendToString(aBuffer);
}
Пример #21
0
	void Viewer::CreateWindow()
	{
		auto winSize = wxDefaultSize;
		auto winPos = wxDefaultPosition;

		auto displayIndex = wxDisplay::GetFromPoint({ m_cfg.View.WindowPosX, m_cfg.View.WindowPosY });
		if (displayIndex != wxNOT_FOUND && displayIndex >= 0)
		{
			wxDisplay display(static_cast<unsigned int>(displayIndex));
			auto displayGeometry = display.GetClientArea();

			int w = Util::Constrain<int>(MinWindowWidth, m_cfg.View.WindowSizeWidth, displayGeometry.GetWidth());
			int h = Util::Constrain<int>(MinWindowHeight, m_cfg.View.WindowSizeHeight, displayGeometry.GetHeight());

			int x = Util::Constrain<int>(displayGeometry.GetLeft(), m_cfg.View.WindowPosX, displayGeometry.GetRight() - w);
			int y = Util::Constrain<int>(displayGeometry.GetTop(), m_cfg.View.WindowPosY, displayGeometry.GetBottom() - h);

			winSize = { w, h };
			winPos = { x, y };
		}

		Create(nullptr, -1, L"Pictus", winPos, winSize, wxDEFAULT_FRAME_STYLE);
	}
Пример #22
0
void
WndForm::ReinitialiseLayout()
{
  const SingleWindow &main_window = GetMainWindow();

  if (main_window.GetWidth() < GetWidth() ||
      main_window.GetHeight() < GetHeight()) {
    // close dialog, it's creator may want to create a new layout
    modal_result = mrChangeLayout;
  } else {
    // reposition dialog to fit into TopWindow
    PixelScalar left = GetLeft();
    PixelScalar top = GetTop();

    if (GetRight() > (PixelScalar) main_window.GetWidth())
      left = main_window.GetWidth() - GetWidth();
    if (GetBottom() > (PixelScalar) main_window.GetHeight())
      top = main_window.GetHeight() - GetHeight();

    if (left != GetLeft() || top != GetTop())
      Move(left, top);
  }
}
Пример #23
0
void FreeCamera::Update(const tt::GameContext& context)
{
	auto pInputService = MyServiceLocator::GetInstance()->GetService<IInputService>();
	auto pTransform = GetComponent<TransformComponent>();
	
	if(pInputService->IsActionTriggered(InputActionId::CameraMoveForward))
		pTransform->Translate(pTransform->GetForward() * m_MovementSpeed, true);
	
	if(pInputService->IsActionTriggered(InputActionId::CameraMoveBack))
		pTransform->Translate(pTransform->GetBackward() * m_MovementSpeed, true);
	
	if(pInputService->IsActionTriggered(InputActionId::CameraMoveLeft))
		pTransform->Translate(pTransform->GetLeft() * m_MovementSpeed, true);
	
	if(pInputService->IsActionTriggered(InputActionId::CameraMoveRight))
		pTransform->Translate(pTransform->GetRight() * m_MovementSpeed, true);

	if(pInputService->IsActionTriggered(InputActionId::CameraMoveUp))
		pTransform->Translate(pTransform->GetUp() * m_MovementSpeed, true);
	
	if(pInputService->IsActionTriggered(InputActionId::CameraMoveDown))
		pTransform->Translate(pTransform->GetDown() * m_MovementSpeed, true);

	if(!pInputService->IsActionTriggered(InputActionId::CameraUnlockRotation))
		return;

	auto mouseMovement = pInputService->GetMouseMovement();
	mouseMovement *= m_RotationSpeed * context.GameTimer.GetElapsedSeconds();
	m_Yaw += mouseMovement.x;
	m_Pitch += mouseMovement.y;

	tt::Quaternion yawQuat(tt::Vector3::j, m_Yaw);
	tt::Vector3 rotatedRight = tt::Vector3::i.TransformPoint(yawQuat);
	tt::Quaternion pitchQuat(rotatedRight, m_Pitch);

	pTransform->Rotate(yawQuat * pitchQuat);
}
bool wxSciterControl::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/, long style /*= wxSUNKEN_BORDER*/, const wxValidator& validator /*= wxDefaultValidator*/)
{
  if (!wxControl::Create(parent, id, pos, size, style, validator))
    return false;

  SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
  SetInitialSize(size);

  // Create Sciter child window with size exactly as our control.
  const auto crc = this->GetClientRect();
  RECT rc = {crc.GetLeft(), crc.GetTop(), crc.GetRight(), crc.GetBottom()};
  m_hwnd = SciterCreateWindow(SW_CHILD, &rc, nullptr, nullptr, this->GetHandle());

  if(m_hwnd) {
    static volatile sciter::debug_output setup_dbg;

    // Setup sciter callbacks
    setup_callback();
    sciter::attach_dom_event_handler(m_hwnd, this);

    // Adjust our window style to eliminate double edge 
    if(this->HasFlag(wxBORDER_MASK)) {
      auto style = this->GetWindowStyleFlag();
      style &= ~wxBORDER_MASK;
      style |= wxBORDER_NONE;
      this->SetWindowStyleFlag(style);
    }

    // Show Sciter window
#ifdef __WINDOWS__
    ::ShowWindow(m_hwnd, this->IsShown() ? SW_SHOW : SW_HIDE);
#endif

    this->Refresh();
  }
  return true;
}
Пример #25
0
bool wxBlockInt::Delete( const wxBlockInt &block,
                         wxBlockInt &top, wxBlockInt &bottom,
                         wxBlockInt &left, wxBlockInt &right) const
{
    top = bottom = left = right = wxEmptyBlockInt;

    wxBlockInt iBlock;
    Intersect(*this, block, &iBlock);

    if (iBlock.IsEmpty()) return false; // nothing to delete
    if (iBlock == *this) return true;   // can delete all of this, no leftover

    bool deleted = false;

    if ( m_y1 < iBlock.m_y1 )
    {
        top = wxBlockInt( m_x1, m_y1, m_x2, iBlock.m_y1-1 );
        deleted = true;
    }
    if ( GetBottom() > iBlock.GetBottom() )
    {
        bottom = wxBlockInt( m_x1, iBlock.m_y2+1, m_x2, m_y2 );
        deleted = true;
    }
    if ( m_x1 < iBlock.m_x1 )
    {
        left = wxBlockInt( m_x1, iBlock.m_y1, iBlock.m_x1-1, iBlock.m_y2 );
        deleted = true;
    }
    if ( GetRight() > iBlock.GetRight() )
    {
        right = wxBlockInt( iBlock.m_x2+1, iBlock.m_y1, m_x2, iBlock.m_y2 );
        deleted = true;
    }

    return deleted;
}
Пример #26
0
bool wxSheetBlock::Combine(const wxSheetBlock &block)
{
    
    //if (IsEmpty() || block.IsEmpty()) return false;
    if (!Touches(block)) return false;    
    if (Contains(block)) return true;
    if (block.Contains(*this))
    {
        *this = block;
        return true;
    }
    
    // FIXME I forgot why wxSheetBlock::Combine needs this code? Isn't Contains good enough?
    const wxSheetBlock uBlock(Union(block));
    if (uBlock.IsEmpty()) return false;

    // ugh this is really ugly, I can't figure a better way though
/*      
    // at least one of the two blocks has to be at each corner of the union
    if (((uBlock.GetLeftTop() == GetLeftTop()) || (uBlock.GetLeftTop() == block.GetLeftTop())) &&
        ((uBlock.GetRightTop() == GetRightTop()) || (uBlock.GetRightTop() == block.GetRightTop())) &&
        ((uBlock.GetLeftBottom() == GetLeftBottom()) || (uBlock.GetLeftBottom() == block.GetLeftBottom())) &&
        ((uBlock.GetRightBottom() == GetRightBottom()) || (uBlock.GetRightBottom() == block.GetRightBottom())) )
    {
        *this = uBlock;
        return true;
    }
*/

    const int t = GetTop();
    const int b = GetBottom();
    const int l = GetLeft();
    const int r = GetRight();

    const int b_t = block.GetTop();
    const int b_b = block.GetBottom();
    const int b_l = block.GetLeft();
    const int b_r = block.GetRight();

    const int ub_t = uBlock.GetTop();
    const int ub_b = uBlock.GetBottom();
    const int ub_l = uBlock.GetLeft();
    const int ub_r = uBlock.GetRight();

    if ( ( ((ub_t==t)&&(ub_l==l)) || ((ub_t==b_t)&&(ub_l==b_l)) ) &&
         ( ((ub_t==t)&&(ub_r==r)) || ((ub_t==b_t)&&(ub_r==b_r)) ) &&
         ( ((ub_b==b)&&(ub_l==l)) || ((ub_b==b_b)&&(ub_l==b_l)) ) &&
         ( ((ub_b==b)&&(ub_r==r)) || ((ub_b==b_b)&&(ub_r==b_r)) ) )
    {
        *this = uBlock;
        return true;
    }

    return false;


/*
    const int t = GetTop();
    const int b = GetBottom();
    const int l = GetLeft();
    const int r = GetRight();
    if ((t < b) || (l < r)) return false; // this is empty

    const int b_t = block.GetTop();
    const int b_b = block.GetBottom();
    const int b_l = block.GetLeft();
    const int b_r = block.GetRight();
    if ((b_t < b_b) || (b_l < b_r)) return false; // block is empty

    // if this contains other block
    if ((t <= b_t) && (l <= b_l) && (b >= b_b) && (r >= b_r))
        return true;
    // if block contains this
    if ((t >= b_t) && (l >= b_l) && (b <= b_b) && (r <= b_r))
    {
        *this = block;
        return true;
    }
    

    const int ub_t = uBlock.GetTop();
    const int ub_b = uBlock.GetBottom();
    const int ub_l = uBlock.GetLeft();
    const int ub_r = uBlock.GetRight();

    if ( ( ((ub_t==t)&&(ub_l==l)) || ((ub_t==b_t)&&(ub_l==b_l)) ) &&
         ( ((ub_t==t)&&(ub_r==r)) || ((ub_t==b_t)&&(ub_r==b_r)) ) &&
         ( ((ub_b==b)&&(ub_l==l)) || ((ub_b==b_b)&&(ub_l==b_l)) ) &&
         ( ((ub_b==b)&&(ub_r==r)) || ((ub_b==b_b)&&(ub_r==b_r)) ) )
    {
        *this = uBlock;
        return true;
    }

    return false;
*/    
}
Пример #27
0
 vec3 Camera::GetUp() const
 {
     return cross(GetRight(), GetDirection());
 }
Пример #28
0
// Move camera to the right: strafe
void Camera::MoveRight(GameTime& gameTime)
{
	D3DXVECTOR3 right = GetRight();
	mPosition += right * C_MOVE_SPEED * (float)gameTime.GetTimeSinceLastTick().Seconds;
}
Пример #29
0
//	ハイパーアーツ
bool	Thief::HyperArts(void)
{

	//空中で発動しても停止する
	move = Vector3(0, -GRAVITY, 0);

	if ( !initflag )
	{
		sound->PlaySE( SE::HYPER_ATTACK );
		sound->PlaySE( SE::KAITO_HYPER );
		initflag = true;
	}

	attackInfo.power = OFFENSIVE_POWER::HYPER;
	attackInfo.dropPower = DROP_POWER::HYPER;
	attackInfo.coinDropType = DROP_TYPE::SUCTION;

	SetParameterState(PARAMETER_STATE::UNRIVALED);
	move = Vector3(0, 0 - GRAVITY, 0);	//撃ってる間は静止させる
	SetMotion(THIEF::MOTION_DATA::HYPERARTS);


	//	行列から情報取得
	Vector3	front = GetFront();
	Vector3	right = GetRight();
	Vector3	p_pos = GetPos();
	SetMove(Vector3(0.0f, move.y, 0.0f));


	if (obj->GetFrame() >= THIEF::MOTION_FRAME::HYPERARTS_ATTACKSTART/* && obj->GetFrame() < THIEF::MOTION_FRAME::HYPERARTS_ATTACKEND*/)
	{
		float t = GetBezier(ePrm_t::eRapid_Lv5, ePrm_t::eSlow_Lv1, attackInfo.t);
		Vector3 f = front * (2.0f * sinf(D3DX_PI * t));
		Vector3 r = -right * (2.0f * cosf(D3DX_PI * t));
		attackInfo.bottom = p_pos + f + r;

		switch (HyperStep)
		{
		case 0:
			//	あたり判定のパラメータを与える
			attackInfo.top = attackInfo.bottom + r * HyperRate;
			attackInfo.r = 2.5f;
			HyperRate += 1.0;
			if (HyperRate > 20.0f) HyperStep++;
			break;
		case 1:
			//	パラメータ加算
			attackInfo.top = attackInfo.bottom + f * HyperRate + r * HyperRate;
			attackInfo.t += 0.03f;
			if (attackInfo.t >= 1.0f)
			{
				HyperStep++;
			}
			break;
		case 2:
			//attackInfo.top = attackInfo.bottom + r * rate;
			attackInfo.t = 0.0f;
			HyperRate -= 1.0f;
			break;
		}
		armRenderflag = true;
	}

	Vector3 v1, v2;
	v1 = front;
	v2 = attackInfo.top - attackInfo.bottom;
	v1.Normalize();
	v2.Normalize();
	float armAngle = GetAngle(v1, v2);
	Vector3 cross;
	Vector3Cross(cross, v1, v2);
	if (cross.y < 0) armAngle = -armAngle;

	arm->SetPos(pos);
	arm->SetAngle(angle.y + armAngle);
	arm->SetScale(Vector3(0.03f, 0.03f, HyperRate * 0.01f));
	arm->Update();

	if (HyperRate < 0)
	{
		HyperStep = 0;
		HyperRate = 0;
		armRenderflag = false;
		initflag = false;
		return true;
	}
	return	false;
}
Пример #30
0
//	クイックアーツ
bool	Thief::QuickArts(void)
{
	static int time = 0;
	if ( !initflag )
	{
		sound->PlaySE( SE::KAITO_QUICK );
		initflag = true;
	}
	Move();
	//	行列から情報取得
	Vector3	up = GetUp();
	Vector3	right = GetRight();
	Vector3	p_pos = GetPos();
	SetMove(Vector3(0.0f, move.y, 0.0f));

	SetMotion(THIEF::MOTION_DATA::QUICKARTS);
	//if (obj->GetFrame() >= 237) obj->SetMotion(237);

	//	情報設定
	Vector3	vec[3] =
	{
		up * 5.0f + right * 3.0f,
		up * 5.0f,
		up * 5.0f + right * -3.0f
	};
	p_pos.y += 3.0f;
	float	 bulletSpeed = 0.5f;
	int playerNum = GetPlayerNum();


	{	//撃った時に動きが一度止まるパターン
		//					//モーションアトデナオス(ちょうどいい感じのフレームが来たら弾発射)
		//if (time == 0 /* obj->GetFrame() == ○○ */ )
		//{
		//	for (int i = 0; i < 3; i++)
		//	{
		//		m_BulletManager->Set(BULLET_TYPE::THIEF_01 , new ThiefBullet01, p_pos, vec[i], bulletSpeed, playerNum);
		//	}
		//}
		//time++;

		////モーションアトデナオス(終わりのモーションが来たら終了)
		//if (obj->GetFrame() == 237)
		//{
		//	time = 0;
		//	return true;
		//}
	}

	{	//撃った時に動きが止まらないパターン
		for (int i = 0; i < 3; i++)
		{
			m_BulletManager->Set(BULLET_TYPE::THIEF_01 , new ThiefBullet01, p_pos, vec[i], bulletSpeed, playerNum);
		}
		attackInfo.Interval = 60;
		initflag = false;
		return true;

	}
	return	false;
}