need help understanding sprite rendering in windows

Started by
3 comments, last by M2tM 13 years, 7 months ago
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.
Advertisement
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.. ?

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

I am trying to render bitmap sprites on windows(like images).Also how to calculate basic Collision between the sprites.
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.
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)
_______________________"You're using a screwdriver to nail some glue to a ming vase. " -ToohrVyk

This topic is closed to new replies.

Advertisement