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. Managed C++/CLI
  4. Timer() - anything faster?

Timer() - anything faster?

Scheduled Pinned Locked Moved Managed C++/CLI
performancequestion
8 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.
  • C Offline
    C Offline
    Cyclone_S
    wrote on last edited by
    #1

    I am animating a ball and I need something faster then what I'm getting with the form Timer() control. Is there anything faster that I can use to speed up the animation? Thanks.

    Sander RosselS D L L 4 Replies Last reply
    0
    • C Cyclone_S

      I am animating a ball and I need something faster then what I'm getting with the form Timer() control. Is there anything faster that I can use to speed up the animation? Thanks.

      Sander RosselS Offline
      Sander RosselS Offline
      Sander Rossel
      wrote on last edited by
      #2

      You want less than a millisecond? Our eyes cannot even see such speed. I do not know of anything that is faster than a timer in .NET... If your animation is not running to subtle, maybe you should look for smaller pixels or move the image by more than a dot instead of faster images. No idea how to do that though. Just saying speed might not be the problem.

      It's an OO world.

      C 1 Reply Last reply
      0
      • C Cyclone_S

        I am animating a ball and I need something faster then what I'm getting with the form Timer() control. Is there anything faster that I can use to speed up the animation? Thanks.

        D Offline
        D Offline
        Dave Doknjas
        wrote on last edited by
        #3

        Try System.Diagnostics.Stopwatch

        David Anton Convert between VB, C#, C++, & Java www.tangiblesoftwaresolutions.com

        1 Reply Last reply
        0
        • C Cyclone_S

          I am animating a ball and I need something faster then what I'm getting with the form Timer() control. Is there anything faster that I can use to speed up the animation? Thanks.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Although its examples and downloads use C#, I would recommend you read Timer surprises, and how to avoid them[^]. :)

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          1 Reply Last reply
          0
          • Sander RosselS Sander Rossel

            You want less than a millisecond? Our eyes cannot even see such speed. I do not know of anything that is faster than a timer in .NET... If your animation is not running to subtle, maybe you should look for smaller pixels or move the image by more than a dot instead of faster images. No idea how to do that though. Just saying speed might not be the problem.

            It's an OO world.

            C Offline
            C Offline
            Cyclone_S
            wrote on last edited by
            #5

            I'm testing the collisions with a brick with pixel accuracy. It's the only way I could get the collision working properly.

            L Sander RosselS 2 Replies Last reply
            0
            • C Cyclone_S

              I'm testing the collisions with a brick with pixel accuracy. It's the only way I could get the collision working properly.

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              Cyclone_S wrote:

              It's the only way I could get the collision working properly.

              Obviously there are other ways. Here are a few ideas: 1. you don't need to draw anything to detect collisions, you could do it mathematically. That is modelling rather than animation. The model would generate the exact time and location of the collisions, animation would only be used to show the required frames. 2. even when collision detection is based on actual frames, you don't need to do it in real-time, you could calculate a number of new frames ahead of time (at the expense of more memory), and only show some of them, at the right pace. Either way, you may choose to use floating-point for extra accuracy while calculating, and turn the relevant data into integers when calculating the actual frames. :)

              Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

              Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

              1 Reply Last reply
              0
              • C Cyclone_S

                I'm testing the collisions with a brick with pixel accuracy. It's the only way I could get the collision working properly.

                Sander RosselS Offline
                Sander RosselS Offline
                Sander Rossel
                wrote on last edited by
                #7

                Well, I can't really help there. Although I did find the QueryPerformanceTimer, which looks like it could help you. http://tomtech999.wordpress.com/2008/10/24/using-a-queryperformancetimer/[^] http://stackoverflow.com/questions/1739259/how-to-use-queryperformancecounter[^] Hope that is what you're looking for :) Good luck!

                It's an OO world.

                1 Reply Last reply
                0
                • C Cyclone_S

                  I am animating a ball and I need something faster then what I'm getting with the form Timer() control. Is there anything faster that I can use to speed up the animation? Thanks.

                  L Offline
                  L Offline
                  LiangGuangLin
                  wrote on last edited by
                  #8

                  Timer () only to 1 Ms fastest, write their own a Delay ().

                  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