Пример #1
0
HRESULT wiDirectInput::Initialize(HINSTANCE hinstance, HWND hwnd)
{
	HRESULT result;


	// Initialize the main direct input interface.
	result = DirectInput8Create(hinstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&m_directInput, NULL);
	if(FAILED(result))
	{
		return E_FAIL;
	}

	//// Initialize the direct input interface for the keyboard.
	//result = m_directInput->CreateDevice(GUID_SysKeyboard, &m_keyboard, NULL);
	//if(FAILED(result))
	//{
	//	return E_FAIL;
	//}

	//// Set the data format.  In this case since it is a keyboard we can use the predefined data format.
	//result = m_keyboard->SetDataFormat(&c_dfDIKeyboard);
	//if(FAILED(result))
	//{
	//	return E_FAIL;
	//}

	//// Set the cooperative level of the keyboard to not share with other programs.
	//result = m_keyboard->SetCooperativeLevel(hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
	//if(FAILED(result))
	//{
	//	return E_FAIL;
	//}

	//// Now acquire the keyboard.
	//result = m_keyboard->Acquire();
	//if(FAILED(result))
	//{
	//	return E_FAIL;
	//}
	//m_keyboard->GetDeviceState(sizeof(m_keyboardState), (LPVOID)&m_keyboardState);

	InitJoy(hwnd);

	return S_OK;
}
Пример #2
0
    /*
     *  ウインドウ作成
     */
void OnCreate(AG_Widget *parent)
{
        BOOL        flag;
/*
 * ワークエリア初期化
 */
        nErrorCode = 0;
        bMenuLoop = FALSE;
        bCloseReq = FALSE;
        bSync = TRUE;
        bSyncDisasm[0] = TRUE;
        bSyncDisasm[1] = TRUE;
        bActivate = FALSE;
        AG_MutexInit(&VMMutex);
/*
 * コンポーネント初期化
 */
        LoadCfg();
        InitDraw();
#ifdef _USE_OPENCL
        if(AG_UsingGL(NULL) != 0) {
	   do {
	       SDL_Delay(1);
	   } while(bInitCL);
	}
#endif   
        InitSnd();
        InitKbd();
        InitJoy();
        InitSch();
//        CreateStatus();

/*
 * 仮想マシン初期化
 */
        if (!system_init()) {
                nErrorCode = 1;
                return;
        }
/*
 * 直後、リセット
 */
        ApplyCfg();
        system_reset();

/*
 * コンポーネントセレクト
 */
        flag = TRUE;
        if (!SelectDraw()) {
                flag = FALSE;
        }
        if (!SelectSnd()) {
                flag = FALSE;
        }
        if (!SelectKbd()) {
                flag = FALSE;
        }
        if (!SelectSch()) {
                flag = FALSE;
        }
        PaintStatus();

/*
 * エラーコードをセットさせ、スタート
 */
        if (!flag) {
                nErrorCode = 2;
        }
}