本文整理汇总了C++中FontManager类的典型用法代码示例。如果您正苦于以下问题:C++ FontManager类的具体用法?C++ FontManager怎么用?C++ FontManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FontManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char * argv[])
{
unsigned int width = 1024;
unsigned int height = 768;
bool fullscreen = false;
BCIInterface * bciinterface = new BCIInterface(width, height);
FontManager fm;
FPSCounter fps_c(fm.GetDefaultFont());
UDPReceiver * receiver = new UDPReceiver(2222);
TrainingInterpreter * interpreter = new TrainingInterpreter(width, height);
bciinterface->SetCommandReceiver(receiver);
bciinterface->SetCommandInterpreter(interpreter);
bciinterface->AddObject(new SSVEPStimulus(6, 60, (float)width/2, 100, 200,200, 255, 0, 0, 255));
bciinterface->AddObject(new SSVEPStimulus(8, 60, (float)width-100, (float)height/2, 200, 200, 255, 0, 0, 255));
bciinterface->AddObject(new SSVEPStimulus(10, 60, (float)width/2, (float)height-100, 200, 200, 255, 0, 0, 255));
bciinterface->AddObject(new SSVEPStimulus(9, 60, 100, (float)height/2,200, 200, 255, 0, 0, 255));
bciinterface->AddObject(new SSVEPStimulus(14, 60, (float)width/2, (float)height/2, 200, 200, 255, 0, 0, 255));
bciinterface->AddNonOwnedObject(&fps_c);
int cmd = -1;
bciinterface->DisplayLoop(fullscreen);
delete bciinterface;
delete interpreter;
delete receiver;
return 0;
}
示例2: DisplayProfile
void DisplayProfile(sf::RenderWindow * renderWindow, CProfileIterator * iter, int x, int & y)
{
if (!renderWindow) return;
FontManager * fontManager = FontManager::Get();
y += 15;
while ( !iter->Is_Done() )
{
sf::Text text("", *fontManager->GetFont(""));
text.setCharacterSize(12);
ostringstream texte;
if ( CProfileManager::Get_Frame_Count_Since_Reset() != 0 )
texte << fixed << iter->Get_Current_Name() << " Calls/Frame:" << iter->Get_Current_Total_Calls()/CProfileManager::Get_Frame_Count_Since_Reset()
<< " Time/Frame:" << iter->Get_Current_Total_Time()/CProfileManager::Get_Frame_Count_Since_Reset()
<< " %Time/Parent " << iter->Get_Current_Total_Time()/iter->Get_Current_Parent_Total_Time()*100.0f;
text.setString(texte.str());
text.setPosition(x,y);
renderWindow->draw(text);
//Childs
CProfileIterator * childIter = CProfileManager::Get_Iterator();
*childIter = *iter;
childIter->Enter_Child(0);
DisplayProfile(renderWindow, childIter, x+15, y);
CProfileManager::Release_Iterator(childIter);
y += 15;
iter->Next();
}
}
示例3: gear_start_app
static int gear_start_app(struct engine* engine)
{
monoWrapper::loadMonoModules();
monoWrapper::reInitMono();
if(monoWrapper::mono_engine_test_function_for_mono()!=200)
{
LOGE("monoWrapper::mono_engine_test_function_for_mono expected to return 200");
}
else
{
LOGI("monoWrapper::mono_engine_test_function_for_mono returned 200");
}
printf("hello hello");
monoWrapper::mono_engine_init(1);
monoWrapper::mono_engine_init_for_mono_android();
monoWrapper::mono_engine_resize(monoWrapper::mono_engine_getWorld(0), 0, 0, engine->width, engine->height, 10.0f, 100000.0f);
HWShaderManager* hwmanager = engine_getHWShaderManager();
hwmanager->Init();
g_cFontManager.init();
g_cFontManager.setRenderer(monoWrapper::mono_engine_getWorld(0)->getRenderer());
g_pFontPtr=g_cFontManager.loadFont("//storage//emulated//0//gear//fonts//arial_iphone10_84.ecf");
monoWrapper::mono_game_start();
return 0;
}
示例4: Render
void CGameOverState::Render( void )
{
CSGD_Direct3D* pD3D = CSGD_Direct3D::GetInstance();
FontManager* pFont = CGame::GetInstance()->GetFont();
pD3D->Clear(WHITE);
if(m_bWin)
{
if(m_nLevel_Finished == 4)
{
CSGD_TextureManager::GetInstance()->Draw(m_nWindBGid, 0, 0);
pFont->Draw( ARNOVA , FINAL_LEVEL_WIN, 55, 250,
1.3f, 1.3f, WHITE);
}
else
{
CSGD_TextureManager::GetInstance()->Draw(m_nWindBGid, 0, 0);
pFont->Draw( ARNOVA , GAME_WIN, 55, 250,
1.3f, 1.3f, WHITE);
}
}
else
{
CSGD_TextureManager::GetInstance()->Draw(m_nLoseBGid, 0,0);
pFont->Draw( ARNOVA , GAME_LOSE, 240, 100,
1.5f,1.5f, WHITE);
}
pFont->Draw( ARNOVA , STATE_EXIT, 55, 500);
CSGD_TextureManager::GetInstance()->Draw(m_nCursorImg, m_nCursorX, m_nCursorY);
}
示例5: TestFontManager
void TestFontManager()
{
FontManager fm;
fm.LoadLib("../../Data/Test/calibri.ttf");
fm.ChangeFontSize(64);
auto quads = fm.AcquireText("FuckYou");
quads.Count();
}
示例6: BMessage
// PopulateMenu
void
FontValueView::_PolulateMenu(BMenu* menu, BHandler* target,
const char* markedFamily,
const char* markedStyle)
{
if (!menu)
return;
FontManager* manager = FontManager::Default();
if (!manager->Lock())
return;
BMenu* fontMenu = NULL;
font_family family;
font_style style;
int32 count = manager->CountFontFiles();
for (int32 i = 0; i < count; i++) {
if (!manager->GetFontAt(i, family, style))
break;
BMessage* message = new BMessage(MSG_FONT_CHANGED);
message->AddString("font family", family);
message->AddString("font style", style);
FontMenuItem* item = new FontMenuItem(style, family, style,
message);
item->SetTarget(target);
bool markStyle = false;
if (!fontMenu
|| (fontMenu->Name()
&& strcmp(fontMenu->Name(), family) != 0)) {
// create new entry
fontMenu = new BMenu(family);
fontMenu->AddItem(item);
menu->AddItem(fontMenu);
// mark the menu if necessary
if (markedFamily && strcmp(markedFamily, family) == 0) {
if (BMenuItem* superItem = fontMenu->Superitem())
superItem->SetMarked(true);
markStyle = true;
}
} else {
// reuse old entry
fontMenu->AddItem(item);
}
// mark the item if necessary
if (markStyle && markedStyle && strcmp(markedStyle, style) == 0)
item->SetMarked(true);
}
manager->Unlock();
}
示例7: drawStrings
void Sprite::drawStrings(const FontManager::TextList &strings, const FontManager &fontManager,
int x, int y, uint32 color) {
for (FontManager::TextList::const_iterator it = strings.begin(); it != strings.end(); ++it) {
fontManager.drawText(_surfaceTrueColor, *it, x, y, color);
y += fontManager.getFontHeight();
}
updateTransparencyMap();
}
示例8: mText
Label::Label(const std::string& text, sf::Color color, unsigned int size, FontManager& fontManager) :
mText(text, fontManager.get(FontID::Main), size) {
mText.setColor(color);
sf::FloatRect bounds = mText.getGlobalBounds();
mText.setOrigin(bounds.width/2, bounds.height/2);
}
示例9: init
void HUD::init(const sf::Texture &healthBar, const sf::Texture &healthBarBackground, const std::vector<Entity*> *players, FontManager &fontManager, int mode)
{
scoreText.setFont(*fontManager.getResource("Config/Content/Fonts/calibri.ttf"));
scoreText.setPosition(20,40);
scoreText.setColor(sf::Color::Black);
this->mode = mode;
for(unsigned int i = 0; i < players->size(); i++)
{
Player *playerPtr = dynamic_cast<Player*>(players->at(i)) ;
if(playerPtr != NULL)
{
this->players.push_back(playerPtr);
healthRecs.push_back(HealthBars(sf::RectangleShape(sf::Vector2f((float)healthBar.getSize().x, (float)healthBar.getSize().y)),
sf::RectangleShape(sf::Vector2f((float)healthBarBackground.getSize().x, (float)healthBarBackground.getSize().y))));
healthRecs.at(i).healthBar.setTexture(&healthBar);
healthRecs.at(i).healthBarBackground.setTexture(&healthBarBackground);
//hardcoded
healthRecs.at(i).healthBar.setPosition(15, 15);
healthRecs.at(i).healthBarBackground.setPosition(10, 10);
/*healthRecs.push_back(sf::RectangleShape(this->players->at(i)->getPlayerBars().health.getSize()));
healthRecs.at(i).setTexture(this->players->at(i)->getPlayerBars().health.getTexture());
healthRecs.at(i).setTextureRect(this->players->at(i)->getPlayerBars().health.getTextureRect());*/
}
}
pClock.restart();
}
示例10: m_text
BasicButton::BasicButton(string text, int fontSize, Vector position, int width, int height) :
m_text(text), m_width(width), m_height(height), m_selected(false), m_enabled(false), m_activated(true), m_position(position) {
// create text surface
FontManager fontManager;
string font = "res/tahoma.ttf";
m_pTextSurface = fontManager.getTextSurface(font, m_text, fontSize);
// check dimensions of font surface to make sure they do not overflow the button size
VideoManager* pVideoManager = Locator::videoManager;
int fontWidth = pVideoManager->getSurfaceWidth(m_pTextSurface);
int fontHeight = pVideoManager->getSurfaceHeight(m_pTextSurface);
if(fontWidth > m_width || fontHeight > m_height){
Locator::logger->log("font exceeds button size", Logger::CWARNING);
}
}
示例11: ApplyTextStyle
void GUI_Element::ApplyTextStyle(){
FontManager* fonts = m_owner->GetManager()->GetContext()->m_fontManager;
const GUI_Style& CurrentStyle = m_style[m_state];
if (CurrentStyle.m_textFont != ""){
m_visual.m_text.setFont(*fonts->GetResource(CurrentStyle.m_textFont));
m_visual.m_text.setColor(CurrentStyle.m_textColor);
m_visual.m_text.setCharacterSize(CurrentStyle.m_textSize);
if (CurrentStyle.m_textCenterOrigin){
sf::FloatRect rect = m_visual.m_text.getLocalBounds();
m_visual.m_text.setOrigin(rect.left + rect.width / 2.0f,
rect.top + rect.height / 2.0f);
} else {
m_visual.m_text.setOrigin(0.f, 0.f);
}
}
m_visual.m_text.setPosition(m_position + CurrentStyle.m_textPadding);
}
示例12: GetApplication
BOOL ATMFontMan::CacheNamedFont(String_64* pFontName)
{
CDC Screen; // and create a new one
if (Screen.CreateIC(TEXT("DISPLAY"), 0, 0, 0))
{
FontManager* pFontMan = GetApplication()->GetFontManager();
ERROR2IF(pFontMan == NULL,FALSE,"NULL FontManager ptr");
pFontMan->ClearTempFont();
EnumFontFamilies(Screen.m_hDC,
NULL,
(FONTENUMPROC) ATMFontMan_CallBackCacheNamedFont,
(LPARAM)pFontName);
Screen.DeleteDC();
return pFontMan->TempFontValid();
}
return FALSE;
}
示例13: ATMFontMan_CallBackValidateFont
INT32 APIENTRY ATMFontMan_CallBackValidateFont(
ENUMLOGFONT FAR* lpelf, // address of logical-font data
NEWTEXTMETRIC FAR* lpntm, // address of physical-font data
INT32 FontType, // type of font
LPARAM lParam // address of application-defined data
)
{
UNREFERENCED_PARAMETER (lpntm);
if (FontType & DEVICE_FONTTYPE)
{
String_64 FontName(lpelf->elfLogFont.lfFaceName);
FontManager* pFontMan = GetApplication()->GetFontManager();
pFontMan->ValidateItem(FC_ATM, &FontName, lpelf);
}
return TRUE;
}
示例14: Render
void CPopUp_SPGain::Render()
{
CCamera* Game_Camera = CCamera::GetInstance();
FontManager* pFont = CGame::GetInstance()->GetFont();
CSGD_TextureManager* pTM = CSGD_TextureManager::GetInstance();
int x = int(GetPosX() - Game_Camera->GetPosX());
int y = int(GetPosY() - Game_Camera->GetPosY());
CPopUp::Render();
AnimationManager::GetInstance()->Render( (float)(x + 75), (float)(y + 101),
CEntity::IsFlipped(), *GetAnimInfo(), m_dwRenderColor);
pFont->Draw(
CHINESE_TAKEAWAY, L"Attack the enemy \n to build your special meter",
x+48, y+44, 0.4f, 0.4f, BLACK
);
}
示例15: GetEntity
void TextShape::OnInit()
{
FontManager* fontmanager = GetEntity()->GetKernel()->GetLayer(Layer::s_LayerManager)->GetRootEntity()->GetComponent<FontManager>();
m_font = fontmanager->Get(m_fontType);
assert(m_font);
// push good texture to material
GLRender* render = GetEntity()->GetComponent<GLRender>();
assert(render);
// helper because a font texture does not exists on the disk
Material* material = static_cast<Material*>(GetEntity()->GetComponentByType(render->m_materialType));
assert(material);
material->SetMainTexture(m_font->m_texture);
SetText(m_text);
m_isDirty = true;
}