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#
  4. slowing down the process

slowing down the process

Scheduled Pinned Locked Moved C#
game-dev
9 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.
  • A Offline
    A Offline
    Argus2
    wrote on last edited by
    #1

    In the old days of basic we used to use a for loop to slow down the processing so the user could see changes that would happen too fast to see. (ie. changes to images in a game or data being displayed. I am trying to show some pictureboxe changes in sequence (not animation), but the process runs so fast I only see the last change, the same with playing several wav sounds I only hear the last one. there should be an easy way to delay the ballance of code from running so the user has time to see or hear the changes. Thanks,

    A G M 3 Replies Last reply
    0
    • A Argus2

      In the old days of basic we used to use a for loop to slow down the processing so the user could see changes that would happen too fast to see. (ie. changes to images in a game or data being displayed. I am trying to show some pictureboxe changes in sequence (not animation), but the process runs so fast I only see the last change, the same with playing several wav sounds I only hear the last one. there should be an easy way to delay the ballance of code from running so the user has time to see or hear the changes. Thanks,

      A Offline
      A Offline
      Amar Chaudhary
      wrote on last edited by
      #2

      how about using timer

      A 1 Reply Last reply
      0
      • A Amar Chaudhary

        how about using timer

        A Offline
        A Offline
        Argus2
        wrote on last edited by
        #3

        as I understand the timer's tick event, it runs whatever method you want at the set amount of ticks. But the rest of the code will be running meanwhile. did I not totaly understand, is there a way to pause the code till the tick event happens? Thanks for your reply.:)

        R 1 Reply Last reply
        0
        • A Argus2

          as I understand the timer's tick event, it runs whatever method you want at the set amount of ticks. But the rest of the code will be running meanwhile. did I not totaly understand, is there a way to pause the code till the tick event happens? Thanks for your reply.:)

          R Offline
          R Offline
          Rob Graham
          wrote on last edited by
          #4

          Do the opposite. Run the animation code only on the tick event.

          A 1 Reply Last reply
          0
          • R Rob Graham

            Do the opposite. Run the animation code only on the tick event.

            A Offline
            A Offline
            Argus2
            wrote on last edited by
            #5

            Thanks: Will have to think about that, it might require 40-50% of my code being inside the tick event. :( but will look at it. Thanks again

            R 1 Reply Last reply
            0
            • A Argus2

              Thanks: Will have to think about that, it might require 40-50% of my code being inside the tick event. :( but will look at it. Thanks again

              R Offline
              R Offline
              Rob Graham
              wrote on last edited by
              #6

              Argus2 wrote:

              it might require 40-50% of my code being inside the tick event.

              You can always call your code from the tick event, it needn't be literally "inside" it.

              1 Reply Last reply
              0
              • A Argus2

                In the old days of basic we used to use a for loop to slow down the processing so the user could see changes that would happen too fast to see. (ie. changes to images in a game or data being displayed. I am trying to show some pictureboxe changes in sequence (not animation), but the process runs so fast I only see the last change, the same with playing several wav sounds I only hear the last one. there should be an easy way to delay the ballance of code from running so the user has time to see or hear the changes. Thanks,

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                Use the Thread.Sleep method to make the thread wait for a number of milliseconds.

                --- b { font-weight: normal; }

                1 Reply Last reply
                0
                • A Argus2

                  In the old days of basic we used to use a for loop to slow down the processing so the user could see changes that would happen too fast to see. (ie. changes to images in a game or data being displayed. I am trying to show some pictureboxe changes in sequence (not animation), but the process runs so fast I only see the last change, the same with playing several wav sounds I only hear the last one. there should be an easy way to delay the ballance of code from running so the user has time to see or hear the changes. Thanks,

                  M Offline
                  M Offline
                  Martin23
                  wrote on last edited by
                  #8

                  System.Threading.Thread.Sleep(1000); will pause the thread for 1000 milliseconds.

                  A 1 Reply Last reply
                  0
                  • M Martin23

                    System.Threading.Thread.Sleep(1000); will pause the thread for 1000 milliseconds.

                    A Offline
                    A Offline
                    Argus2
                    wrote on last edited by
                    #9

                    Thanks that looks like it will work just fine for me.. ;P Thanks Everyone.

                    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