You're missing a break statement in the end of your SDL_MOUSEBUTTONDOWN event handler, resulting in unintentional fall-through to the SDL_KEYDOWN handler. Just add a break after the call to draw_polygon() and you're good to go; you should also add a break to the end of your SDL_KEYDOWN handler to avoid falling through into the default case, though that's not a problem now since the default case doesn't do anything, but if it does in the future, you'll have another bug EDIT You also have a buffer overflow sizeof(color) is the total size in bytes of the array, which in this case is 12 (3 values times 4 bytes/value). So, you're looping 13 times (12, plus 1 for using instead of ) instead of 3 when changing the color.It just happens that the compiler has laid out the local variable quit immediately after color so you're accidentally writing out over quit plus other unknown data on the stack The fix for this is to divide by the size of the array member when calculating the number of members.
This is often done using a macro: define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)0)) ... for (int I = 0; I.
You're missing a break statement in the end of your SDL_MOUSEBUTTONDOWN event handler, resulting in unintentional fall-through to the SDL_KEYDOWN handler. Just add a break after the call to draw_polygon() and you're good to go; you should also add a break to the end of your SDL_KEYDOWN handler to avoid falling through into the default case, though that's not a problem now since the default case doesn't do anything, but if it does in the future, you'll have another bug. EDIT You also have a buffer overflow.
Sizeof(color) is the total size in bytes of the array, which in this case is 12 (3 values times 4 bytes/value). So, you're looping 13 times (12, plus 1 for using The fix for this is to divide by the size of the array member when calculating the number of members. This is often done using a macro: #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)0)) ... for (int I = 0; I.
Hm, I've added the breaks as you suggested, and I'm still having the same problem. – Anthony Clever Apr 14 '10 at 22:53 And that fixed it :D I was stuck in PHP mode apparently. Completely forgot that sizeof() returned the size in bytes in c++, rather than the array's length.
– Anthony Clever Apr 15 '10 at 0:02.
You forgot the breaks at the end of your cases in switches. The switch will continue after a mousedown case and execute the sdl_keydown code, which will behave unpredictable.
You're missing a break statement in the end of your SDL_MOUSEBUTTONDOWN event handler, resulting in unintentional fall-through to the SDL_KEYDOWN handler. Just add a break after the call to draw_polygon() and you're good to go; you should also add a break to the end of your SDL_KEYDOWN handler to avoid falling through into the default case, though that's not a problem now since the default case doesn't do anything, but if it does in the future, you'll have another bug. You also have a buffer overflow.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.