Jump to content
  • Advertisement
Sign in to follow this  
alieniZe

bitmap come down

This topic is 3550 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello guys, I started to learn DirectX. I understand now the function "display" and the function with that sound handling. But i want know, that a bitmap come down from the top to the ground pixel for pixel. How can i make that? So far... alien ;D

Share this post


Link to post
Share on other sites
Advertisement
Like have it move a line, pause, then move again, or just have it slide? Either way you need to have something that pauses for a certain length of time, changes the Y coordinate of the bitmap, then redraw with the new Y value.

Share this post


Link to post
Share on other sites
I want that it slides over the window. But when i make it with a "for" or "while" loop, it doesn't work. It didnt show me then the picture sliding.

Share this post


Link to post
Share on other sites
you need to change the Y coordinate that you are drawing the bitmap at each time you call render. so this means clear the screen and redraw the bitmap. some code would be helpful like post your for or while loop.

Share this post


Link to post
Share on other sites
no, im using directX...

when i make it with my for loop, it doenst come slow down. Its just a big distorted image on the screen.

Share this post


Link to post
Share on other sites
Quote:
Original post by alieniZe
no, im using directX...

when i make it with my for loop, it doenst come slow down. Its just a big distorted image on the screen.
Because you're not rendering it - just moving it. Your code does this:
  • Move the bitmap 100 times.
  • Draw it.

    You want:
  • Move the bitmap 1 line
  • Draw it
  • Move the bitmap another line
  • Draw it
  • Etc

    That means you need to do a whole render loop (Clear, BeginScene, render, EndScene, Present) each time you move your bitmap.

    Share this post


    Link to post
    Share on other sites
    thanks a lot, i understand my problem now, but i dont know how i can fix it ;/

    U told me a way, but i cant make it to a code :/

    mfg alien

    Share this post


    Link to post
    Share on other sites

    Well, it depends on how the code from your book is structured. Typically you'll have some kind of render loop which will call some main draw and/or update method X times per second. In this method you'd typically increase a variable y coordinate and then use dsply.Blt(someX, yourY, yourSprite); to draw it to the screen at the new position.

    Going from your last topic I don't know if this is the case with your code, so it'll probably only get confusing to try and explain the general approach further. Looking at the book index you posted last time, you might want to check out paragraph 3.2 (page 138-159), since that seems to deal with movements.

    This way you know the info correctly applies to the code you're using, which should prove more useful than our random guesses as to how your code works [smile]

    Share this post


    Link to post
    Share on other sites
    Sign in to follow this  

    • Advertisement
    ×

    Important Information

    By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

    We are the game development community.

    Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

    Sign me up!