Jump to content
  • Advertisement
Sign in to follow this  
Code Is Your Friend

An array of calls?

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

Is it possible to create an array of say, SetPixel() each one containging its own coords (X, Y), and possibly an RGB value? Say you wanted to make an arrow of pixels that would be red, could you use an array to create the arrow, then just make calls to it to render it to the screen? Thanks, Matt

Share this post


Link to post
Share on other sites
Advertisement
That is pretty much how images are drawn, but on the hardware level and without deterministic logic like yours. On the hardware, all you have is a sprite (2D array) and the hardware just takes the block and BitBlts it onto something. what your asking is to just put one pixel down into a specific place. This forces the software to move pointers instead of just incrementing their position by 1.

Why not try making a mask?

Share this post


Link to post
Share on other sites
Quote:
Original post by Code Is Your Friend
Is it possible to create an array of say, SetPixel() each one containging its own coords (X, Y), and possibly an RGB value? Say you wanted to make an arrow of pixels that would be red, could you use an array to create the arrow, then just make calls to it to render it to the screen?

Thanks,
Matt


What language are you using?

You can, typically, make a structure that represents the arguments (parameters) to the function (one structure instance contains all the data needed to call), make an array of these structures, and then iterate over the array to make the call with each structure. You can, in many cases, make an array where each element is some kind of kind of representation of a function: a "function pointer", a name that is looked up in a table, a name that is looked up automatically by the language, etc.

But a "call" of a function is a transient thing, even if your language represents the functions themselves as objects. You can no more have an array of calls to a function than you can have a bucket of smiles.

Share this post


Link to post
Share on other sites
Quote:

You can no more have an array of calls to a function than you can have a bucket of smiles.


Haha nice.

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!