• Advertisement
Sign in to follow this  

Quick DInput Q

This topic is 4615 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using the code from my Jim Adams book Programming Roleplaying.... and it's not compiling.
bool ReadData(IDirectInputDevice8* dev, void* DataBuffer, long BufferSize)
{
	while(1)
	{
		dev->Poll();
		
		if(SUCCEEDED(dev->GetDeviceState(BufferSize,(LPVOID)DataBuffer)))
			break;

		dev->Acquire();
	}
	return true;
}

void getInput()
{
	ReadData(mouse, (void*)MouseState, sizeof(DIMOUSESTATE));
	mouseX += MouseState.lX;
	mouseY += MouseState.lY;

	if(MouseButtonState(0) == TRUE)
	{
	}

}


Says I can't typecast MouseState to type (void*), but it's right here in the book. I know books can be wrong, but I'm just making sure here. What gives?

Share this post


Link to post
Share on other sites
Advertisement
One possibility is that you are sending MouseState as a structure and not a pointer. If you have a structure, you need to send it using its address (i.e. put a '&' in front of the name.)

Do you have a line number for the error? Where does it point?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement