本文整理汇总了C++中cOsd::Flush方法的典型用法代码示例。如果您正苦于以下问题:C++ cOsd::Flush方法的具体用法?C++ cOsd::Flush怎么用?C++ cOsd::Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cOsd
的用法示例。
在下文中一共展示了cOsd::Flush方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessKey
eOSState cLineGame::ProcessKey(eKeys Key)
{
eOSState state = cOsdObject::ProcessKey(Key);
if (state == osUnknown) {
const int d = 4;
switch (Key & ~k_Repeat) {
case kUp: y = max(0, y - d); break;
case kDown: y = min(osd->Height() - d, y + d); break;
case kLeft: x = max(0, x - d); break;
case kRight: x = min(osd->Width() - d, x + d); break;
case kRed: color = clrRed; break;
case kGreen: color = clrGreen; break;
case kYellow: color = clrYellow; break;
case kBlue: color = clrBlue; break;
case k1: DrawEllipses(osd);
return osContinue;
case k2: DrawSlopes(osd);
return osContinue;
case kBack:
case kOk: return osEnd;
default: return state;
}
osd->DrawRectangle(x, y, x + d - 1, y + d - 1, color);
osd->Flush();
state = osContinue;
}
return state;
}
示例2: Flush
void cSkinSTTNGDisplayChannel::Flush(void)
{
if (withInfo) {
if (!message) {
const cFont *font = cFont::GetFont(fontSml);
cString date = DayDateTime();
int w = font->Width(date);
osd->DrawText(x4 - w - 2, y7 - font->Height(date), date, Theme.Color(clrChannelDate), frameColor, font);
cDevice *Device = cDevice::PrimaryDevice();
const tTrackId *Track = Device->GetTrack(Device->GetCurrentAudioTrack());
if (!Track && *lastTrackId.description || Track && strcmp(lastTrackId.description, Track->description)) {
osd->DrawText(x3 + 2, y6, Track ? Track->description : "", Theme.Color(clrChannelName), frameColor, font, x4 - x3 - w - 4);
strn0cpy(lastTrackId.description, Track ? Track->description : "", sizeof(lastTrackId.description));
}
}
int seen = 0;
if (present) {
time_t t = time(NULL);
if (t > present->StartTime())
seen = min(y4 - y3 - 1, int((y4 - y3) * double(t - present->StartTime()) / present->Duration()));
}
if (seen != lastSeen) {
osd->DrawRectangle(x1 + Gap, y3, x1 + Gap + ScrollWidth - 1, y4 - 1, Theme.Color(clrChannelTimebarRest));
if (seen)
osd->DrawRectangle(x1 + Gap, y3, x1 + Gap + ScrollWidth - 1, y3 + seen, Theme.Color(clrChannelTimebarSeen));
lastSeen = seen;
}
}
osd->Flush();
}
示例3: Flush
void cSkinCursesDisplayChannel::Flush(void)
{
if (!message) {
cString date = DayDateTime();
osd->DrawText(ScOsdWidth - Utf8StrLen(date), 0, date, clrWhite, clrBackground, &Font);
}
osd->Flush();
}
示例4: Show
void cLineGame::Show(void)
{
osd = cOsdProvider::NewOsd(100, 50, 50);
if (osd) {
tArea Area = { 0, 0, 99, 199, 4 };
osd->SetAreas(&Area, 1);
osd->DrawRectangle(0, 0, 99, 199, clrGray50);
osd->Flush();
}
}
示例5: Show
void cTrueColorDemo::Show(void)
{
osd = cOsdProvider::NewOsd(cOsd::OsdLeft(), cOsd::OsdTop());
if (osd) {
if (SetArea()) {
osd->DrawRectangle(0, 0, osd->Width() - 1, osd->Height() - 1, clrGray50);
osd->Flush();
Start();
}
}
}
示例6: Flush
void cSkinClassicDisplayMenu::Flush(void)
{
cString date = DayDateTime();
if (!*lastDate || strcmp(date, lastDate)) {
const cFont *font = cFont::GetFont(fontOsd);
int w = font->Width(date);
osd->DrawText(x3 - w - TextFrame, y0, date, Theme.Color(clrMenuDate), Theme.Color(clrMenuTitleBg), font, w);
lastDate = date;
dateWidth = max(w + TextFrame, dateWidth);
}
osd->Flush();
}
示例7: ProcessKey
eOSState cLineGame::ProcessKey(eKeys Key)
{
eOSState state = cOsdObject::ProcessKey(Key);
if (state == osUnknown) {
switch (Key & ~k_Repeat) {
case kUp: if (y > 0) y--; break;
case kDown: if (y < 196) y++; break;
case kLeft: if (x > 0) x--; break;
case kRight: if (x < 96) x++; break;
case kRed: color = clrRed; break;
case kGreen: color = clrGreen; break;
case kYellow: color = clrYellow; break;
case kBlue: color = clrBlue; break;
case kOk: return osEnd;
default: return state;
}
osd->DrawRectangle(x, y, x + 3, y + 3, color);
osd->Flush();
state = osContinue;
}
return state;
}
示例8: Flush
void cSkinCursesDisplayMenu::Flush(void)
{
cString date = DayDateTime();
osd->DrawText(ScOsdWidth - Utf8StrLen(date) - 2, 0, date, clrBlack, clrCyan, &Font);
osd->Flush();
}
示例9: Action
//.........这里部分代码省略.........
MoveEnd.Set(osd->Width() - MovePixmap->ViewPort().Width(), osd->Height() - MovePixmap->ViewPort().Height());
Start = cTimeMs::Now();
}
State++;
}
break;
case 6: {
TilePixmap = CreateTextPixmap("Tiled Pixmaps", StartLine, 1, clrRed, clrWhite);
if (TilePixmap) {
TilePixmap->SetViewPort(TilePixmap->ViewPort().Grown(TilePixmap->DrawPort().Width(), TilePixmap->DrawPort().Height()));
TilePixmap->SetAlpha(200);
TilePixmap->SetTile(true);
TileStart = TilePixmap->DrawPort().Point();
TileEnd = TileStart.Shifted(TilePixmap->ViewPort().Width(), TilePixmap->ViewPort().Height());
MovePixmap = TilePixmap;
MoveStart = MovePixmap->ViewPort().Point();
MoveEnd.Set(10, osd->Height() - MovePixmap->ViewPort().Height() - 10);
Start = cTimeMs::Now();
}
State++;
}
break;
case 7: {
const cFont *Font = cFont::GetFont(fontOsd);
const char *Text = "Scrolling Pixmaps";
int w = Font->Width(Text);
int h = Font->Height();
if (cPixmap *Pixmap = osd->CreatePixmap(2, cRect((osd->Width() - w) / 2, StartLine, w, 2 * h), cRect(0, 0, w, 3 * h))) {
Pixmap->Clear();
Pixmap->DrawText(cPoint(0, 0), Text, clrYellow, clrTransparent, Font);
cString s = cString::sprintf("Line %d", ++ScrollLineNumber);
Pixmap->DrawText(cPoint(0, Pixmap->ViewPort().Height()), s, clrYellow, clrTransparent, Font);
ScrollPixmap = Pixmap;
ScrollStart.Set(0, 0);
ScrollEnd.Set(0, -h);
Start = cTimeMs::Now();
}
State++;
}
break;
case 8: {
const cFont *Font = cFont::GetFont(fontSml);
const char *Text = "Animation";
const int Size = Font->Width(Text) + 10;
const int NumDots = 12;
const int AnimFrames = NumDots;
// Temporarily using pixmap layer 0 to have the text alpha blended:
AnimPixmap = osd->CreatePixmap(0, cRect((osd->Width() - Size) / 2, StartLine, Size, Size), cRect(0, 0, Size, Size * AnimFrames));
if (AnimPixmap) {
AnimPixmap->SetAlpha(0);
AnimPixmap->Clear();
const int Diameter = Size / 5;
int xc = Size / 2 - Diameter / 2;
for (int Frame = 0; Frame < AnimFrames; Frame++) {
AnimPixmap->DrawEllipse(cRect(0, Frame * Size, Size, Size), 0xDDFFFFFF);
int yc = Frame * Size + Size / 2 - Diameter / 2;
int Color = 0xFF;
int Delta = Color / NumDots / 3;
for (int a = 0; a < NumDots; a++) {
double t = 2 * M_PI * (Frame + a) / NumDots;
int x = xc + ((Size - Diameter) / 2 - 5) * cos(t);
int y = yc + ((Size - Diameter) / 2 - 5) * sin(t);
AnimPixmap->DrawEllipse(cRect(x, y, Diameter, Diameter), ArgbToColor(0xFF, Color, Color, Color));
Color -= Delta;
}
AnimPixmap->DrawText(cPoint(0, Frame * Size), Text, clrBlack, clrTransparent, cFont::GetFont(fontSml), Size, Size, taCenter);
}
AnimPixmap->SetLayer(3); // now setting the actual pixmap layer
FadeInPixmap = AnimPixmap;
LOCK_THREAD;
OldCursor = cursor = AnimPixmap->ViewPort().Point();
cursorLimits.Set(0, 0, osd->Width(), osd->Height());
cursorLimits.SetRight(cursorLimits.Right() - Size);
cursorLimits.SetBottom(cursorLimits.Bottom() - Size);
cursorLimits.Grow(-10, -10);
Start = cTimeMs::Now();
}
State++;
}
break;
case 9: {
LOCK_THREAD;
if (cursor != OldCursor) {
MovePixmap = AnimPixmap;
MoveStart = MovePixmap->ViewPort().Point();
MoveEnd = OldCursor = cursor;
MoveTime = 500;
Start = cTimeMs::Now();
}
}
break;
}
}
osd->Flush();
cPixmap::Unlock();
int Delta = cTimeMs::Now() - Now;
if (Delta < FrameTime)
cCondWait::SleepMs(FrameTime - Delta);
}
}