Whoa...wait just a minute. Both you guys said diffirent things:
int BUTTON::*mx;
int BUTTON::*my;
DIMOUSESTATE BUTTON::*mstate;
int *BUTTON::mx;
int *BUTTON::my;
DIMOUSESTATE *BUTTON::mstate;
So can I do it both ways or what? I have a C++ book but it only talks about static variables for 2 pragraphs. Static variables within classes are memtioned for like one sentence. Aside from that I have another proplem on the same subject (I never got the first deal to work). This time I''ll give real chunks of code not simplified versions.
Int Gui.h I have this:
class CURSOR{private: static LPDIRECTDRAW7 *directdraw; // Talk to directdraw static LPDIRECTDRAWSURFACE *canvas; // Blt icon on this static DIMOUSESTATE *mstate; // Talk to directinput //...skip some stuff...public: //...skip some more stuff... DWORD Interface(LPDIRECTDRAW7 *ddraw, LPDIRECTDRAWSURFACE7 *surface, DIMOUSESTATE *mousestate); //...skipping...}; // End CURSOR dec
And in Gui.cpp
// Globals ////////////////////////////////////////#include "Input.h"#include "Gui.h"//...skipping...LPDIRECTDRAW7 CURSOR::*directdraw = NULL; LPDIRECTDRAWSURFACE7 CURSOR::*canvas = NULL; DIMOUSESTATE CURSOR::*mstate = NULL; //...skipping... // Functions //////////////////////////////////////DWORD Interface(LPDIRECTDRAW7 *ddraw, LPDIRECTDRAWSURFACE7 *surface, DIMOUSESTATE *mousestate){ directdraw = ddraw; canvas = surface; mstate = mousestate; return(GUI_GOOD);} // End CURSOR::Interface
So I compile and get this (3 times):
C:\MSVC\Math\source\Gui.cpp(28) : error C2440: ''='' : cannot convert from ''struct IDirectDraw7 ** '' to ''struct IDirectDraw7 *CURSOR::* ''
There is no context in which this conversion is possible
And if I change the static var stuff in Gui.cpp to this:
LPDIRECTDRAW7 *CURSOR::directdraw = NULL; LPDIRECTDRAWSURFACE7 *CURSOR::canvas = NULL; DIMOUSESTATE *CURSOR::mstate = NULL;
the compiler gives me this (3 times):
C:\MSVC\Math\source\Gui.cpp(28) : error C2065: ''directdraw'' : undeclared identifier
C:\MSVC\Math\source\Gui.cpp(28) : error C2440: ''='' : cannot convert from ''struct IDirectDraw7 ** '' to ''int''
WTF
So I ask again, what I''m I doing wrong?