Mail Archives: djgpp/1998/03/14/23:01:53
Thank you Sinan, I'll give it a try. A union is a good idea, the two simple
functions and structures that I included are just a minor portion of what I
need to code.
A. Sinan Unur wrote:
> John & Sue Kissell wrote:
> >
> > I need help in how to describe a generic array pointer passed to a
> > function.
>
> i don't think you ment array pointer here.
>
> anyway, for your purposes, you might want to consider the following:
> (i will have to add that this is kinda off-topic, but i thought it might
> be useful. in any case, this sort of C questions would get better
> answers in forums such as comp.lang.c.moderated.)
>
> i have a feeling the code below makes a case for using C++ ;-)
>
> /*
> * constants for different kinds of windows
> * for code that might need the information
> */
>
> #define WT_WINDOW 0
> #define WT_BUTTON 1
> /* etc */
>
> typedef struct TAG_BUTTON_DATA
> {
> int x1;
> int y1;
> int x2;
> int y2;
> int state;
> int frame;
> } BUTTON_DATA;
>
> typedef struct TAG_WINDOW_DATA
> {
> char* title;
> } WINDOW_DATA;
>
> typedef union TAG_DATA
> {
> BUTTON_DATA button;
> WINDOW_DATA window;
> } DATA;
>
> typedef struct TAG_WINDOW_T
> {
> int type;
> int length;
> int height;
> int x;
> int y;
> COLOR_GROUP *color;
> BITMAP *map;
> DATA d;
> } WINDOW_T;
>
> void paste(WINDOW_T *w, BITMAP *m)
> {
> int tmp=mouseflag;
> if (tmp)
> MouseOFF();
> blit(w->map, m, 0, 0, w->x, w->y, w->length, w->height);
> if (tmp)
> MouseON();
> return;
> }
>
> -- Sinan
- Raw text -