本文整理汇总了C++中CBuffer::CreateDoubleBuffering方法的典型用法代码示例。如果您正苦于以下问题:C++ CBuffer::CreateDoubleBuffering方法的具体用法?C++ CBuffer::CreateDoubleBuffering怎么用?C++ CBuffer::CreateDoubleBuffering使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBuffer
的用法示例。
在下文中一共展示了CBuffer::CreateDoubleBuffering方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void Init(HWND hWnd)
{
// Set our global window handle to our main window
g_hWnd = hWnd;
// Create our double buffering for each window
g_Buffer.CreateDoubleBuffering(hWnd);
g_ToolBuffer.CreateDoubleBuffering(g_hWndTool);
// Set the map to default
g_Map.SetDefault();
// Load the tiles into the global lists and then get the scroll bar max scroll position
g_ScrollInfo.nMax = LoadTiles();
// By default set the current tile type to map tiles
g_Map.SetCurrentType(TILE_TYPE);
// Set our current map to .... our current map :)
g_pCurrentMap = &g_Map;
// Initialize the scroll bar information
g_ScrollInfo.cbSize = sizeof(SCROLLINFO);
g_ScrollInfo.nMin = 0;
g_ScrollInfo.nPage = 1;
g_ScrollInfo.fMask = SIF_PAGE | SIF_RANGE;
SetScrollInfo(g_hWndTool, SB_VERT, &g_ScrollInfo, FALSE);
//////////// *** NEW *** ////////// *** NEW *** ///////////// *** NEW *** ////////////////////
// Here we initialize our open file information
g_OpenInfo.lStructSize = sizeof(OPENFILENAME); // Set the size of the structure
g_OpenInfo.nMaxFile = MAX_PATH; // Set the max characters for a file name
g_OpenInfo.lpstrFile = g_szFileName; // Give a string to store the file name
g_OpenInfo.lpstrFilter = "Map Files (*.map)\0*.map"; // Only accept .map files to load
g_OpenInfo.hwndOwner = g_hWndTool; // Assign the window owner and give it desired flags
g_OpenInfo.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR;
//////////// *** NEW *** ////////// *** NEW *** ///////////// *** NEW *** ////////////////////
// Here we set the current pen to red for drawing our exit rectangles
g_Buffer.SetPen(PS_SOLID,2,RGB(255,0,0));
// Set the backbuffer to black first (This clears the backbuffer)
g_Buffer.ClearScreen(BLACK_BRUSH);
g_ToolBuffer.ClearScreen(BLACK_BRUSH);
}
示例2: Init
void Init(HWND hWnd)
{
// Set our global window handle to our main window
g_hWnd = hWnd;
// Create our double buffering our window
g_Buffer.CreateDoubleBuffering(hWnd);
// This is where we create the image of our character
HBITMAP hPlayerImage = g_Buffer.LoadABitmap((LPSTR)kPlayerImage);
// Initialize our player with it's image and position
g_Player.Init(hPlayerImage, kPlayerStartX, kPlayerStartY);
// Init, load and draw the first map file
g_Map.Load(kStartMap);
g_Map.SetDrawFlag(true);
// Here we load then play the starting background music
if(!g_Music.Init("techno.mod"))
exit(0);
g_Music.PlaySong();
// we need to seed our random number generator (rand()) for moving npcs.
srand(GetTickCount());
// Set the backbuffer to black first (This clears the backbuffer)
g_Buffer.ClearScreen(BLACK_BRUSH);
}
示例3: Init
void Init(HWND hWnd)
{
// Set our global window handle to our main window
g_hWnd = hWnd;
// Create our double buffering for each window
g_Buffer.CreateDoubleBuffering(hWnd);
g_ToolBuffer.CreateDoubleBuffering(g_hWndTool);
// Set the map to default
g_Map.SetDefault();
// Load the tiles into the global lists and then get the scroll bar max scroll position
g_ScrollInfo.nMax = LoadTiles();
// By default set the current tile type to map tiles
g_Map.SetCurrentType(TILE_TYPE);
// Set our current map to .... our current map :)
g_pCurrentMap = &g_Map;
// Initialize the scroll bar information
g_ScrollInfo.cbSize = sizeof(SCROLLINFO);
g_ScrollInfo.nMin = 0;
g_ScrollInfo.nPage = 1;
g_ScrollInfo.fMask = SIF_PAGE | SIF_RANGE;
SetScrollInfo(g_hWndTool, SB_VERT, &g_ScrollInfo, FALSE);
//////////// *** NEW *** ////////// *** NEW *** ///////////// *** NEW *** ////////////////////
// Here we set the current pen to red for drawing our exit rectangles
g_Buffer.SetPen(PS_SOLID,2,RGB(255,0,0));
//////////// *** NEW *** ////////// *** NEW *** ///////////// *** NEW *** ////////////////////
// Set the backbuffer to black first (This clears the backbuffer)
g_Buffer.ClearScreen(BLACK_BRUSH);
g_ToolBuffer.ClearScreen(BLACK_BRUSH);
}