本文整理汇总了C++中image::alloc_data方法的典型用法代码示例。如果您正苦于以下问题:C++ image::alloc_data方法的具体用法?C++ image::alloc_data怎么用?C++ image::alloc_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::alloc_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_win
int dd_Window::set_win(int w, int h, int bpp)
{
// RECT r, r2;
HRESULT hr;
shutdown_win();
dx_win_bsd.dwWidth = w;
dx_win_bsd.dwHeight = h;
hr = dx_dd->CreateSurface(&dx_win_bsd, &dx_win_bs, NULL);
if (hr != DD_OK)
{
return 0;
}
hr = dx_win_bs->Lock(0, &dx_win_bsd, 0, 0);
if (hr != DD_OK)
{
DX_RELEASE(dx_win_bs);
return 0;
}
dx_win_bs->Unlock(0);
hr = dx_dd->CreateClipper(0, &clipper, 0);
if (hr != DD_OK)
{
DX_RELEASE(dx_win_bs);
return 0;
}
hr = clipper->SetHWnd(0, hwnd);
if (hr != DD_OK)
{
DX_RELEASE(dx_win_bs);
DX_RELEASE(clipper);
return 0;
}
if(bGameWindow)
{
int ws = GetWindowLong(hwnd,GWL_STYLE);
ws &= ~WS_POPUP;
ws |= WS_OVERLAPPEDWINDOW | WS_THICKFRAME;
SetWindowLong(hwnd, GWL_STYLE, ws);
}
//set pixelformat parameters
//if(bGameWindow)
//{
// DDPIXELFORMAT ddpf;
// ddpf.dwSize = sizeof(ddpf);
// ddpf.dwFlags = DDPF_RGB;
// hr = dx_win_ps->GetPixelFormat(&ddpf);
// if (hr != DD_OK) err("Could not get pixel format!");
// //if (ddpf.dwRBitMask == 0x7C00 && bpp == 16)
// // vid_bpp = 15, vid_bytesperpixel = 2;
// //else
// // vid_bpp = bpp, vid_bytesperpixel = bpp / 8;
//}
delete img;
img = new image();
img->width = w;
img->height = h;
img->cx1 = 0;
img->cx2 = w-1;
img->cy1 = 0;
img->cy2 = h-1;
if(vid_bpp == DesktopBPP) {
img->shell = true;
img->data = (quad*)dx_win_bsd.lpSurface;
img->pitch = dx_win_bsd.lPitch / vid_bytesperpixel;
} else {
img->alloc_data();
}
SetHandleImage(imgHandle,img);
if(bGameWindow)
{
SetHandleImage(1,img);
screen = img;
}
return 1;
}