本文整理汇总了C++中CDisplay::ReleaseFrontBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CDisplay::ReleaseFrontBuffer方法的具体用法?C++ CDisplay::ReleaseFrontBuffer怎么用?C++ CDisplay::ReleaseFrontBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDisplay
的用法示例。
在下文中一共展示了CDisplay::ReleaseFrontBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Go
bool CGUI::Go()
{
bool Fullscreen;
/* restrict display */
CDisplay *Disp = (CDisplay *)PPool->GetWellDefinedComponent(COMPONENT_DISPLAY);
SDL_Surface *Front;
/* map resources, installing palette, etc */
/* get screen dimensions, generate two intermediate buffers */
int ScrW, ScrH;
Disp->IOCtl(DISPIOCTL_GETDBUF, this, 0);
Front = Disp->GetFrontBuffer();
ScrW = Front->w; ScrH = Front->h;
Fullscreen = (Front->flags&SDL_FULLSCREEN) ? true : false;
Disp->ReleaseFrontBuffer();
StaticBuffer = OptimalSurface(ScrW, ScrH);
MapResources();
// prepare display
SDL_Rect WholeDisplay;
WholeDisplay.x = WholeDisplay.y = 0;
WholeDisplay.w = ScrW; WholeDisplay.h = ScrH;
GUIObject = new CGUIMainDlg(*this, StaticBuffer, WholeDisplay);
MessagesPending = 0;
MessageQueue = new CGUIMessage[16];
int MouseX, MouseY, BState;
BState = SDL_GetMouseState(&MouseX, &MouseY);
QMessage = false;
Quit = false;
bool HaveMouse = true;
while(!Quit)
{
// refresh buffer bwith all static elements
Front = Disp->GetFrontBuffer();
SDL_BlitSurface(StaticBuffer, NULL, Front, NULL);
// get mouse state
int NewMouseX, NewMouseY, NewBState;
NewBState = SDL_GetMouseState(&NewMouseX, &NewMouseY);
// draw display
CGUIMessage DrawMessage;
DrawMessage.Type = CGUIMessage::DRAW;
DrawMessage.PositionX = 0; DrawMessage.PositionY = 0;
DrawMessage.Data.Draw.Target = Front;
GUIObject->Message(&DrawMessage);
// add cursor if necessary
if( (SDL_ShowCursor(SDL_QUERY) != SDL_ENABLE) &&
((SDL_GetAppState()&SDL_APPMOUSEFOCUS) || Fullscreen))
AddGraphic(Front, GFX_CURSOR, NewMouseX, NewMouseY);
// communicate mouse movements
CGUIMessage MouseMessage;
MouseMessage.PositionX = NewMouseX;
MouseMessage.PositionY = NewMouseY;
MouseMessage.Buttons = NewBState;
MouseMessage.Data.Mouse.DeltaX = NewMouseX - MouseX;
MouseMessage.Data.Mouse.DeltaY = NewMouseY - MouseY;
MouseMessage.Type = CGUIMessage::MOUSEOVER;
GUIObject->Message(&MouseMessage);
MouseX = NewMouseX; MouseY = NewMouseY;
// communicate button changes
NewBState ^= BState; BState ^= NewBState;
if(NewBState)
{
MouseMessage.Type = CGUIMessage::BUTTONS;
MouseMessage.Data.Button.Changes = NewBState;
GUIObject->Message(&MouseMessage);
}
// blit display, check it hasn't changed
// SDL_BlitSurface(DisplayBuffer, NULL, Front, NULL);
SDL_UpdateRect(Front, 0, 0, 0,0);
Disp->ReleaseFrontBuffer();
Disp->IOCtl(DISPIOCTL_FLIP, NULL, 0);
// pump events
SDL_PumpEvents();
// post any pending messages
while(MessagesPending--)
GUIObject->Message(&MessageQueue[MessagesPending]);
MessagesPending = 0;
// get latest interesting keys, etc
((CULA *)(PPool->GetWellDefinedComponent(COMPONENT_ULA)))->UpdateKeyTable();
SDL_Event ev;
while(SDL_PollEvent(&ev))
//.........这里部分代码省略.........