本文整理汇总了C++中FreeResources函数的典型用法代码示例。如果您正苦于以下问题:C++ FreeResources函数的具体用法?C++ FreeResources怎么用?C++ FreeResources使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FreeResources函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: FreeResources
DWORD CControlSK::SetBitmap(HBITMAP hBitmap)
{
int nRetValue;
BITMAP csBitmapSize;
// Free any loaded resource
FreeResources();
if (hBitmap)
{
m_hBitmap = hBitmap;
// Get bitmap size
nRetValue = ::GetObject(hBitmap, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return 0;
}
m_dwWidth = (DWORD)csBitmapSize.bmWidth;
m_dwHeight = (DWORD)csBitmapSize.bmHeight;
}
// if (IsWindow(this->GetSafeHwnd()))
// Invalidate();
return 1;
}
开发者ID:mikemakuch,项目名称:muzikbrowzer,代码行数:29,代码来源:ControlSK.cpp
示例2: FreeResources
DWORD CMySliderCtrl::SetBitmaps(HBITMAP hChannel, COLORREF crTransCh,
HBITMAP hThumb, COLORREF crTransThumb)
{
int nRetValue = 0;
BITMAP csBitmapSize;
m_BgSet = FALSE;
// Free any loaded resource
FreeResources();
if (hChannel)
{
m_csBitmaps[0].hBitmap = hChannel;
m_csBitmaps[0].crTransparent = crTransCh;
// Get bitmap size
nRetValue = ::GetObject(hChannel, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csBitmaps[0].dwWidth = (DWORD)csBitmapSize.bmWidth;
m_csBitmaps[0].dwHeight = (DWORD)csBitmapSize.bmHeight;
// Create mask for bitmap In
m_csBitmaps[0].hMask = CreateBitmapMask(hChannel, m_csBitmaps[0].dwWidth, m_csBitmaps[0].dwHeight, crTransCh);
if (m_csBitmaps[0].hMask == NULL)
{
FreeResources();
return BTNST_FAILEDMASK;
} // if
}
if (hThumb)
{
m_csBitmaps[3].hBitmap = hThumb;
m_csBitmaps[3].crTransparent = crTransThumb;
// Get bitmap size
nRetValue = ::GetObject(hThumb, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csBitmaps[3].dwWidth = (DWORD)csBitmapSize.bmWidth;
m_csBitmaps[3].dwHeight = (DWORD)csBitmapSize.bmHeight;
// Create mask for bitmap Out
m_csBitmaps[3].hMask = CreateBitmapMask(hThumb, m_csBitmaps[3].dwWidth, m_csBitmaps[3].dwHeight, crTransThumb);
if (m_csBitmaps[3].hMask == NULL)
{
FreeResources();
return BTNST_FAILEDMASK;
} // if
} // if
SizeToContent();
Invalidate();
return BTNST_OK;
} // End of SetBitmaps
开发者ID:mikemakuch,项目名称:muzikbrowzer,代码行数:60,代码来源:SkinSlider.cpp
示例3: FreeResources
DWORD CButtonST::SetIcon(HICON hIconIn, HICON hIconOut, HICON hIconDisable)
{
bool bRetValue;
ICONINFO ii;
// Free any loaded resource
FreeResources();
if (hIconIn != 0)
{
m_csIcons[0].hIcon = hIconIn;
// Get icon dimension
ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = (::GetIconInfo(hIconIn, &ii) != 0);
if (!bRetValue)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
}
m_csIcons[0].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[0].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
if (hIconOut != 0)
{
m_csIcons[1].hIcon = hIconOut;
// Get icon dimension
ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = (::GetIconInfo(hIconOut, &ii) != 0);
if (!bRetValue)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
}
m_csIcons[1].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[1].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
}
if (hIconDisable != 0)
{
m_csIcons[2].hIcon = hIconDisable;
// Get icon dimension
ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = (::GetIconInfo(hIconDisable, &ii) != 0);
if (!bRetValue)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
}
m_csIcons[2].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[2].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
}
}
if (IsWindow()) { RedrawWindow(); }
return BTNST_OK;
}
开发者ID:moon-sky,项目名称:fishjam-template-library,代码行数:59,代码来源:ButtonST.cpp
示例4: FreeResources
DWORD SkinBmp::SetBitmaps(CWnd * cwnd, CDC * dc, HBITMAP hBitmap, COLORREF crTransBitmap)
{
int nRetValue = 0;
BITMAP csBitmapSize;
// Free any loaded resource
FreeResources();
cwnd->GetClientRect(m_ClientRect);
if (hBitmap)
{
// Get bitmap size
nRetValue = ::GetObject(hBitmap, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return FALSE;
} // if
// resize bitmap into client area
HDC hdcSrc = CreateCompatibleDC(NULL);
HBITMAP hbmOldSrc = (HBITMAP)::SelectObject(hdcSrc, hBitmap);
HBITMAP hbmResized = ::CreateCompatibleBitmap(dc->m_hDC,m_ClientRect.Width(),m_ClientRect.Height());
HDC hdcTmp = CreateCompatibleDC(NULL);
HBITMAP hbmTmp = (HBITMAP)::SelectObject(hdcTmp, hbmResized);
::StretchBlt(hdcTmp,0,0,m_ClientRect.Width(),m_ClientRect.Height(),
hdcSrc,0,0,csBitmapSize.bmWidth,csBitmapSize.bmHeight,SRCCOPY);
::SelectObject(hdcSrc, hbmOldSrc);
::DeleteDC(hdcSrc);
::DeleteObject(hBitmap);
::SelectObject(hdcTmp, hbmTmp);
::DeleteDC(hdcTmp);
hBitmap = hbmResized;
m_Bitmaps.hBitmap = hBitmap;
m_Bitmaps.crTransparent = crTransBitmap;
m_Bitmaps.dwWidth = m_ClientRect.Width();
m_Bitmaps.dwHeight = m_ClientRect.Height();
// Create mask for bitmap In
m_Bitmaps.hMask = CreateBitmapMask(hBitmap, m_Bitmaps.dwWidth, m_Bitmaps.dwHeight, crTransBitmap);
if (m_Bitmaps.hMask == NULL)
{
FreeResources();
return FALSE;
} // if
}
m_UseSkin = TRUE;
// Invalidate();
return TRUE;
} // End of SetBitmaps
开发者ID:mikemakuch,项目名称:muzikbrowzer,代码行数:59,代码来源:SkinBmp.cpp
示例5: FreeResources
// This function assigns bitmaps to the button.
// Any previous icon or bitmap will be removed.
//
// Parameters:
// [IN] hBitmapIn
// Handle fo the bitmap to show when the mouse is over the button.
// Pass NULL to remove any bitmap from the button.
// [IN] crTransColorIn
// Color (inside hBitmapIn) to be used as transparent color.
// [IN] hBitmapOut
// Handle to the bitmap to show when the mouse is outside the button.
// Can be NULL.
// [IN] crTransColorOut
// Color (inside hBitmapOut) to be used as transparent color.
//
// Return value:
// BTNST_OK
// Function executed successfully.
// BTNST_INVALIDRESOURCE
// Failed loading the specified resource.
// BTNST_FAILEDMASK
// Failed creating mask bitmap.
//
DWORD CButtonST::SetBitmaps(HBITMAP hBitmapIn, COLORREF crTransColorIn, HBITMAP hBitmapOut, COLORREF crTransColorOut)
{
int nRetValue;
BITMAP csBitmapSize;
// Free any loaded resource
FreeResources();
if (hBitmapIn)
{
m_csBitmaps[0].hBitmap = hBitmapIn;
m_csBitmaps[0].crTransparent = crTransColorIn;
// Get bitmap size
nRetValue = ::GetObject(hBitmapIn, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csBitmaps[0].dwWidth = (DWORD)csBitmapSize.bmWidth;
m_csBitmaps[0].dwHeight = (DWORD)csBitmapSize.bmHeight;
// Create mask for bitmap In
m_csBitmaps[0].hMask = CreateBitmapMask(hBitmapIn, m_csBitmaps[0].dwWidth, m_csBitmaps[0].dwHeight, crTransColorIn);
if (m_csBitmaps[0].hMask == NULL)
{
FreeResources();
return BTNST_FAILEDMASK;
} // if
if (hBitmapOut)
{
m_csBitmaps[1].hBitmap = hBitmapOut;
m_csBitmaps[1].crTransparent = crTransColorOut;
// Get bitmap size
nRetValue = ::GetObject(hBitmapOut, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csBitmaps[1].dwWidth = (DWORD)csBitmapSize.bmWidth;
m_csBitmaps[1].dwHeight = (DWORD)csBitmapSize.bmHeight;
// Create mask for bitmap Out
m_csBitmaps[1].hMask = CreateBitmapMask(hBitmapOut, m_csBitmaps[1].dwWidth, m_csBitmaps[1].dwHeight, crTransColorOut);
if (m_csBitmaps[1].hMask == NULL)
{
FreeResources();
return BTNST_FAILEDMASK;
} // if
} // if
} // if
Invalidate();
return BTNST_OK;
} // End of SetBitmaps
开发者ID:darwinbeing,项目名称:trade,代码行数:81,代码来源:BtnST.cpp
示例6: FreeResources
// This function assigns icons to the button.
// Any previous icon or bitmap will be removed.
//
// Parameters:
// [IN] hIconIn
// Handle fo the icon to show when the mouse is over the button.
// Pass NULL to remove any icon from the button.
// [IN] hIconOut
// Handle to the icon to show when the mouse is outside the button.
// Can be NULL.
//
// Return value:
// BTNST_OK
// Function executed successfully.
// BTNST_INVALIDRESOURCE
// Failed loading the specified resource.
//
DWORD CButtonST::SetIcon(HICON hIconIn, HICON hIconOut)
{
BOOL bRetValue;
ICONINFO ii;
// Free any loaded resource
FreeResources();
if (hIconIn)
{
// Icon when mouse over button?
m_csIcons[0].hIcon = hIconIn;
// Get icon dimension
::ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = ::GetIconInfo(hIconIn, &ii);
if (bRetValue == FALSE)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csIcons[0].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[0].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
// Icon when mouse outside button?
if (hIconOut)
{
if (hIconOut == BTNST_AUTO_GRAY)
{
hIconOut = CreateGrayscaleIcon(hIconIn);
} // if
m_csIcons[1].hIcon = hIconOut;
// Get icon dimension
::ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = ::GetIconInfo(hIconOut, &ii);
if (bRetValue == FALSE)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csIcons[1].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[1].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
} // if
} // if
Invalidate();
return BTNST_OK;
} // End of SetIcon
开发者ID:diduoren,项目名称:youeryuan,代码行数:72,代码来源:BtnST.cpp
示例7: ZeroedMembers
void H264Slice::Reset()
{
m_pSource.Release();
if (m_bInited && m_pSeqParamSet)
{
if (m_pSeqParamSet)
((H264SeqParamSet*)m_pSeqParamSet)->DecrementReference();
if (m_pPicParamSet)
((H264PicParamSet*)m_pPicParamSet)->DecrementReference();
m_pSeqParamSet = 0;
m_pPicParamSet = 0;
if (m_pSeqParamSetEx)
{
((H264SeqParamSetExtension*)m_pSeqParamSetEx)->DecrementReference();
m_pSeqParamSetEx = 0;
}
if (m_pSeqParamSetMvcEx)
{
((H264SeqParamSetMVCExtension*)m_pSeqParamSetMvcEx)->DecrementReference();
m_pSeqParamSetMvcEx = 0;
}
if (m_pSeqParamSetSvcEx)
{
((H264SeqParamSetSVCExtension*)m_pSeqParamSetSvcEx)->DecrementReference();
m_pSeqParamSetSvcEx = 0;
}
}
ZeroedMembers();
FreeResources();
}
开发者ID:ph0b,项目名称:MediaSDK,代码行数:35,代码来源:umc_h264_slice_decoding.cpp
示例8: SDL_COMPAT_SetVideoMode
SDL_Surface* SDL_COMPAT_SetVideoMode(int width, int height, int bitsperpixel, Uint32 flags)
{
g_width = width;
g_height = height;
g_bpp = bitsperpixel;
FreeResources();
g_window = SDL_CreateWindow("oricutron", g_lastx, g_lasty,
g_width, g_height, flags);
if(g_icon)
SDL_SetWindowIcon(g_window, g_icon);
if(flags & SDL_WINDOW_OPENGL)
{
g_screen = SDL_GetWindowSurface(g_window);
g_glcontext = SDL_GL_CreateContext(g_window);
}
else
{
g_screen = SDL_CreateRGBSurface(0, g_width, g_height, g_bpp,
RMASK, GMASK, BMASK, AMASK);
g_renderer = SDL_CreateRenderer(g_window, -1, 0);
g_texture = SDL_CreateTexture(g_renderer,
SDL_PIXELFORMAT_ABGR8888,
SDL_TEXTUREACCESS_STREAMING,
g_width, g_height);
}
return g_screen;
}
开发者ID:Blonder,项目名称:oricutron,代码行数:31,代码来源:system_sdl.c
示例9: FreeResources
bool ScaleSpace::AllocateResources(int lines, int cols, int levels, double *scales)
{
int i;
if(lines < 10) //image too small
return false;
if(cols < 10) //image too small
return false;
if(levels < 1) //
return false;
if(_allocated)
FreeResources();
_width = cols;
_height = lines;
_levels = levels;
_scales = (double*)malloc(_levels*sizeof(double));
if(scales == 0) return false;
_scalespace = (float**)malloc(_levels*sizeof(float*));
if(_scalespace == 0) return false;
_filters = new FastGauss[levels];
if(_filters == 0) return false;
for(i=0; i < levels; i++)
{
_scales[i] = scales[i];
_filters[i].AllocateResources(lines, cols, _scales[i]);
_scalespace[i] = (float*)malloc(_width*_height*sizeof(float));
if(_scalespace[i] == 0) return false;
}
_allocated = true;
return true;
}
开发者ID:Piijas,项目名称:icub-main,代码行数:32,代码来源:ScaleSpace.cpp
示例10: INFO_PRINTF1
/**
Old testcaseID AFSS-CMDMWT-0008
New testcaseID DEVSRVS-SSMA-CMD-0010
*/
void CCmdTestMultipleWait::doTestCommandTypeL()
{
TInt32 timeout = 10000;
TArray<MSsmCommand*> testDeferredList = iDeferredList.Array();
INFO_PRINTF1(_L("Test:doTestCommandTypeL - Command construction with valid data"));
INFO_PRINTF1(_L("doTestCommandTypeL:01 Test: Construct from NewL(RReadStream& aReadStream, TArray<MSsmCommand*>& aDeferredCommands) and check type"));
iTestCmd = CreateCmdFromStreamL(testDeferredList, timeout);
CompareCommandsDataL(iTestCmd, timeout);
TEST(iTestCmd->Type() == ESsmCmdMultipleWait);
Reset();
INFO_PRINTF1(_L("doTestCommandTypeL:02 Test: Construct from NewL(TInt32 aTimeout) and check type"));
iTestCmd = CCmdMultipleWait::NewL(timeout);
CompareCommandsDataL(iTestCmd, timeout);
TEST(iTestCmd->Type() == ESsmCmdMultipleWait);
Reset();
INFO_PRINTF1(_L("doTestCommandTypeL:03 Test: Construct from NewL(TSsmCommandParameters& aCommandParameters) and check type"));
timeout = 1000;
// open reader
RResourceReader& reader = LoadResourcesL(KTestRscFileName, R_COMMAND_VALID_DATA);
TSsmCommandParameters params(reader, NULL, 0);
iTestCmd = CCmdMultipleWait::NewL(params);
CompareCommandsDataL(iTestCmd, timeout);
TEST(iTestCmd->Type() == ESsmCmdMultipleWait);
Reset();
FreeResources();
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:33,代码来源:tcmd_step_multiplewait.cpp
示例11: INFO_PRINTF1
void CCmdTestWaitForApparcInit::doTestCommandTypeL()
{
TCmdErrorSeverity severity = ECmdIgnoreFailure;
INFO_PRINTF1(_L("Test:doTestCommandTypeL - Command construction with valid data"));
INFO_PRINTF1(_L("doTestCommandTypeL:01 Construct from NewL(RReadStream& aReadStream) and check type"));
iTestCmd = CreateCmdFromStreamL(severity);
CompareCommandsDataL(iTestCmd, severity);
TEST(iTestCmd->Type() == ESsmCmdWaitForApparcInit);
delete iTestCmd;
iTestCmd = NULL;
INFO_PRINTF1(_L("doTestCommandTypeL:02 Construct from NewL(TCmdErrorSeverity aSeverity) and check type"));
severity = ECmdCriticalSeverity;
iTestCmd = CCmdWaitForApparcInit::NewL(severity);
CompareCommandsDataL(iTestCmd, severity);
TEST(iTestCmd->Type() == ESsmCmdWaitForApparcInit);
delete iTestCmd;
iTestCmd = NULL;
INFO_PRINTF1(_L("doTestCommandTypeL:03 Construct from NewL(TSsmCommandParameters& aCommandParameters) and check type"));
severity = ECmdMediumSeverity;
// open reader
RResourceReader& reader = LoadResourcesL(KTestRscFileName, R_COMMAND_VALID_DATA);
TSsmCommandParameters params(reader, NULL, 0);
iTestCmd = CCmdWaitForApparcInit::NewL(params);
CompareCommandsDataL(iTestCmd, severity); //validate the value
TEST(iTestCmd->Type() == ESsmCmdWaitForApparcInit);
delete iTestCmd;
iTestCmd = NULL;
FreeResources();
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:32,代码来源:tcmd_step_waitforapparcinit.cpp
示例12: ImproveCommunities
uint32_t ImproveCommunities(const CGraph* graph, CommunityPartition* partition, uint32_t numThreads, uint32_t lookahead, const double64_t alfa ) {
num_threads = numThreads;
omp_set_num_threads(num_threads);
printf("Maximum number of threads: %d\n", omp_get_max_threads());
printf("Starting improvement from a partition with WCC: %f\n", partition->m_WCC / graph->GetNumNodes());
CommunityPartition bestPartition;
CopyPartition(&bestPartition, partition);
uint32_t remainingTries = lookahead;
bool improve = true;
while(improve) {
while (improve) {
printf("\n");
uint64_t initTime = StartClock();
improve = false;
printf("Starting improvement iteration ...\n");
if (PerformImprovementStep(graph, partition, alfa)) {
printf("Error while performing an improvement step.\n");
return 1;
}
printf("New WCC: %f\n", partition->m_WCC / graph->GetNumNodes());
printf("Best WCC: %f\n", bestPartition.m_WCC / graph->GetNumNodes());
printf("Memory required by this iteration: %lu bytes \n", MeasureMemoryConsumption(partition) + MeasureMemoryConsumption(&bestPartition));
if (partition->m_WCC - bestPartition.m_WCC > 0.0f) {
// if (((partition->m_WCC - bestPartition.m_WCC) / bestPartition.m_WCC) > 0.01f) {
remainingTries = lookahead;
// }
FreeResources(&bestPartition);
CopyPartition(&bestPartition, partition);
}
printf("Iteration time: %lu ms\n", StopClock(initTime));
if(remainingTries > 0) {
remainingTries--;
improve = true;
}
}
}
FreeResources(partition);
CopyPartition(partition, &bestPartition);
FreeResources(&bestPartition);
return 0;
}
开发者ID:ArnauPrat,项目名称:SCD,代码行数:47,代码来源:communities.cpp
示例13: LoadResourcesL
void CCmdTestMultipleWait::AddDeferredCommandsInListL(TDeferredCmdConfiguration aDeferredCmd)
{
// open reader
RResourceReader& reader = LoadResourcesL(KTestRscFileName, aDeferredCmd.iCmdResourceId);
TSsmCommandParameters params(reader, NULL, 0);
iTestList->AddCommandFromResourceL(aDeferredCmd.iCmdType, params);
FreeResources();
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:8,代码来源:tcmd_step_multiplewait.cpp
示例14: FreeResources
RenderSystem::~RenderSystem() {
if (_initOk) {
if (_context) {
_context->ClearState();
}
FreeResources();
}
}
开发者ID:Zerkish,项目名称:DXDev,代码行数:8,代码来源:RenderSystem.cpp
示例15: FreeResources
void CGUIRenderingControl::UpdateVisibility(const CGUIListItem *item)
{
// if made invisible, start timer, only free addonptr after
// some period, configurable by window class
CGUIControl::UpdateVisibility(item);
if (!IsVisible() && m_callback)
FreeResources();
}
开发者ID:AndyPeterman,项目名称:mrmc,代码行数:8,代码来源:GUIRenderingControl.cpp
示例16: nosaveCB_QuestionDialog
void nosaveCB_QuestionDialog(Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg)
{
XtDestroyWidget(XtParent(UxWidget));
FreeResources();
exit(0);
}
开发者ID:juddy,项目名称:edcde,代码行数:8,代码来源:Confirmed.c
示例17: Notify
CResultSet::~CResultSet()
{
try {
Notify(CDbapiClosedEvent(this));
FreeResources();
Notify(CDbapiDeletedEvent(this));
_TRACE(GetIdent() << " " << (void*)this << " deleted.");
}
NCBI_CATCH_ALL_X( 6, kEmptyStr )
}
开发者ID:swuecho,项目名称:igblast,代码行数:10,代码来源:rs_impl.cpp
示例18: FreeResources
bool CGUITextureBase::SetFileName(const std::string& filename)
{
if (m_info.filename == filename) return false;
// Don't completely free resources here - we may be just changing
// filenames mid-animation
FreeResources();
m_info.filename = filename;
// Don't allocate resources here as this is done at render time
return true;
}
开发者ID:Karlson2k,项目名称:xbmc,代码行数:10,代码来源:GUITexture.cpp
示例19: CreateDeviceAndContext
Error::E RenderSystem::Initialize(const Window &window) {
Error::E err = Error::OK;
err = CreateDeviceAndContext();
if (err != Error::OK) {
FreeResources();
return err;
}
err = CreateSwapChain(window);
if (err != Error::OK) {
FreeResources();
return err;
}
ID3D11Texture2D *backBuffer;
DEBUG_HR(_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&backBuffer)));
DEBUG_HR(_device->CreateRenderTargetView(backBuffer, NULL, &_renderTargetView));
ReleaseCom(backBuffer);
err = CreateDepthStencilBuffer();
if (err != Error::OK) {
FreeResources();
return err;
}
_context->OMSetRenderTargets(1, &_renderTargetView, _depthStencilView);
D3D11_VIEWPORT vp;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
vp.Width = (float)window.GetWidth();
vp.Height = (float)window.GetHeight();
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
_context->RSSetViewports(1, &vp);
_initOk = true;
return Error::OK;
}
开发者ID:Zerkish,项目名称:DXDev,代码行数:43,代码来源:RenderSystem.cpp
示例20: FAILED
//==============================================================
CInput::CInput(HWND window)
{
DI = nullptr;
if (FAILED(DirectInput8Create(GetModuleHandle(NULL),
DIRECTINPUT_VERSION,
IID_IDirectInput8,
reinterpret_cast<void**>(&DI), NULL))) return;
Keyboard = nullptr;
if (FAILED(DI->CreateDevice(
GUID_SysKeyboard, &Keyboard, NULL)) ||
FAILED(Keyboard->SetDataFormat(
&c_dfDIKeyboard)) ||
FAILED(Keyboard->SetCooperativeLevel(
window, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE))
)
{
FreeResources();
return;
}
if (FAILED(DI->EnumDevices(DI8DEVCLASS_GAMECTRL,
EnumJoysticksCallbackWrapper,
this, DIEDFL_ATTACHEDONLY))
)
{
FreeResources(); return;
}
for (int i=0, n=JoySticks.size(); i<n; i++)
{
if (FAILED(JoySticks[i]->SetDataFormat(
&c_dfDIJoystick2)) ||
FAILED(JoySticks[i]->SetCooperativeLevel(
window, DISCL_FOREGROUND | DISCL_EXCLUSIVE)) ||
FAILED(JoySticks[i]->EnumObjects(
EnumObjectsCallbackWrapper,
JoySticks[i], DIDFT_ALL)))
{
FreeResources(); return;
}
}
}
开发者ID:codebachi,项目名称:ProjectDirectX,代码行数:43,代码来源:Input.cpp
注:本文中的FreeResources函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论