I have been working through these tutorials for a while now. I have been stuck a few times, but managed to overcome it on my own or through some very helpful posters on here.
I have the program all and running. The program displays to circles of the same size and you are meant to move one circle towards the other and they will collide together. Once they meet, the circle stops.
The problem I am having is with keyboard input. I've got it working in previous tutorials, but I have been slowly changing my code to spread across multiple header files and source files to make it easier to read.
I can't upload the project because it's too big as a whole. I also have trouble getting code to appear properly without it looking like a mess and readable on here.
I guess I will upload an image of each section that I am having trouble with.
Okay, from the image. The first section is where I poll for events. I then try to retrieve input for my dot object. I send that same Event structure to the function which is shown in the second section. It checks for the key down event and checks the type of key that was pressed and increases or decreases the velocity of the circle depending on the key that was pressed. It also checks to see if that key was released and then sets the velocity to 0 making the circle stop moving. Again, if nothing was pressed, it goes back to the first section and checks to see if the type of event was a quit event, control is returned to the main function in the third section.
In the third section, if the function returned false, quit becomes true and the program exits. This event works, it quits when I press on the 'X'. If I didn't press 'X', the program should return control to main and move the circle as shown in the function moveSprites(), clears the screen to white, displays the circles, flips the back buffer and caps the frame rate to 20 FPS.
It seems like a lot to follow, but for some reason, the circle just isn't moving. I've been through my code a hell of a lot and I can't see what the problem is. I've compared it to a previous SDL project and I've only changed a few things, and all I have done is handled all of my input inside the SDLManager class. I've even tried changing this project to closely match my previous project and it's still not working.