Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. An Multi Thread SDI application

An Multi Thread SDI application

Scheduled Pinned Locked Moved C / C++ / MFC
questiongraphicslounge
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marimuthu r
    wrote on last edited by
    #1

    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?

    R B C 3 Replies Last reply
    0
    • M Marimuthu r

      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?

      B Offline
      B Offline
      baerten
      wrote on last edited by
      #2

      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 :)

      M 1 Reply Last reply
      0
      • M Marimuthu r

        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?

        R Offline
        R Offline
        Russell
        wrote on last edited by
        #3

        Marimuthu.pesit wrote:

        how do i start of with this application?

        this[^] is a good article to start. :rose:.


        Russell

        1 Reply Last reply
        0
        • B baerten

          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 :)

          M Offline
          M Offline
          Marimuthu r
          wrote on last edited by
          #4

          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.

          W 1 Reply Last reply
          0
          • M Marimuthu r

            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.

            W Offline
            W Offline
            Waldermort
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • M Marimuthu r

              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?

              C Offline
              C Offline
              Cliff Hatch
              wrote on last edited by
              #6

              Your application sounds very similar to the sample program MTGDI in the MSDN Library. It might help you get started. MTGDI[^] Best Regards Cliff

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups