Help on my little game
I need some help on DirectInput. I just started a few days ago and I'm stuck. So, I uploaded the project file and I want someone to please look at it and find out what's wrong with it.
Link: http://www.megaupload.com/?d=3SY1MBQ5
Thanks in advance,
Brandon
I'm sorry, but my intrenetz doesn't allow me to download files from megaupload.com.
What exactly about DirectInput do you need help on?
[Edited by - _fastcall on November 14, 2008 12:16:46 AM]
What exactly about DirectInput do you need help on?
[Edited by - _fastcall on November 14, 2008 12:16:46 AM]
Its about the mouse device pointer is NULL.
I uploaded it somewhere else: http://rapidshare.com/files/163690745/paddlegame.rar.html
Thanks,
Brandon
I uploaded it somewhere else: http://rapidshare.com/files/163690745/paddlegame.rar.html
Thanks,
Brandon
I'm sorry, but my internets doesn't allow me to download files from rapidshare.
I'm going to go out on a limb and guess that you might not be creating the mouse device before you're using it.
Did you follow any DirectInput tutorials?
Quote:
Its about the mouse device pointer is NULL.
I'm going to go out on a limb and guess that you might not be creating the mouse device before you're using it.
Did you follow any DirectInput tutorials?
Ok, here's where I narrowed it down to:
The code that is messed up on debug is this line:
I created the device and everything. And I am using a DirectX game programming book to learn.
Thanks,
Brandon
#include "dxinput.h"#define BUTTON_DOWN(obj, button) (obj.rgbButtons[button] & 0x80)LPDIRECTINPUT8 dinput;LPDIRECTINPUTDEVICE8 dimouse;LPDIRECTINPUTDEVICE8 dikeyboard;LPDIRECTINPUTDEVICE8 dijoystick;DIMOUSESTATE mouse_state;char keys[256];int Init_DirectInput(HWND hWnd){ HRESULT result = DirectInput8Create( GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&dinput, NULL); if(result != SUCCEEDED(result)) return 0; result = dinput->CreateDevice(GUID_SysMouseEm2, &dimouse, NULL); if(result != SUCCEEDED(result)) return 0; result = dinput->CreateDevice(GUID_SysKeyboardEm2, &dikeyboard, NULL); if(result != SUCCEEDED(result)) return 0; return 1;}int Init_Mouse(HWND hWnd){ //help HRESULT result = dimouse->SetDataFormat(&c_dfDIMouse); if(result != SUCCEEDED(result)) return 0; result = dimouse->SetCooperativeLevel(hWnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND); if(result != SUCCEEDED(result)) return 0; result = dimouse->Acquire(); if (result != SUCCEEDED(result)) return 0; return 1;}
The code that is messed up on debug is this line:
HRESULT result = dimouse->SetDataFormat(&c_dfDIMouse);
I created the device and everything. And I am using a DirectX game programming book to learn.
Thanks,
Brandon
Quote:Original post by BrandonisMaster
Its about the mouse device pointer is NULL.
Quote:Original post by BrandonisMaster
I created the device and everything.
Then the mouse device pointer shouldn't be NULL.
Quote:Original post by BrandonisMaster
And I am using a DirectX game programming book to learn.
Then refer to your book on how to use DirectInput.
Or, you could follow any of the DirectInput tutorials, and find the answers you're looking for.
I don't want you to debug my code, I have already done that -.- All that I want is someone to look at that code and see what is wrong with the device.
Regards,
Brandon
Regards,
Brandon
Quote:Original post by BrandonisMaster
All that I want is someone to look at that code and see what is wrong with the device.
It's uninitialized/NULL, that's what's wrong with the mouse device pointer. Which would mean that the device hasn't been created.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement