Jump to content
  • Advertisement
Sign in to follow this  
Xpyder

missing '' before 'if' - Direct Input

This topic is 5375 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

Linking with another library won't help (at least not immediately) - this error occurs before the linker is invoked.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Xpyder
yea thats probably it- i just got it out of a book and the if is for error testing, but ur prob right - i just need to sort out the hinstance thing now - thakns


No, you don't need to work out the hinstance thing. That code doesn't belong there at all. It should be in your InitD3D function, or wherever your input device(s) is/are created.

Share this post


Link to post
Share on other sites
sos, its still givin me problems.
it lets me do all this:



if (FAILED(DirectInput8Create(main_instance,
DIRECTINPUT_VERSION,
IID_IDirectInput8,
(void**)&lpdi,NULL)))
return (0);



if (FAILED(lpdi->CreateDevice(GUID_SysMouse,
&lpdimouse, NULL)))
{/*err*/}

if(FAILED(lpdimouse->SetCooperativeLevel(
main_window_handle,
DISCL_BACKGROUND | DISCL_NONEXCLUSIVE)))
{/*err*/}

if(FAILED(lpdimouse->SetDataFormat(&c_dfDIMouse)))
{/*err*/}

if (FAILED(lpdimouse->Acquire()))
{/*err*/}




but when i enter

object_x = mousestate.lX;
object_y = mousestate.lY;

if (mousestate.rgbButtons[MOUSE_LEFT_BUTTON] & 0x80)
MAP_STRUCTURE[CurrentLayer][MouseToTilePos_Y][MouseToTilePos_X] = CurrentTexture;

it flags an error stating:

C:\My Documents\RTX Files\RTX Main.cpp(198) : error C2440: 'type cast' : cannot convert from 'struct _DIMOUSESTATE' to 'void *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\My Documents\RTX Files\RTX Main.cpp(204) : error C2143: syntax error : missing ']' before ';'
C:\My Documents\RTX Files\RTX Main.cpp(204) : error C2143: syntax error : missing ';' before ']'

its the first one im looking at - i got it out of a book so it should work

Share this post


Link to post
Share on other sites
Without knowing what's on line 198, we can't tell you how to fix your problem. But you can't just copy and paste code from a book into an application and expect it to work. You have to either modify the book code to match your application's architecture or modify your application's architecture to match that expected by the book code.

You need to start small and add things a little at a time as you build your understanding. Taking a bunch of book code and slapping it into a project along with a bunch of other code is just going to frustrate you and you won't learn anything.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!