ht have to add VERY fancy controls because of this.
The problems I've been having are with the mouse events that SDL handles. I have my two input function in my system class for the mouse. You pass a variable that represents the button you want to check into the function and the function returns true or false. The major inconvenience is that my input checks in my main loop execute what they do multiple times. I want to have my controls set up so that I place tiles with the left mouse button and the right mouses button scrolls through the tiles on the tile sheet. So when I left click, the tile drawn on the screen to represent what and where you're going to place tiles furiously scrolls through each tile and will continuously to flicker for about one second after not pressing . I would need to make my input functions return true once upon being pressed. I've tried to come up with a solution that looks like(in semi-pseudocode).
Code: Select all
bool input = false;
bool CheckInput(button_name) {
if(mouse.button == button_name && !input) {
input = true;
}
if(mouse.button != button_name) {
input = false;
}
return input;
}
I need a way to have my input functions return true only once. I can't think of another way to do this. I don't want to map every tile to a different key on the keyboard so I can select it. Is there something in SDL that can fix this? I did learn in it about a week so I can get back into game dev quickly, so I may not be familiar with the slightly more advanced stuffs of SDL.
I would much appreciate any advice or tips that you have. Thank you