0
0

Using Bloodshed Dev c++

in my main.cc i define an extern bool pointer

[code:4c6byn0g]
extern bool * keys = NULL;
[/code:4c6byn0g]

in my WinMain function I set it equal to a dynamic array

[code:4c6byn0g]
keys = new bool[256];
[/code:4c6byn0g]

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.

[code:4c6byn0g]
if(keys[VK_ESCAPE])
quit = true;
[/code:4c6byn0g]

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
[code:4c6byn0g]
keys = new bool[256];
[/code:4c6byn0g]

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.

  • You must to post comments
0
0

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

  • You must to post comments
0
0

Thanks again for the info.

I’ll take a look into using those tools you described.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.