Sign in to follow this  

need help understanding sprite rendering in windows

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

what do I need to do to render sprites in windows using C++ and what do I need to do to implement some form of hit-detection in windows. I am a beginner C++ coder.

Share this post


Link to post
Share on other sites
Can you describe what you mean by "sprite?" That term has several meanings.

Also, what do you mean by "hit-detection?" Do you mean picking something with the mouse, or collision detection between objects.. ?

Share this post


Link to post
Share on other sites
Since there's not much info to go on, I'll assume you're just trying to display a bitmap "sprite" inside a window...and by window, I mean the background of a win32 application. I'll also assume that you're not using any form of library or "engine" and you're looking for win32 API calls.

You'll want to look at BitBlt(), for displaying the bitmap. A pretty cut-and-dry basic tutorial

As for collision detection, if you're doing it with bitmaps, on a win32 window, you already have all the information you need. You know where your bitmap is being drawn, and you know how wide/tall it is, so figuring out collision should be a matter of saying, does sprite X's dimensions at all overlap with sprite Y's.

Share this post


Link to post
Share on other sites
If you're looking for a little more abstraction than bare win32 BitBlt calls*:

SDL is good for simple image loading and basic 2d rendering, you can also use it for cross-platform window setup to create an OpenGL context (which is better for rendering than SDL's basic calls.)

Alternatively you could take a look at XNA and DirectX.

*(++AverageMidget)

Share this post


Link to post
Share on other sites

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