Results 1 to 12 of 12

Thread: Flicker free movement

  1. #1

    Thread Starter
    Addicted Member hypnos's Avatar
    Join Date
    Aug 2000
    Location
    UK
    Posts
    183

    Red face Flicker free movement

    Hi all,
    I have a ball bouncing around the screen for a laugh. The trouble is, it flickers quite a lot Is there a method of moving things about the screen without any flicker?

    Cheers

  2. #2
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    You can us C++ if you want to try these kinds of a GDI stuff
    Baaaaaaaaah

  3. #3
    Zaei
    Guest
    Set AutoRedraw to True.

    Z.

  4. #4
    Member
    Join Date
    Jul 2001
    Location
    Minneapolis, MN USA
    Posts
    32
    Hypnos ...

    You basically need to do a "backbuffer" technique to make things more visually smooth using VB ...

    So, if you are drawing your ball using VB's built-in .PaintPicture or .Circle methods, then you should have a hidden PictureBox the size of your displayed surface (on-screen Form or PictureBox) ... then you do something like:

    1> Clear your picBackBuffer (hidden picture box) with something like picBackBuffer.Cls or picBackBuffer.Picture = LoadPicture()
    2> Draw everything onto your picBackBuffer
    3> Transfer everything to the displayed surface with something like picViewPort.Picture = picBackBuffer.Image

    You'll want to make sure your picture boxes have .AutoRedraw = True, and .ScaleMode = 3-pixel to make things work better.


    Then ... if you want to improve things, you can learn to use Memory-based DC's and the GDI's bitblt. Here's a good starter tutorial: www.vbexplorer.com/show.asp?id=188


    Hope that helps ...

    -Bryk


    Edit: Bryk ... Hypnos -- I just went out to your website ... and, sorry for my over-simplified response. From the question, seemed the usual never-did-graphics-before type question ... but you obviously have ... so, do with it what you will.
    Last edited by Brykovian; Jul 31st, 2001 at 04:30 PM.

  5. #5

    Thread Starter
    Addicted Member hypnos's Avatar
    Join Date
    Aug 2000
    Location
    UK
    Posts
    183
    Thanks guys. I just don't like the idea of using an off screen picture box, it seems like a lame and unprofessional way of doing it. Surely there's another way?

  6. #6
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    You can load files directly into memory using offscreen DCs. They are like the .hDC property of pictureboxes and forms.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  7. #7
    Member
    Join Date
    Jul 2001
    Location
    Minneapolis, MN USA
    Posts
    32
    Originally posted by hypnos
    Thanks guys. I just don't like the idea of using an off screen picture box, it seems like a lame and unprofessional way of doing it. Surely there's another way?
    Hypnos ... Check out my original post ...
    Then ... if you want to improve things, you can learn to use Memory-based DC's and the GDI's bitblt. Here's a good starter tutorial: www.vbexplorer.com/show.asp?id=188
    Except that I should have given you the link to this tutorial instead: www.vbexplorer.com/show.asp?id=189 ... it's the "Part 2" of the series, and Memory-based DC's are discussed toward the bottom of the page.

    -Bryk

  8. #8
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I believe Fox has a tutorial on them, it didn't work for me though.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  9. #9
    Zaei
    Guest
    And again, as my post said, you can set AutoRedraw to True.

    Does anyone even read what i write?

    Z.

  10. #10
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    I did
    Baaaaaaaaah

  11. #11
    Member
    Join Date
    Jul 2001
    Location
    Minneapolis, MN USA
    Posts
    32
    Originally posted by Zaei
    And again, as my post said, you can set AutoRedraw to True.

    Does anyone even read what i write?

    Z.
    I read it, Z ... but sometimes things still flicker, if you're doing the screen-clearing/drawing combo directly to the displayed object, even with .AutoRedraw=True ...

    -Bryk

  12. #12
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    if you're doing the screen-clearing/drawing combo directly to the displayed object, even with .AutoRedraw=True ...
    depends where you're blitting at, if that's even what the case is
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width