An Multi Thread SDI application
-
Hi, I want to develop a Multithread SDI application where a ball(drawing an ellipse) is created for every thread. The user is given the option of selecting N no of balls ( say N < 5). The trajectory/movement of the ball is random of each other. These bounce-off once they hit any one of the sides of the client rect. Assume that I have the points through which each ball has to traverse (which is different for each ball), how do i start of with this application?
-
Hi, I want to develop a Multithread SDI application where a ball(drawing an ellipse) is created for every thread. The user is given the option of selecting N no of balls ( say N < 5). The trajectory/movement of the ball is random of each other. These bounce-off once they hit any one of the sides of the client rect. Assume that I have the points through which each ball has to traverse (which is different for each ball), how do i start of with this application?
I never made an application like this, but do you think it's necessairy to create for each ball a thread? If i should make it, i create a class Ball and instanciate for each ball a new object. Because the drawing is made (in every case) at the main thread (The GUI-Thread) Normally the balls are flying with the same speed, so with a timer you redraw each time the new position of the balls. The new position of the ball is calculated into the object. I hope i don't say bullshit :)
-
Hi, I want to develop a Multithread SDI application where a ball(drawing an ellipse) is created for every thread. The user is given the option of selecting N no of balls ( say N < 5). The trajectory/movement of the ball is random of each other. These bounce-off once they hit any one of the sides of the client rect. Assume that I have the points through which each ball has to traverse (which is different for each ball), how do i start of with this application?
-
I never made an application like this, but do you think it's necessairy to create for each ball a thread? If i should make it, i create a class Ball and instanciate for each ball a new object. Because the drawing is made (in every case) at the main thread (The GUI-Thread) Normally the balls are flying with the same speed, so with a timer you redraw each time the new position of the balls. The new position of the ball is calculated into the object. I hope i don't say bullshit :)
baerten wrote:
I never made an application like this, but do you think it's necessairy to create for each ball a thread?
What I had in mind was for each thread, within that thread, I Create a ball object and in a while loop, get the necessary paramerers (trajectory) of the ball by making call functions. Periodically I keep updating the UI with the info.
-
baerten wrote:
I never made an application like this, but do you think it's necessairy to create for each ball a thread?
What I had in mind was for each thread, within that thread, I Create a ball object and in a while loop, get the necessary paramerers (trajectory) of the ball by making call functions. Periodically I keep updating the UI with the info.
You really don't need to be using a thread for each ball. As another poster said, create an instance of a class for each and update the class on each loop of your code. You also might want to do some searching for an algorithm called "collision detection" which is almost exactly what you are trying to accomplish.
Waldermort
-
Hi, I want to develop a Multithread SDI application where a ball(drawing an ellipse) is created for every thread. The user is given the option of selecting N no of balls ( say N < 5). The trajectory/movement of the ball is random of each other. These bounce-off once they hit any one of the sides of the client rect. Assume that I have the points through which each ball has to traverse (which is different for each ball), how do i start of with this application?