Is there a design pattern for functions with many parameters?

Started by
10 comments, last by ApochPiQ 14 years, 11 months ago
Here's how I do it:

struct Sprite {    Sprite(const char *_path, float _tx=0, float _ty=0, float _tw=0, float _th=0) : path(_path), tx(_tx), ty(_ty), tw(_tw), th(_th) {    };    const char *path;    const float tx, ty;    float tw, th;};struct Rotate {    Rotate(float _a=0, float _cx=0, float _cy=0) : a(_a), cx(_cx), cy(_cy) {    };    float a;    float cx, cy;};namespace R {    void DrawSprite(Sprite *, float x, float y, float w, float h, const Rotate *r=NULL, float z=0);}


So a call looks like
R::DrawSprite(&Sprite("bg.png"), 0, 0, 800, 600);
Anthony Umfer
Advertisement
Quote:Original post by Sneftel
....wwwwait.


ROFL - didn't even think about that [lol]

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

This topic is closed to new replies.

Advertisement