当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECTINPUT8::Release方法代码示例

本文整理汇总了C++中LPDIRECTINPUT8::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTINPUT8::Release方法的具体用法?C++ LPDIRECTINPUT8::Release怎么用?C++ LPDIRECTINPUT8::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECTINPUT8的用法示例。


在下文中一共展示了LPDIRECTINPUT8::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CleanupD3D

// リソースの解放
void CleanupD3D()
{
	for (int i = 0; i < MAXMODEL; i = i + 1)
	{
		if (g_models[i].used == TRUE)
		{
			if (g_models[i].pmaterials != NULL)
			{
				delete[] g_models[i].pmaterials;
			}
			if (g_models[i].ptextures != NULL)
			{
				for (DWORD j = 0; j < g_models[i].nummaterials; j = j + 1)
				{
					g_models[i].ptextures[j]->Release();
				}
				delete[] g_models[i].ptextures;
			}
			if (g_models[i].pmesh != NULL)
			{
				g_models[i].pmesh->Release();
			}
		}
	}
	if (g_pd3dDevice != NULL) g_pd3dDevice->Release();
	if (g_pD3D != NULL) g_pD3D->Release();

	if (g_pDIDevice != NULL)
	{
		g_pDIDevice->Unacquire();
		g_pDIDevice->Release();
	}
	if (g_pDI != NULL) g_pDI->Release();
}
开发者ID:muripoLife,项目名称:catSenkan,代码行数:35,代码来源:my3dlib.cpp

示例2: Game_Shutdown

int Game_Shutdown(void *parms,  int num_parms)
{
// this function is where you shutdown your game and
// release all resources that you allocated

// kill the bug blaster
Destroy_BOB(&blaster);

// kill the mushroom maker
for (int index=0; index<4; index++)
    Destroy_Bitmap(&mushrooms[index]);

// kill the playfield bitmap
Destroy_Bitmap(&playfield);

// release joystick
lpdijoy->Unacquire();
lpdijoy->Release();
lpdi->Release();

// shutdonw directdraw
DDraw_Shutdown();

// return success
return(1);
} // end Game_Shutdown
开发者ID:calyx,项目名称:windows-game-source-code,代码行数:26,代码来源:demo9_4_16b.cpp

示例3: destroyDevice

void destroyDevice()
{
	// Destruction des objets Direct3D
	if(g_pD3DDevice)
		g_pD3DDevice->ClearState();
	if(g_pRenderTargetView)
		g_pRenderTargetView->Release();
	if(g_pSwapChain)
		g_pSwapChain->Release();
	if(g_pD3DDevice)
		g_pD3DDevice->Release();

	// Destruction des objets DirectInput
	if(g_pKeyboardDevice)
	{
		g_pKeyboardDevice->Unacquire();
		g_pKeyboardDevice->Release();
	}
	if(g_pMouseDevice)
	{
		g_pMouseDevice->Unacquire();
		g_pMouseDevice->Release();
	}
	if(g_pDI)
		g_pDI->Release();
}
开发者ID:SeungMinChoi,项目名称:ejcharpenay,代码行数:26,代码来源:graphics.cpp

示例4: PsychHIDShutdownHIDStandardInterfaces

void PsychHIDShutdownHIDStandardInterfaces(void)
{
    int i;

    // Release all keyboard queues:
    for (i = 0; i < PSYCH_HID_MAX_DEVICES; i++) {
        if (psychHIDKbQueueFirstPress[i]) {
            PsychHIDOSKbQueueRelease(i);
        }
    }

    // Close all devices registered in x_dev array:
    for (i = 0; i < PSYCH_HID_MAX_DEVICES; i++) {
        if (x_dev[i]) x_dev[i]->Release();
        x_dev[i] = NULL;
    }

    // Release keyboard queue mutex:
    PsychDestroyMutex(&KbQueueMutex);
    PsychDestroyCondition(&KbQueueCondition);
    KbQueueThreadTerminate = FALSE;

    if (!CloseHandle(hEvent)) {
        printf("PsychHID-WARNING: Closing keyboard event handle failed!\n");
    }

    ndevices = 0;

    // Close our dedicated x-display connection and we are done:
    if (dinput) dinput->Release();
    dinput = NULL;

    return;
}
开发者ID:NxNiki,项目名称:Psychtoolbox-3,代码行数:34,代码来源:PsychHIDStandardInterfaces.cpp

示例5: Done_DInput

void Done_DInput()
{
	for( int lcv = 0; lcv < di_mouse_count; lcv++ ) {
		if( di_mouse[ lcv ] ) {
			di_mouse[ lcv ]->Unacquire();
			di_mouse[ lcv ]->Release();
			di_mouse[ lcv ] = NULL;
		}
	}


	for( int lcv = 0; lcv < di_joystick_count; lcv++ ) {
		if( di_joystick[ lcv ] ) {
			di_joystick[ lcv ]->Unacquire();
			di_joystick[ lcv ]->Release();
			di_joystick[ lcv ] = NULL;
		}
	}


	if( di_keyboard ) {
		di_keyboard->Unacquire();
		di_keyboard->Release();
		di_keyboard = NULL;
	}


	if( dinput ) {
		dinput->Release();
		dinput = NULL;
	}


	di_mouse_count = 0;
}
开发者ID:dbniet,项目名称:nuvee,代码行数:35,代码来源:dinput.cpp

示例6: traceIn

DXInput::~DXInput()
{
    traceIn(DXInput::~DXInput);

    bInputExiting = 1;

    SetEvent(InputEvents[0]);
    SetEvent(InputEvents[1]);
    //WaitForSingleObject(hInputThread, 5000);
    //CloseHandle(hInputThread);
    diKeyboard->SetEventNotification(NULL);
    diMouse->SetEventNotification(NULL);
    CloseHandle(InputEvents[0]);
    CloseHandle(InputEvents[1]);

    DIDestroyKeyboardDevice();
    DIDestroyMouseDevice();
    diDevice->Release();

    bDInputActive = 0;

    Log(TEXT("DirectInput Freed"));

    traceOut;
}
开发者ID:alanzw,项目名称:JimEngine,代码行数:25,代码来源:DXInput.cpp

示例7: Game_Shutdown

int Game_Shutdown(void *parms,  int num_parms)
{
// this function is where you shutdown your game and
// release all resources that you allocated

// first unacquire the mouse
lpdimouse->Unacquire();

// now release the mouse
lpdimouse->Release();

// release directinput
lpdi->Release();

// unload the bitmap file
Unload_Bitmap_File(&bitmap8bit);

// delete all bobs and bitmaps
Destroy_BOB(&buttons);
Destroy_BOB(&pointer);
Destroy_Bitmap(&cpanel);
Destroy_Bitmap(&canvas);

// shutdonw directdraw
DDraw_Shutdown();

// return success
return(1);
} // end Game_Shutdown
开发者ID:calyx,项目名称:windows-game-source-code,代码行数:29,代码来源:demo9_2.cpp

示例8: disposeDirectInput

void disposeDirectInput()
{
    logg( "    Disposing Keyboard...", false );
    dinKeyboard->Unacquire();    // make sure the keyboard is unacquired
    dinKeyboard = NULL;
    logg( " Successfully disposed Keyboard." );
    
    logg( "    Disposing Joysticks...", false );
    for ( int i = numJoysticks - 1; i >= 0; i-- )
    {
        try
        {
            dinJoysticks[i]->Unacquire();
            dinJoysticks[i]->Release();
        }
        catch ( ... )
        {
            loggui( " WARNING: Caught an exception while trying to dispose Joystick ", i );
        }
        
        dinJoysticks[i] = NULL;
    }
    logg( " Successfully disposed Joysticks." );
    
    logg( "    Disposing DirectInput...", false );
    din->Release();    // close DirectInput before exiting
    din = NULL;
    logg( " Successfully disposed DirectInput." );
}
开发者ID:CSharles,项目名称:rfDynHUD,代码行数:29,代码来源:direct_input.cpp

示例9: messageCallback

INT_PTR WINAPI messageCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
	switch (message) {
		case WM_DEVICECHANGE:
			if (wParam ==  DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE) {
				// Wait for 30 frames, send refresh
				mustRefreshDevices = 30;
			}
			break;

		case WM_CLOSE:
			UnregisterDeviceNotification(hDeviceNotify);
			DestroyWindow(hWnd);

			diAvailable = false;
			// Releasing resources to avoid crashes
			for (auto it : joysticks) {
				if (it.second) {
					it.second->Unacquire();
					it.second->Release();
				}
			}
			joysticks.clear();
			if (di) {
				di->Release();
			}
			di = NULL;
			break;

		default:
			// Send all other messages on to the default windows handler.
			return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 1;
}
开发者ID:meign,项目名称:SF5-Dinput-Modified,代码行数:34,代码来源:xinput1_3.cpp

示例10: DInput_Shutdown

void DInput_Shutdown(void)
{
// this function shuts down directinput

if (lpdi)
   lpdi->Release();

} // end DInput_Shutdown
开发者ID:jinshizi,项目名称:rushcodes,代码行数:8,代码来源:t3dlib2.cpp

示例11: UninitInput

//=============================================================================
// 入力処理の終了処理
//=============================================================================
void UninitInput(void)
{
	// DirectInputオブジェクトの開放
	if(g_pInput)
	{
		g_pInput->Release();
		g_pInput = NULL;
	}
}
开发者ID:minamiliu,项目名称:Time_To_Shoot,代码行数:12,代码来源:input.cpp

示例12: ShutdownJoystick

void ShutdownJoystick()
{
    // Unacquire the device one last time just in case
    // the app tried to exit while the device is still acquired.
    if( gJoystick )
        gJoystick->Unacquire();

    // Release any DirectInput objects.
    if(gJoystick)
        gJoystick->Release();
    if(gDirectInput)
        gDirectInput->Release();
}
开发者ID:nardo,项目名称:torque_network_library_1_5,代码行数:13,代码来源:winJoystick.cpp

示例13: InitMouse

void MOUSE::InitMouse(IDirect3DDevice9* Dev, HWND wnd)
{
	try
	{
		m_pDevice = Dev;

		//Load texture and init sprite
		D3DXCreateTextureFromFile(m_pDevice, "cursor/cursor.dds", &m_pMouseTexture);
		D3DXCreateSprite(m_pDevice, &m_pSprite);

		//Get directinput object
		LPDIRECTINPUT8 directInput = NULL;

		DirectInput8Create(GetModuleHandle(NULL),	// Retrieves the application handle
						   0x0800,					// v.8.0	
						   IID_IDirectInput8,		// Interface ID
						   (VOID**)&directInput,	// Our DirectInput Object
						   NULL);

		//Acquire Default System mouse
		directInput->CreateDevice(GUID_SysMouse, &m_pMouseDevice, NULL);		
		m_pMouseDevice->SetDataFormat(&c_dfDIMouse);
		m_pMouseDevice->SetCooperativeLevel(wnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND);
		m_pMouseDevice->Acquire();	        

		//Get viewport size and init mouse location
		D3DVIEWPORT9 v;
		m_pDevice->GetViewport(&v);
		m_viewport.left = v.X;
		m_viewport.top = v.Y;
		m_viewport.right = v.X + v.Width;
		m_viewport.bottom = v.Y + v.Height;

		x = v.X + v.Width / 2;
		y = v.Y + v.Height / 2;

		//Release Direct Input Object
		directInput->Release();

		//Create Mouse Sphere
		D3DXCreateSphere(m_pDevice, 0.2f, 5, 5, &m_pSphereMesh, NULL);

		//Create Ball Material
		m_ballMtrl.Diffuse = D3DXCOLOR(1.0f, 1.0f, 0.0f, 1.0f);
		m_ballMtrl.Specular = m_ballMtrl.Ambient = m_ballMtrl.Emissive = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);
	}
	catch(...)
	{
		debug.Print("Error in MOUSE::InitMouse()");
	}	
}
开发者ID:Alriightyman,项目名称:RTS,代码行数:51,代码来源:mouse.cpp

示例14: UninitInput

//=============================================================================
// 入力処理の終了処理
//=============================================================================
void UninitInput(void)
{
	// キーボードの終了処理
	UninitKeyboard();

	// マウスの終了処理
	UninitMouse();

	if(g_pDInput)
	{
		g_pDInput->Release();
		g_pDInput = NULL;
	}
}
开发者ID:lovelyapple,项目名称:TouKyoGameChampion_DenQ,代码行数:17,代码来源:Sys_Input.cpp

示例15: INPXDestroy

/////////////////////////////////////
// Name:	INPXDestroy
// Purpose:	this will terminate DInput
//			as well as all the other devices
// Output:	everything destroyed
// Return:	none
/////////////////////////////////////
PUBLIC void INPXDestroy()
{
	INPXKeyboardDestroy();
	INPXJoystickDestroyAll();

	if(g_pDInput)
	{
		g_pDInput->Release();
		g_pDInput=0;
	}

	g_joystickEnums.clear();
	g_joystickEnums.resize(0);
}
开发者ID:ddionisio,项目名称:TaTaMahatta,代码行数:21,代码来源:INP_Main.cpp


注:本文中的LPDIRECTINPUT8::Release方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。