Part chapter introducing directinputg ddevice-
98 Part I
Chapter 4: Introducing DirectInput
g_pd3dDevice->SetCursorPosition(g_MouseX, g_MouseY,
D3DCURSOR_IMMEDIATE_UPDATE);� DirectInput devices are represented by the IDirectInput- Device8 interface and are created by calling IDirectInput8:: CreateDevice. They represent a single input device, such as a keyboard, a mouse, or a joystick. One per device is needed.
� After devices are created, a programmer sets their starting properties, such as cooperative level, data format, and mouse cursor, and then acquires the device on each input cycle to read user input from it. This is achieved by taking a snapshot of the device using GetDeviceState and then questioning the returned data.
Chapter 5 | |
---|---|
Wrapping Direct3D |
Finally, there is CXPen. This encapsulates ID3DXSprite. Practi-cally, this works very much like a GDI pen — or even a normal pen— in that it paints pixels onto the back buffer. It operates hand in hand with textures, and its purpose is to ultimately render one or more instances of CXTexture onto the screen. Typically,
99