当前位置: 首页>>代码示例>>C++>>正文


C++ Frect类代码示例

本文整理汇总了C++中Frect的典型用法代码示例。如果您正苦于以下问题:C++ Frect类的具体用法?C++ Frect怎么用?C++ Frect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Frect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawTexture

void CUIButton::DrawTexture()
{
    Frect rect; 
    GetAbsoluteRect		(rect);

    if(m_bAvailableTexture && m_bTextureEnable)
    {
        if(m_eButtonState == BUTTON_UP || m_eButtonState == BUTTON_NORMAL)
            m_UIStaticItem.SetPos(rect.left + m_TextureOffset.x, rect.top + m_TextureOffset.y);
        else
            m_UIStaticItem.SetPos(rect.left + m_PushOffset.x + m_TextureOffset.x, rect.top + m_PushOffset.y + m_TextureOffset.y);

        if(m_bStretchTexture)
            m_UIStaticItem.SetRect(0, 0, rect.width(), rect.height());
        else
        {
            Frect r={0,0,
                m_UIStaticItem.GetOriginalRectScaled().width(),
                m_UIStaticItem.GetOriginalRectScaled().height()};
            m_UIStaticItem.SetRect(r);
        }

        if( Heading() )
            m_UIStaticItem.Render( GetHeading() );
        else
            m_UIStaticItem.Render();		
    }
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:28,代码来源:UIButton.cpp

示例2: GetUICursor

void CUIWindow::Update()
{
    if (GetUICursor()->IsVisible())
    {
        bool cursor_on_window;

        Fvector2			temp = GetUICursor()->GetCursorPosition();
        Frect				r;
        GetAbsoluteRect		(r);
        cursor_on_window	= !!r.in(temp);
        // RECEIVE and LOST focus
        if(m_bCursorOverWindow != cursor_on_window)
        {
            if(cursor_on_window)
                OnFocusReceive();			
            else
                OnFocusLost();			
        }
    }
    
    for(WINDOW_LIST_it it = m_ChildWndList.begin(); m_ChildWndList.end()!=it; ++it){
        if(!(*it)->IsShown()) continue;
            (*it)->Update();
    }
}
开发者ID:2asoft,项目名称:xray,代码行数:25,代码来源:UIWindow.cpp

示例3: ScreenRect

void ui_core::PushScissor(const Frect& r_tgt, bool overlapped)
{
//.	return;
    Frect r_top			= ScreenRect();
    Frect result		= r_tgt;
    if (!m_Scissors.empty()&&!overlapped){
        r_top			= m_Scissors.top();
    }
    if (!result.intersection(r_top,r_tgt))
            result.set	(0.0f,0.0f,0.0f,0.0f);

    if (!(result.x1>=0&&result.y1>=0&&result.x2<=UI_BASE_WIDTH&&result.y2<=UI_BASE_HEIGHT) )
    {
        Msg("! r_tgt [%.3f][%.3f][%.3f][%.3f]", r_tgt.x1, r_tgt.y1, r_tgt.x2, r_tgt.y2);
        Msg("! result [%.3f][%.3f][%.3f][%.3f]", result.x1, result.y1, result.x2, result.y2);
        VERIFY(result.x1>=0&&result.y1>=0&&result.x2<=UI_BASE_WIDTH&&result.y2<=UI_BASE_HEIGHT);
    }
    m_Scissors.push		(result);

    result.lt.x 		= ClientToScreenScaledX(result.lt.x);
    result.lt.y 		= ClientToScreenScaledY(result.lt.y);
    result.rb.x 		= ClientToScreenScaledX(result.rb.x);
    result.rb.y 		= ClientToScreenScaledY(result.rb.y);

    Irect				r;
    r.x1 				= iFloor(result.x1);
    r.x2 				= iFloor(result.x2+0.5f);
    r.y1 				= iFloor(result.y1);
    r.y2 				= iFloor(result.y2+0.5f);
    RCache.set_Scissor	(&r);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:31,代码来源:ui_base.cpp

示例4: CreateDragItem

CUIDragItem* CUICellItem::CreateDragItem()
{
    CUIDragItem* tmp;
    tmp = xr_new<CUIDragItem>(this);
    Frect r;
    GetAbsoluteRect(r);
    if( m_UIStaticItem.GetFixedLTWhileHeading() )
    {
        float w, h;
        w				= r.width();
        h				= r.height();
        if (Heading())
        {   // исправление пропорций
            w = w / m_cell_size.x * m_cell_size.y;
            h = h / m_cell_size.y * m_cell_size.x;
        }

        Fvector2 cp = GetUICursor()->GetCursorPosition();
        // поворот на 90 градусов, и центрирование по курсору мыша						
        r.x1			= (cp.x - h / 2.0f);
        r.y1			= (cp.y - w / 2.0f);
        r.x2			= r.x1 + h;
        r.y2			= r.y1 + w;
    } 
    tmp->Init(GetShader(),r,GetUIStaticItem().GetOriginalRect());
    return tmp;
}
开发者ID:Karlan88,项目名称:xray,代码行数:27,代码来源:UICellItem.cpp

示例5: get_points

bool CUIFrameWindow::get_points(Frect const& r, int i, Fvector2& LTp, Fvector2& RBp, Fvector2& LTt, Fvector2& RBt)
{
    LTt				= m_tex_rect[i].lt;
    RBt				= m_tex_rect[i].rb;

    LTp				= r.lt; 
    RBp				= r.lt; 
    RBp.x			+= m_tex_rect[i].width();
    RBp.y			+= m_tex_rect[i].height();

    float rem_x		= r.width()-m_tex_rect[i].width();
    float rem_y		= r.height()-m_tex_rect[i].height();
    if(rem_x<0.0f)
    {
        RBt.x		+= rem_x;
        RBp.x		+= rem_x;
    }
    if(rem_y<0.0f)
    {
        RBt.y		+= rem_y;
        RBp.y		+= rem_y;
    }

    return true;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:25,代码来源:UIFrameWindow.cpp

示例6: OptimalFit

void CUICustomMap::OptimalFit(const Frect& r)
{
    if ((m_BoundRect.height()/r.height())<(m_BoundRect.width()/r.width()))
        FitToHeight	(r.height());
    else
        FitToWidth	(r.width());

}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:8,代码来源:UIMap.cpp

示例7: GetOriginalRectScaled

Frect CUICustomItem::GetOriginalRectScaled()
{
    Frect rect = iOriginalRect;

    rect.x2		= rect.x1 + rect.width();
    rect.y2		= rect.y1 + rect.height();

    return rect;
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:9,代码来源:UICustomItem.cpp

示例8: GetWndRect

void CUIGlobalMap::ClipByVisRect()
{
    Frect r					= GetWndRect();
    Frect clip				= GetClipperRect();
    if (r.x2<clip.width())	r.x1 += clip.width()-r.x2;
    if (r.y2<clip.height())	r.y1 += clip.height()-r.y2;
    if (r.x1>0.0f)			r.x1 = 0.0f;
    if (r.y1>0.0f)			r.y1 = 0.0f;
    SetWndPos				(r.x1,r.y1);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:10,代码来源:UIMap.cpp

示例9: MapWnd

Frect CUILevelMap::CalcWndRectOnGlobal	()
{
    Frect res;
    CUIGlobalMap* globalMap			= MapWnd()->GlobalMap();

    res.lt							= globalMap->ConvertRealToLocal(GlobalRect().lt);
    res.rb							= globalMap->ConvertRealToLocal(GlobalRect().rb);
    res.add							(globalMap->GetWndPos().x, globalMap->GetWndPos().y);

    return res;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:11,代码来源:UIMap.cpp

示例10: UI

bool CUIMMShniaga::OnMouse(float x, float y, EUIMessages mouse_action){
    
    Fvector2 pos = UI()->GetUICursor()->GetCursorPosition();
    Frect r;
    m_magnifier->GetAbsoluteRect(r);
    if (WINDOW_LBUTTON_DOWN == mouse_action && r.in(pos.x, pos.y))
    {
        OnBtnClick();
    }

    return CUIWindow::OnMouse(x,y,mouse_action);
}
开发者ID:2asoft,项目名称:xray,代码行数:12,代码来源:UIMMShniaga.cpp

示例11: UI

void CUIArtefactDetectorElite::Draw()
{
    Fmatrix						LM;
    GetUILocatorMatrix			(LM);

    IUIRender::ePointType bk	= UI()->m_currentPointType;

    UI()->m_currentPointType	= IUIRender::pttLIT;

    UIRender->CacheSetXformWorld(LM);
    UIRender->CacheSetCullMode	(IUIRender::cmNONE);

    CUIWindow::Draw				();

    Frect r						= m_wrk_area->GetWndRect();
    Fvector2					rp; 
    m_wrk_area->GetAbsolutePos	(rp);

    Fmatrix						M, Mc;
    float h,p;
    Device.vCameraDirection.getHP(h,p);
    Mc.setHPB					(h,0,0);
    Mc.c.set					(Device.vCameraPosition);
    M.invert					(Mc);

    xr_vector<Fvector>::const_iterator it	 = m_af_to_draw.begin();
    xr_vector<Fvector>::const_iterator it_e  = m_af_to_draw.end();
    for(;it!=it_e;++it)
    {
        Fvector					p = (*it);
        Fvector					pt3d;
        M.transform_tiny		(pt3d,p);
//		float kx				= m_wrk_area->GetWndSize().x / m_parent->m_fAfDetectRadius;
        float kz				= m_wrk_area->GetWndSize().y / m_parent->m_fAfDetectRadius;
        pt3d.x					*= kz;
        pt3d.z					*= kz;

        pt3d.x					+= m_wrk_area->GetWndSize().x/2.0f;	
        pt3d.z					-= m_wrk_area->GetWndSize().y;

        Fvector2				pos;
        pos.set					(pt3d.x, -pt3d.z);
        pos.sub					(rp);
        if( r.in(pos) )
        {
            m_af_sign->SetWndPos	(pos);
            m_af_sign->Draw			();
        }
    }

    UI()->m_currentPointType		= bk;
}
开发者ID:2asoft,项目名称:xray,代码行数:52,代码来源:EliteDetector.cpp

示例12: InitInternal

void CUICursor::InitInternal()
{
    m_static					= xr_new<CUIStatic>();
    m_static->InitTextureEx		("ui\\ui_ani_cursor", "hud\\cursor");
    Frect						rect;
    rect.set					(0.0f,0.0f,40.0f,40.0f);
    m_static->SetOriginalRect	(rect);
    Fvector2					sz;
    sz.set						(rect.rb);
    if(UI()->is_16_9_mode())
        sz.x					/= 1.2f;

    m_static->SetWndSize		(sz);
    m_static->SetStretchTexture	(true);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:15,代码来源:UICursor.cpp

示例13: HasChildMouseHandler

bool CUIWindow::HasChildMouseHandler(){
    WINDOW_LIST::reverse_iterator it = m_ChildWndList.rbegin();

    for( ; it!=m_ChildWndList.rend(); ++it)
    {
        if ((*it)->m_bClickable)
        {
            Frect wndRect = (*it)->GetWndRect();
            if (wndRect.in(cursor_pos) )
                return true;
        }
    }

    return false;
}
开发者ID:2asoft,项目名称:xray,代码行数:15,代码来源:UIWindow.cpp

示例14: DrawElements

void CUIFrameLineWnd::DrawElements()
{
    UIRender->SetShader			(*m_shader);

    Fvector2					ts;
    UIRender->GetActiveTextureResolution(ts);

    Frect						rect;
    GetAbsoluteRect				(rect);
    UI().ClientToScreenScaled	(rect.lt);
    UI().ClientToScreenScaled	(rect.rb);
    
    float back_len				= 0.0f;
    u32 prim_count				= 6*2; //first&second 
    if(bHorizontal)
    {
        back_len				= rect.width()-m_tex_rect[flFirst].width()-m_tex_rect[flSecond].width();
        if(back_len<0.0f)
            rect.x2				-= back_len;

        if(back_len>0.0f)
            prim_count				+= 6* iCeil(back_len / m_tex_rect[flBack].width());
    }else
    {
        back_len				= rect.height()-m_tex_rect[flFirst].height()-m_tex_rect[flSecond].height();
        if(back_len<0)
            rect.y2				-= back_len;

        if(back_len>0.0f)
            prim_count				+= 6* iCeil(back_len / m_tex_rect[flBack].height());
    }

    UIRender->StartPrimitive	(prim_count, IUIRender::ptTriList, UI().m_currentPointType);

    for(int i=0; i<flMax; ++i)
    {
        Fvector2 LTt, RBt;
        Fvector2 LTp, RBp;
        int counter				= 0;

        while(inc_pos(rect, counter, i, LTp, RBp, LTt, RBt))
        {
            draw_rect				(LTp, RBp, LTt, RBt, m_texture_color, ts);
            ++counter;
        };
    }
    UIRender->FlushPrimitive		();
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:48,代码来源:UIFrameLineWnd.cpp

示例15: evaluate

bool CEvaluatorTargetMapShown::evaluate()
{
    if(m_storage->property(1)) return true;
    if(m_storage->property(2)) return true;
    Fvector2 pt					= m_object->m_tgtCenter; 
    pt.mul						(m_object->GlobalMap()->GetCurrentZoom());
    Fvector2 _p;
    m_object->GlobalMap()->GetAbsolutePos(_p);
    pt.add						(_p);
    Frect	rect	=	m_object->ActiveMapRect();
            rect.grow	(rect.width(),rect.height());
    if (rect.in(pt))	{
        m_storage->set_property	(2,true);
        return true;
    }
    return false;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:17,代码来源:UIMapWndActions.cpp


注:本文中的Frect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。