Jump to content
  • Advertisement
Sign in to follow this  
suliman

rendering circular progression of sprite?

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

Hi

Im using an old 2d engine (c++) called HGE and im trying to render sprites in "circular progression" so I can make hearts (or whatever) render from 0% to 100 % (25% would show a 1/4 pie of the sprite on screen, lets say starting at 12 oclock and going until 3 oclock).

 

I can change the texture rect of the sprite (what pixels of the texture to make up the sprite), but that must be rectangular (pos x, pos y, width, height). Is that typical for engines?

 

If i could set the area however i wanted i could just calculate some points using angles and trigonometry but it seems I cannot...

 

I cant use shaders. Other option is to render to another target (not screen) first and modify it by rotation and cancel out a semi-circle of the original sprite using multiply colors but that seems messy...

 

Any tips?

Edited by suliman

Share this post


Link to post
Share on other sites
Advertisement
Using a triangle fan that "unfurls" as the progress increases is the typical way, but you said you can't use that. I'm curious why not. Is HGE an extremely useless engine or something?

Using a shader is for more advanced shapes, but you said you can't use that either.

Your only remaining option is to have several textures: each texture is a specific % of progression, and you pick the one which represents the value closest to your actual progression value. Horribly inefficient, but it works. Edited by Nypyren

Share this post


Link to post
Share on other sites
10 or 12 steps is sufficient I think, you won't see the the difference between 38 and 39 percent.

Can you use another sprite as mask, or control alpha channel from another sprite? Then you can pre-build those mask sprites and apply them.

Share this post


Link to post
Share on other sites

Can you define an alpha ref value for alpha test rendering of the sprites? (not just the usual pink mask)

if you can, you can draw a gradient into the alpha channel that defines the "progress" and you could control it with the alpha ref value.

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!