My background: I am a 18-year-old student from Germany and have some programming experience in different languages, however I have so far not used C++ very much.
My aim: I want to write a simple Tetris game using C++ and the SDL library. I have already used the SDL library to some extent in a previous C++ program of mine that I didn't finish.
My question: I am a bit lost when it comes to implementing the game logic so I hope you can help me. This is only about the game logic, not about the engine and so on. I thought I'd use a two-dimensional array (vector) of ints to store the tetris field whereas the values in the array represent the colors of the tetris stones. E.g., a value of zero means, there is no stone at this position, 1 is for red, 2 to for blue and so forth.
But then I need an extra struct or class or something to store the current element that is moving down until it hits an existing stone. And I would need two simultaneous loops running concurrently, one for moving the current element down step by step and another one for tracking the keyboard input.
If anyone has an idea how to implement this reasonably please don't hesitate to post it.
Thanks a lot, David.