本文整理汇总了C++中CConsole::SetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CConsole::SetSize方法的具体用法?C++ CConsole::SetSize怎么用?C++ CConsole::SetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConsole
的用法示例。
在下文中一共展示了CConsole::SetSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ApplyConsoleSettings
void CCore::ApplyConsoleSettings ( void )
{
CVector2D vec;
CConsole * pConsole = m_pLocalGUI->GetConsole ();
CVARS_GET ( "console_pos", vec );
pConsole->SetPosition ( vec );
CVARS_GET ( "console_size", vec );
pConsole->SetSize ( vec );
}
示例2: Play
void Play(const char* path, ColorType colorType)
{
CConsole::SetTitle("准备播放:%s", path);
CFFMpeg cff(path);
cff.InitVideo();
cff.InitAudio();
int inWidth = 0, inHeight = 0;
cff.GetInSize(inWidth, inHeight);
if (!inWidth || !inHeight)return;
COORD cr;
CConsole c;
if (!c.GetSize().X || !c.GetSize().Y)return;
if (inWidth + CConsole::m_DEFAULT_FONT_COORD.X - 1 <= c.GetSize().X*CConsole::m_DEFAULT_FONT_COORD.X&&
inHeight + CConsole::m_DEFAULT_FONT_COORD.Y - 1 <= c.GetSize().Y*CConsole::m_DEFAULT_FONT_COORD.Y)
{
cr.X = (inWidth + CConsole::m_DEFAULT_FONT_COORD.X - 1) / CConsole::m_DEFAULT_FONT_COORD.X;
cr.Y = (inHeight + CConsole::m_DEFAULT_FONT_COORD.Y - 1) / CConsole::m_DEFAULT_FONT_COORD.Y;
}
else
{
double bd = double(inWidth) / inHeight,
cd = double(c.GetSize().X*CConsole::m_DEFAULT_FONT_COORD.X) / c.GetSize().Y / CConsole::m_DEFAULT_FONT_COORD.Y;
if (bd <= cd)
{
cr.Y = c.GetSize().Y;
cr.X = SHORT(c.GetSize().Y*CConsole::m_DEFAULT_FONT_COORD.Y*bd / CConsole::m_DEFAULT_FONT_COORD.X);
}
else
{
cr.X = c.GetSize().X;
cr.Y = SHORT(c.GetSize().X*CConsole::m_DEFAULT_FONT_COORD.X / bd / CConsole::m_DEFAULT_FONT_COORD.Y);
}
}
c.SetSize(cr);
cff.SetOutSize(cr.X, cr.Y);
if (ColorType::MONO == colorType)
for (int i = 0, j = 0; i < 0x1000000; i += 0x111111, ++j)
colorTable[j] = i;
c.SetColorTable(colorTable);
bool bWaveStart = false, bVideoStart = false;
auto closeHandle = [](HANDLE p) {CloseHandle(p); };
unique_ptr<void, decltype(closeHandle)> hStartEvent(CreateEvent(nullptr, FALSE, FALSE, nullptr), closeHandle);
HANDLE hStartEvent_ = hStartEvent.get();
CAudio audio((WORD)cff.GetChannels(), (DWORD)cff.GetSampleRate(), (WORD)cff.GetBitsPerSample(), bWaveStart, bVideoStart, hStartEvent_);
CVideo video(c, (DWORD)cff.GetDuration(), colorType, bWaveStart, bVideoStart, hStartEvent.get(), path, colorTable);
bool bForce = cff.ReadFrames([](CFFMpeg::StreamType type, uint8_t * data, int len, int64_t ts, CAudio& audio, CVideo& video)
{
if (_kbhit() && 0x1b == _getch())return true;
switch (type)
{
case CFFMpeg::StreamType::AUDIO:
audio.Push(data, len);
break;
case CFFMpeg::StreamType::VIDEO:
video.Push(data, len, ts);
break;
}
return false;
}, audio, video);
audio.Stop(bForce);
video.Stop(bForce);
}