本文整理汇总了C++中CFont::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ CFont::Load方法的具体用法?C++ CFont::Load怎么用?C++ CFont::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFont
的用法示例。
在下文中一共展示了CFont::Load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindFont
CFont* FindFont(const char* name)
{
// check for loaded font
for (int i = 0; i < fontCount; i++)
if (!stricmp(fontArray[i].Name, name))
return &fontArray[i];
// load a new font
assert(fontCount < MAX_FONTS);
CFont *font = &fontArray[fontCount];
if (font->Load(name))
{
fontCount++;
return font;
}
return gl_consoleFont; // fallback
}
示例2: main
int main(int argc, char* argv[])
{
bool show_console = 0;
bool done = 0;
int tickCounter = 0;
int gServer = 0;
CSocketServer server;
CSocketClient client;
CFont font;
if(argc != 2)
{
printf("usage: mecha server|hostname\n");
return 1;
}
gameInit();
CLog::Get().Init();
initEngine();
font.Load("font_big.png");
if(strcmp(argv[1], "server") == 0)
{
gServer = 1;
}
clientInit();
if(gServer)
{
if(!server.Listen(4444))
{
CLog::Get().Write(APP_LOG, LOG_ERROR, "Listen failed");
done = 1;
}
if(!client.Connect("localhost", 4444))
{
CLog::Get().Write(APP_LOG, LOG_ERROR, "Connection failed");
done = 1;
}
}
else
{
if(!client.Connect(argv[1], 4444))
{
CLog::Get().Write(APP_LOG, LOG_ERROR, "Connection failed");
done = 1;
}
}
while(!done)
{
timerUpdate();
tickCounter += timerGetDiff();
if(show_console)
{
if(inpKeyPressed(GLFW_KEY_PAGEUP)) CConsole::ScrollUp();
if(inpKeyPressed(GLFW_KEY_PAGEDOWN)) CConsole::ScrollDown();
}
if(inpKeyPressed(GLFW_KEY_F1)) show_console = !show_console;
if(inpKeyPressed(GLFW_KEY_ESC)) break;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT| GL_STENCIL_BUFFER_BIT);
glLoadIdentity();
videoSetPerspective();
glColor3f(1.0f, 1.0f, 1.0f);
if(gServer)
server.Tick();
client.Tick();
// if(client.IsConnected())
// clientTick();
gfxBlendNormal();
if(client.IsConnected())
clientRender(client.GetPreviousSnap(), client.GetCurrentSnap(), client.GetInterpolation());
gfxSetColor(0.5f, 0.5f, 0.5f, 1.0f);
videoSetOrtho(800, 600);
font.Draw(10, 10, "FPS: %f", timerGetFPS());
font.Draw(10, 25, "Ping: %d", client.m_Ping);
font.Draw(10, 40, "Snapshot size: %d b", client.GetSnapSize());
font.Draw(10, 55, "Num objects: %d", client.GetSnapNumObjects());
videoSetPerspective();
CConsole::Draw(show_console || !client.IsConnected());
inpUpdate();
//.........这里部分代码省略.........
示例3: hwMainFunc
int hwMainFunc(void* userData)
{
CGrf* bootSplash = new CGrf();
if (!bootSplash)
return ERR_NOMEM;
if (!bootSplash->Load(GUI_ASSET_DIR "/bootsplash.grf"))
{
delete bootSplash;
return ERR_NOLOAD;
}
setBrightness(3, -16);
videoSetMode(MODE_3_2D);
int bg = bgInit(2, BgType_Text8bpp, BgSize_T_256x256, 0, 1);
dmaCopy(bootSplash->gfxData, bgGetGfxPtr(bg), MemChunk_GetSize(bootSplash->gfxData));
dmaCopy(bootSplash->mapData, bgGetMapPtr(bg), MemChunk_GetSize(bootSplash->mapData));
dmaCopy(bootSplash->palData, BG_PALETTE, MemChunk_GetSize(bootSplash->palData));
delete bootSplash;
LoadApps();
if (!g_appCount) return ERR_NOAPPS;
LoadFileTypes();
if (!(background.Load(GUI_ASSET_DIR "/background.grf") &&
dummy.Load(GUI_ASSET_DIR "/dummy.grf") &&
selection.Load(GUI_ASSET_DIR "/selection.grf") &&
topscr.Load(GUI_ASSET_DIR "/topscr.grf") &&
defappicon.Load(GUI_ASSET_DIR "/dummyapp.grf") &&
fiGenericFile.Load(GUI_ASSET_DIR "/genericfile.grf") &&
fiConflictFile.Load(GUI_ASSET_DIR "/conflictfile.grf") &&
font.Load("tahoma", 10)))
return ERR_NOLOAD;
for (int q = 0; q < 92; q ++)
{
if (q < 16)
setBrightness(3, q-16);
if (q >= (92-16-1))
setBrightness(3, q-(92-16-1));
if (keysDown()) break;
swiWaitForVBlank();
scanKeys();
}
setBrightness(3, 0);
swiWaitForVBlank();
DSVideoReset();
videoInit();
EnableGuiMon();
for (;;)
{
swiWaitForVBlank();
scanKeys();
oamUpdate(&oamMain);
oamUpdate(&oamSub);
bgUpdate();
if (g_curApp)
RunAppVBlank();
else if (!MainVBlank())
break;
RunBgProcess();
}
DisableGuiMon();
return 0;
}