本文整理汇总了C++中CUIStatic类的典型用法代码示例。如果您正苦于以下问题:C++ CUIStatic类的具体用法?C++ CUIStatic怎么用?C++ CUIStatic使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CUIStatic类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __declspec
bool __declspec(dllexport) SetupGameIcon(u32 icon, u32 cl, float width, float height) // позволяет расцветить иконку или изменить её размер
{
CUIMainIngameWnd *window = GetMainIngameWindow();
if (!window)
{
log_script_error("SetupGameIcon failed due GetMainIngameWindow() returned NULL");
return false;
}
CUIStatic *sIcon = warn_icon_list[icon & 7];
if (sIcon)
{
if (width > 0 && height > 0)
{
sIcon->SetWidth (width);
sIcon->SetHeight (height);
sIcon->SetStretchTexture(cl > 0);
}
else
window->SetWarningIconColor((CUIMainIngameWnd::EWarningIcons)icon, cl);
external_icon_ctrl = true;
return true;
}
return false;
}
示例2: GetHeight
float CUIPdaKillMessage::InitText(CUIStatic& refStatic, float x, PlayerInfo& info){
if ( 0 == xr_strlen(info.m_name))
return 0;
float y = 0;
float selfHeight = GetHeight();
CGameFont* pFont = GetFont();
float width = pFont->SizeOf_(*info.m_name);
UI()->ClientToScreenScaledWidth (width);
float height = pFont->CurrentHeight_();
y = (selfHeight - height)/2;
float __eps = pFont->SizeOf_('o');//hack -(
UI()->ClientToScreenScaledWidth (__eps);
clamp (width, 0.0f, 120.0f);
refStatic.Init (x, 0/*y*/, width + __eps, height);
//. refStatic.SetElipsis (CUIStatic::eepEnd, 0);
refStatic.SetText (*info.m_name);
refStatic.SetTextColor (info.m_color);
return width;
}
示例3: if
void CUIMainIngameWnd::InitFlashingIcons(CUIXml* node)
{
const char * const flashingIconNodeName = "flashing_icon";
int staticsCount = node->GetNodesNum("", 0, flashingIconNodeName);
CUIXmlInit xml_init;
CUIStatic *pIcon = NULL;
// Пробегаемся по всем нодам и инициализируем из них статики
for (int i = 0; i < staticsCount; ++i)
{
pIcon = xr_new<CUIStatic>();
xml_init.InitStatic(*node, flashingIconNodeName, i, pIcon);
shared_str iconType = node->ReadAttrib(flashingIconNodeName, i, "type", "none");
// Теперь запоминаем иконку и ее тип
EFlashingIcons type = efiPdaTask;
if (iconType == "pda") type = efiPdaTask;
else if (iconType == "mail") type = efiMail;
else R_ASSERT(!"Unknown type of mainingame flashing icon");
R_ASSERT2(m_FlashingIcons.find(type) == m_FlashingIcons.end(), "Flashing icon with this type already exists");
CUIStatic* &val = m_FlashingIcons[type];
val = pIcon;
AttachChild(pIcon);
pIcon->Show(false);
}
}
示例4: CUIStatic
CUIDragItem* CUIWeaponCellItem::CreateDragItem()
{
CUIDragItem* i = inherited::CreateDragItem();
CUIStatic* s = NULL;
if(GetIcon(eSilencer))
{
s = new CUIStatic(); s->SetAutoDelete(true);
s->SetShader (InventoryUtilities::GetEquipmentIconsShader());
InitAddon (s, *object()->GetSilencerName(), m_addon_offset[eSilencer], false);
s->SetColor (i->wnd()->GetColor());
i->wnd ()->AttachChild (s);
}
if(GetIcon(eScope))
{
s = new CUIStatic(); s->SetAutoDelete(true);
s->SetShader (InventoryUtilities::GetEquipmentIconsShader());
InitAddon (s, *object()->GetScopeName(), m_addon_offset[eScope], false);
s->SetColor (i->wnd()->GetColor());
i->wnd ()->AttachChild (s);
}
if(GetIcon(eLauncher))
{
s = new CUIStatic(); s->SetAutoDelete(true);
s->SetShader (InventoryUtilities::GetEquipmentIconsShader());
InitAddon (s, *object()->GetGrenadeLauncherName(),m_addon_offset[eLauncher], false);
s->SetColor (i->wnd()->GetColor());
i->wnd ()->AttachChild (s);
}
return i;
}
示例5: InitIcon
float CUIPdaKillMessage::InitIcon(CUIStatic& refStatic, float x, IconInfo& info){
if ( 0 == info.m_rect.width())
return 0;
if (info.m_shader == NULL)
return 0;
float y = 0;
float selfHeight = GetHeight();
float scale = 0;
Frect rect = info.m_rect;
float width = rect.width();
float height = rect.height();
scale = selfHeight/height;
if (scale > 1)
scale = 1;
width = width*scale;
height = height*scale;
y = (selfHeight - height) /2;
refStatic.Init(x, y, width, height);
refStatic.SetOriginalRect(info.m_rect);
refStatic.SetShader(info.m_shader);
refStatic.SetStretchTexture(true);
return width;
}
示例6: CUIWindow
void CUIStatsPlayerList::InitTeamHeader(CUIXml& xml_doc, LPCSTR path){
string256 _path;
m_header_team = new CUIWindow();
m_header_team->SetAutoDelete(true);
CUIXmlInit::InitWindow(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header"), 0, m_header_team);
m_header_team->SetWidth(this->GetDesiredChildWidth());
CUIStatic* logo = new CUIStatic();
logo->SetAutoDelete(true);
CUIXmlInit::InitStatic(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header:logo"), 0, logo);
m_header_team->AttachChild(logo);
if (1 == m_CurTeam)
logo->InitTexture(pSettings->r_string("team_logo_small", "team1"));
else if (2 == m_CurTeam)
logo->InitTexture(pSettings->r_string("team_logo_small", "team2"));
else
R_ASSERT2(false, "invalid team");
S_ELEMENT t;
CUIXmlInit::InitFont(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header:text_format"), 0, t.c, t.f);
t.h = m_header_team->GetHeight();
m_header_text = new CUIStatic();
m_header_text->SetAutoDelete(true);
CUIXmlInit::InitStatic(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header:header"), 0, m_header_text);
m_header_text->SetWidth(GetDesiredChildWidth());
m_header_text->SetVTextAlignment(valCenter);
m_header_team->AttachChild(m_header_text);
if (t.f)
m_header_text->SetFont(t.f);
m_header_text->SetTextColor(t.c);
}
示例7: DestroyDragItem
void CUIDragDropReferenceList::ReloadReferences(CInventoryOwner* pActor)
{
if (!pActor)
return;
if(m_drag_item)
DestroyDragItem();
m_container->ClearAll(true);
m_selected_item = NULL;
for(u8 i=0; i<m_container->CellsCapacity().x; i++)
{
CUIStatic* ref = m_references[i];
LPCSTR item_name = ACTOR_DEFS::g_quick_use_slots[i];
if(item_name && xr_strlen(item_name))
{
PIItem itm = pActor->inventory().GetAny(item_name);
if(itm)
{
SetItem(create_cell_item(itm), Ivector2().set(i, 0));
}
else
{
LoadItemTexture(item_name, Ivector2().set(i, 0));
ref->SetTextureColor(color_rgba(255,255,255,100));
}
}
else
{
ref->SetTextureColor(color_rgba(255,255,255,0));
}
}
}
示例8: GetStaticRaw
void GetStaticRaw(CUIMainIngameWnd *wnd, lua_State *L)
{
using namespace luabind::detail;
// wnd->GetChildWndList();
shared_str name = lua_tostring(L, 2);
CUIWindow *child = wnd->FindChild(name, 2);
if (!child)
{
CUIStatic *src = &wnd->GetUIZoneMap()->Background();
child = src->FindChild(name, 5);
if (!child)
{
src = &wnd->GetUIZoneMap()->ClipFrame();
child = src->FindChild(name, 5);
}
if (!child)
{
src = &wnd->GetUIZoneMap()->Compass();
child = src->FindChild(name, 5);
}
}
if (child)
{
// if (test_push_window<CUIMotionIcon> (L, child)) return;
if (test_push_window<CUIProgressBar> (L, child)) return;
if (test_push_window<CUIStatic> (L, child)) return;
if (test_push_window<CUIWindow> (L, child)) return;
}
lua_pushnil(L);
}
示例9: CUIStatic
CUIStatic* UIHelper::CreateStatic( CUIXml& xml, LPCSTR ui_path, CUIWindow* parent )
{
CUIStatic* ui = new CUIStatic();
parent->AttachChild ( ui );
ui->SetAutoDelete ( true );
CUIXmlInit::InitStatic ( xml, ui_path, 0, ui );
return ui;
}
示例10: InitStatic
CUIStatic* CScriptXmlInit::InitStatic(LPCSTR path, CUIWindow* parent){
CUIStatic* pWnd = xr_new<CUIStatic>();
CUIXmlInit::InitStatic(m_xml, path, 0, pWnd);
pWnd->SetAutoDelete(true);
_attach_child(pWnd, parent);
//. if(parent) parent->AttachChild(pWnd);
return pWnd;
}
示例11: Update
void CUIGameLog::Update()
{
CUIScrollView::Update();
toDelList.clear();
// REMOVE ITEMS WITH COMPLETED ANIMATION
WINDOW_LIST_it end_it = m_pad->GetChildWndList().end();
WINDOW_LIST_it begin_it = m_pad->GetChildWndList().begin();
for(WINDOW_LIST_it it = begin_it; it!=end_it; ++it)
{
CUIStatic* pItem = smart_cast<CUIStatic*>(*it);
VERIFY(pItem);
pItem->Update();
if (pItem->IsClrAnimStoped())
toDelList.push_back(pItem);
}
// Delete elements
{
xr_vector<CUIWindow*>::iterator it;
for (it = toDelList.begin(); it != toDelList.end(); it++)
RemoveWindow(*it);
}
// REMOVE INVISIBLE AND PART VISIBLE ITEMS
if(m_flags.test (eNeedRecalc) )
RecalcSize ();
toDelList.clear();
Frect visible_rect;
GetAbsoluteRect(visible_rect);
for( WINDOW_LIST_it it = m_pad->GetChildWndList().begin();
m_pad->GetChildWndList().end()!=it;
++it)
{
Frect r;
(*it)->GetAbsoluteRect(r);
if(! (visible_rect.in(r.x1, r.y1) && visible_rect.in(r.x2, r.y1) && visible_rect.in(r.x1, r.y2) && visible_rect.in(r.x2, r.y2)))
{
toDelList.push_back(*it);
}
}
// Delete elements
{
xr_vector<CUIWindow*>::iterator it;
for (it = toDelList.begin(); it != toDelList.end(); it++)
RemoveWindow(*it);
}
if(m_flags.test (eNeedRecalc) )
RecalcSize ();
}
示例12: Init_StrInfoItem
void CUICharacterInfo::Init_StrInfoItem( CUIXml& xml_doc, LPCSTR item_str, UIItemType type )
{
if ( xml_doc.NavigateToNode( item_str, 0 ) )
{
CUIStatic* pItem = m_icons[type] = xr_new<CUIStatic>();
CUIXmlInit::InitStatic( xml_doc, item_str, 0, pItem );
AttachChild( pItem );
pItem->SetAutoDelete( true );
}
}
示例13: xr_sprintf
void CUIRankIndicator::InitFromXml(CUIXml& xml_doc)
{
CUIXmlInit::InitWindow(xml_doc, "rank_wnd", 0, this);
string256 str;
for(u8 i=0; i<max_rank;++i){
CUIStatic*& s = m_ranks[i];
s = xr_new<CUIStatic>();
xr_sprintf(str, "rank_wnd:rank_%d", i);
CUIXmlInit::InitStatic(xml_doc, str, 0, s);
}
CUIStatic* back = xr_new<CUIStatic>(); back->SetAutoDelete(true);
CUIXmlInit::InitStatic(xml_doc, "rank_wnd:background", 0, back);
AttachChild (back);
}
示例14: OnFocusLost
void CUIStatix::OnFocusLost()
{
CUIStatic::OnFocusLost ();
CUIStatic* child = smart_cast<CUIStatic* >(FindChild("auto_static_0"));
if(child)
child->SetTextureColor(0x00ffffff);
else
SetTextureColor(0xffffffff);
if (!IsEnabled())
{
SetTextureColor(0x80ffffff);
};
}
示例15: construct
void CUIArtefactDetectorElite::construct(CEliteDetector* p)
{
m_parent = p;
CUIXml uiXml;
uiXml.Load (CONFIG_PATH, UI_PATH, "ui_detector_artefact.xml");
CUIXmlInit xml_init;
string512 buff;
xr_strcpy (buff, p->ui_xml_tag());
xml_init.InitWindow (uiXml, buff, 0, this);
m_wrk_area = xr_new<CUIWindow>();
xr_sprintf (buff, "%s:wrk_area", p->ui_xml_tag());
xml_init.InitWindow (uiXml, buff, 0, m_wrk_area);
m_wrk_area->SetAutoDelete (true);
AttachChild (m_wrk_area);
xr_sprintf (buff, "%s", p->ui_xml_tag());
int num = uiXml.GetNodesNum (buff,0,"palette");
XML_NODE* pStoredRoot = uiXml.GetLocalRoot();
uiXml.SetLocalRoot (uiXml.NavigateToNode(buff,0));
for(int idx=0; idx<num;++idx)
{
CUIStatic* S = xr_new<CUIStatic>();
shared_str name = uiXml.ReadAttrib("palette",idx,"id");
m_palette[name] = S;
xml_init.InitStatic (uiXml, "palette", idx, S);
S->SetAutoDelete (true);
m_wrk_area->AttachChild (S);
S->SetCustomDraw (true);
}
uiXml.SetLocalRoot (pStoredRoot);
Fvector _map_attach_p = pSettings->r_fvector3(m_parent->cNameSect(), "ui_p");
Fvector _map_attach_r = pSettings->r_fvector3(m_parent->cNameSect(), "ui_r");
_map_attach_r.mul (PI/180.f);
m_map_attach_offset.setHPB (_map_attach_r.x, _map_attach_r.y, _map_attach_r.z);
m_map_attach_offset.translate_over (_map_attach_p);
}