Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Wierd (?) problem.

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

Okay... this is an odd problem that''s probably very simple, and is only partially a problem (I can get it working, but only in THIS file.....). Now, I''ve made some test controls to move my camera around the world in my engine, and it works absolutely great so long as it''s in the same file as the winmain function (the function is called in winmain every frame before calling drawing loop). The problem here, is that I wanted to put the "do this when these keys are pressed" function as part of my input class, but as soon as I move it out of winmain, and make it CINPUT::CheckForKeyPresses(), it no-longer works. I know it''s not the code in the function itself (because it works... if I move it into my main file), but for some reason it really REALLY doesnt like calling it externally.

Share this post

Link to post
Share on other sites
I don''t know how you check for key presses but it might have something to do with the window variables that are not linked to your external file (hWnd, hInstance, etc...)

I''m not sure though. Its just a thought.

- An eye for an eye will make the world go blind -

Share this post

Link to post
Share on other sites
If I''ve got this utterly wrong, please ignore me and go about your buisiness

looks like your accessing a static function. and not creating a input object (class''s are discriptions for objects, not actual data). Pretty simple really, but gets a lot of people (have you been trying to learn form a MFC book?)


somewhere in app, create the input object... Preferablly within an object controlling your app.

CInput InputControl;

then later on, in the app,



if (InputControl.Keys[VK_WHATEVER])

or however you want to go about storing the data.

(I assume that inside the chekc for key presses funtion, you are simply running through lots of GetAsyncKeyState calls)

static fucntions (accessed with :: ) don''t need an object to be called, but cannot access anything that might normall be part of the object... they can only return a result, or edit data you might pass to it, via a pointer or such.

objects beat C functions hands down anyday. Imagine now making an extended input object to use Dirext Input and letting the app choose what to use at run time. A right bugger to do in C, very simple with objects.

Share this post

Link to post
Share on other sites
That''s pretty much how I''ve done it.

Not a problem though, I just made a new function inside my main class, and call everything in from my CINPUT class to there.
Not a problem.

Thx for all your help anyway.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!