A
download Input.h
Language: C++
LOC: 35
Project Info
TableHockey3D(tablehockey)
Server: SourceForge
Type: cvs
...ey\CVSROOT\tablehockey\src\
   Application.cpp
   Application.h
   Camera.cpp
   Camera.h
   Cube.cpp
   Cube.h
   Data.cpp
   Data.h
   Disk.cpp
   Disk.h
   FloatingText.cpp
   FloatingText.h
   Floor.cpp
   Floor.h
   Input.cpp
   Input.h
   Light.cpp
   Light.h
   log.cpp
   log.h
   main.cpp
   mmgr.cpp
   mmgr.h
   Model.cpp
   Model.h
   nommgr.h
   Puck.cpp
   Puck.h
   Pyramid.cpp
   Pyramid.h
   scene.cpp
   scene.h
   SmartPtr.h
   Sound.cpp
   Sound.h
   TableHockey.dsp
   TableHockey.dsw
   TestScene.cpp
   TestScene.h
   text.cpp
   text.h
   TextHelp.cpp
   TextHelp.h
   texture.cpp
   texture.h
   TexturedCube.cpp
   TexturedCube.h
   timer.cpp
   timer.h
   View.cpp
   View.h

// Input.h: interface for the CInput class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_INPUT_H__CBA6FB29_9DD5_11D4_A9EA_00105A2EAD2D__INCLUDED_)
#define AFX_INPUT_H__CBA6FB29_9DD5_11D4_A9EA_00105A2EAD2D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// we use DirectInput
#define INITGUID
#include <dinput.h>

class MOUSE_DATA 
{
public:
	int	x;
	int y;
	int wheel;
};

/// The input module for keyboard, mouse and joystick
class CInput  
{
public:
	bool IsMouseButtonPressed(int iButton);
	/// reset all input
	void Reset();
	/// initialize all necessary data
	bool Init();
	
	/// set status of key to up or down, not needed if we use DirectInput
	void SetKey(int key, bool bDown = true);
	/// check if key is pressed
	bool IsKeyDown(int key);
	/// retrieve the current status of the keyboard, mouse, joystick
	void Update();

	/// constructor
	CInput();
	/// destructor
	virtual ~CInput();
	/// can we use DirectInput or not
	bool bDirectInput;
	/// store the current mouse position
	MOUSE_DATA mouse;

private:
	/// store the status of all keys
	unsigned char keys[256];
	/// store mouse data
	DIMOUSESTATE mouse_state;

	/// main DirectInput object
	LPDIRECTINPUT lpdi;
	/// our keyboard object
	LPDIRECTINPUTDEVICE lpdikey;
	/// mouse object
	LPDIRECTINPUTDEVICE lpdimouse;

};

#endif // !defined(AFX_INPUT_H__CBA6FB29_9DD5_11D4_A9EA_00105A2EAD2D__INCLUDED_)

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us