-  [WT]  [PS]  [Home] [Manage]

[Return]
Posting mode: Reply
  1.   (reply to 5356)
  2. (for post and file deletion)
/pr/ - Programming
  • Supported file types are: C, CSS, DOC, DOCX, GIF, H, JAVA, JPG, PDF, PNG, SVG, SWF, TXT, WEBM
  • Maximum file size allowed is 10000 KB.
  • Images greater than 200x200 pixels will be thumbnailed.
  • Currently 437 unique user posts. View catalog

  • Blotter updated: 2018-08-24 Show/Hide Show All

Movies & TV 24/7 via Channel7: Web Player, .m3u file. Music via Radio7: Web Player, .m3u file.


Neckbearded Basement Dweller 20/03/10(Tue)02:11 No. 5356
5356

File 158380266711.jpg - (111.79KB , 640x480 , aa719ac50c0b1dbb27ba1ede985aae253bee1325-700.jpg )

I'm building a little demo in Win32 using GDI and C. I need multiple instances of sprites with different speeds.
Code is below. The question is, how do I pass an instance to the UpdateSpritePosition function? Pic unrelated.

Currently, I am calling the function like this- UpdateSpritePosition( &rcClient); from WM_PAINT
I need something like- sprite_sp1.UpdateSpritePosition();

// The struct containing sprite information
struct SpriteAnimation
{
int frames;
int direction;
float counter2;
float counter;
float sprite_speed;
float sdrift_speed;
float animation_speed;
float x;
float y;
}SpriteAnimation;

// The function which updates the sprites position/movement
void UpdateSpritePosition( RECT* prc){}

// The sprite instances defined in WM_CREATE
struct SpriteAnimation sprite_sp1 = {0, 0, 0, 0, 0.07, 0.04, 0.05, 83, -7};
struct SpriteAnimation sprite_sp2 = {0, 1, 0, 0, 0.04, 0.04, 0.05, 202, -24};
struct SpriteAnimation sprite_sp3 = {0, 0, 0, 0, 0.02, 0.04, 0.05, 333, -36};





Delete post []
Password  
Report post
Reason