Using Bloodshed Dev c++
in my main.cc i define an extern bool pointer
extern bool * keys = NULL;
in my WinMain function I set it equal to a dynamic array
keys = new bool;
Here is the VERY STRANGE PROBLEM
when I call FSOUND_Init after this line, all of my data values in keys become inverted. So later in the program when it loops and checks for VK_ESCAPE, it comes up true and exits.
quit = true;
If I invert the above code with an “!” than it will run but all my keyboard input routines all act as the key is pressed and when I do press the button it is unpressed.
However, if I put
keys = new bool;
after FSOUND_Init, it acts normal and my problem is fixed. 😮
I am positive that the FSOUND_Init line is at fault because commenting it out returns everything to normal. Commenting out fmod.h does nothing nor does commenting loading sound files or playing streams.
I don’t know if this is an FMOD problem, g++ or what not, but any explanation would be great.
- hara asked 12 years ago
Thanks for the response.
However, it doesn’t explain why it works when I place the line of code after the line and not when it is just one line before. Could this be a compiler bug?
I didn’t think FMOD was “corrupting” my data, but I don’t know how a line swap such as this could solve the problem.
static is not used with my keys dynamic array
Also again the wierd phenomenom (when the line is before the FSOUND_Init) is that if I bypass the VK_ESCAPE whether through commenting or “!”, all my other input values become inverted, up becomes down, down becomes up.
Remember this is more of a need of an explanation than a problem to be solved because the code works fine as is right now
Please login first to submit.