Sign in to follow this  

bitmap animation

This topic is 3864 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

I am simply trying to animate a bitmap on the screen, here is a code snippet, it works a little bit, but not completely or adequetly. Please let me know if you need more information. void Game_Run() { //this is called once every frame //do not include your own loop here! int x=200,y=200; RECT rect; GetClientRect(global_hwnd, &rect); for (int i=0;i<400;i++) { DrawBitmap(global_hdc, "c.bmp", x++, y++); } }

Share this post


Link to post
Share on other sites
Quote:
    //this is called once every frame
//do not include your own loop here!

I guess someone decided to ignore that.

Store the position (coordinates) of your bitmap outside the Game_Run function, then each time the function is called - remember, it is called once per frame - update the positions and draw once.


int i = 0;
int x = 200, y = 200;

void Game_Run()
{
RECT rect;
GetClientRect(global_hwnd, &rect);

if(i < 400)
{
++x;
++y;
}

DrawBitmap(global_hdc, "c.bmp", x, y);
}


Of course, there are many other things you'll want to do later to improve structure.

Share this post


Link to post
Share on other sites
We're gonna need more if we're going to help you. Looks like you intend to use the GDI, and you're probably working in Visual Studio, but I can't be sure. You told us what you are trying to do, but not whether what you are trying is working or how well it is, if at all.

Share this post


Link to post
Share on other sites

This topic is 3864 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this