|
Corrupted float ?
I recently updated my DirectInput library from DX7 to DX8, also did some bug fixes and various addons. Well, the lib worked well before the update, and everything seemed to be normal after I was finished.
In my lib, you can bind keys/buttons/axes to input functions, similar to Quake, later you can retrieve the state of any registered function using a function named GetState().
As soon as I began updating my examples a strange behavior occured:
Althought, GetState() returned 1.0 when I pressed the Space bar (bound to ''PrimaryFire''), textout() just kept displaying 0.000.
The functions involved are
I have used the same TextOutf() in the DX7 version of my lib, where it worked!
So I fear I''ve got some kind of memory leak or overwriting, but read on:
This line correctly places the function values in my debug log
TFXLOG("State of PrimaryFire: %.2f", m_pCInput->GetState("PrimaryFire"));
while the TextOutf() always displays a 0.0 in my window
TextOutf(l_hDC, 10, 50, "State of PrimaryFire: %.2f", m_pCInput->GetState("PrimaryFire"));
I tried using a temporary float, eg.
float l_fState;
l_fState = m_pCInput->GetState("PrimaryFire");
TFXLOG("State of PrimaryFire: %.2f", l_fState);
TextOutf(l_hDC, 10, 50, "State of PrimaryFire: %.2f", l_fState);
Guess what ?
TFXLOG() logs a 1.0 and TextOutf() shows a 0.0
What the heck is going on here ?
Am I producing corrupted floats or what ?
Help me before I go insane!
-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Oh, btw, anyone who wants to see for himself can download the sources at
www.LunaticSystems.de/data/TrueFX3b6x.zip 2,05MB
VisualC++ and DirectX 8 SDK required, of course.
-Markus-
www.LunaticSystems.de/data/TrueFX3b6x.zip 2,05MB
VisualC++ and DirectX 8 SDK required, of course.
-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Of course it happened what had to happen, just after posting I found out the error is another one:
Althought the Render() function is called frequently (as TFXLOG() proofs), the window content doesn''t get updated at all.
I have to drag another window around over my application to see any changes, and then windows still only updates the small area that needs to be redrawn, nothing more.
I thought it is (it was!) enough to call a function like this as often as possible when the application is in foreground, but althought the function executes, the window contents are stuck:
I tried adding UpdateWindow() and such, but nothing changed.
Still an error in my lib, or is there just something missing in my Render() function ?
-Markus-
Althought the Render() function is called frequently (as TFXLOG() proofs), the window content doesn''t get updated at all.
I have to drag another window around over my application to see any changes, and then windows still only updates the small area that needs to be redrawn, nothing more.
I thought it is (it was!) enough to call a function like this as often as possible when the application is in foreground, but althought the function executes, the window contents are stuck:
|
I tried adding UpdateWindow() and such, but nothing changed.
Still an error in my lib, or is there just something missing in my Render() function ?
-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement