Skip to main content
gamedev.net
🔒 Locked

Direct Input -- mouse

Started by Johnny_Blaze93 Jul 31, 2002 at 4:15 PM 2 replies 250+ views
Original Post
Johnny_Blaze93
Johnny_Blaze93
Hey, im having trouble getting directX mouse input, for now im just tryng to draw some pixels to the screen. i tried:
    
#define LEFT_BUTTON		0

#define RIGHT_BUTTON		1

#define MIDDLE_BUTTON		2

LPDIRECTINPUTDEVICE m_mouse = NULL;
float mX = 0.0f, mY = 0.0f;
DIMOUSESTATE mouse_state;


Get_Mouse_X(float &m_x)
{
	mX += mouse_state.lX;
	if (mX < 0)
		mX = 0;
	
	m_x = mX;
}

Get_Mouse_Y(float &m_y)
{
	mY += mouse_state.lY;
	if (mY < 0)
		mY = 0;
	
	m_y = mY;
}

Button_Down(int mouse_button)
{
	return ((mouse_state.rgbButtons[mouse_button] & 0x80) ? true : false);
}

Button_Up(int mouse_button)
{
	return ((mouse_state.rgbButtons[mouse_button] & 0x80) ? false : true);
}

    
but that didnt work, can someone please help? [edited by - johnny_blaze93 on July 31, 2002 5:16:44 PM]
I OWN YOU
Sneftel
Sneftel
I notice you declaring mouse_state, but are you initializing it before you access it in Get_Mouse_X and Get_Mouse_Y?



Don''t listen to me. I''ve had too much coffee.
weasalmongler
weasalmongler
Shouldn''t all the functions have return types ?

- Weasalmongler

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.