Hi,
I am rather new to programming C++, mostly I program in C# and VB. If this is a stupid question, sorry for that. I always try to solve the problems I face by myself, but I find this problem a bit harder to solve.
What I am trying is to make a game with GapiDraw with a object oriented framework I want to build. For the GUI, I made a button-class. lButtonImage is of type CGapiSurface and is a property of CMensButton. All is going well, but when I try to initialize the surface, I get error -932839296, Surface not initialized. Here is the code. I am aware of the fact that I do not use standard naming conventions. I will change that soon, first I want to get the basic things right.
I use this in my calls:
If someone can help me out with this, I would be very grateful. Thanks in Advance!
Hiu.
I am rather new to programming C++, mostly I program in C# and VB. If this is a stupid question, sorry for that. I always try to solve the problems I face by myself, but I find this problem a bit harder to solve.
What I am trying is to make a game with GapiDraw with a object oriented framework I want to build. For the GUI, I made a button-class. lButtonImage is of type CGapiSurface and is a property of CMensButton. All is going well, but when I try to initialize the surface, I get error -932839296, Surface not initialized. Here is the code. I am aware of the fact that I do not use standard naming conventions. I will change that soon, first I want to get the basic things right.
- Code:
class CMensButton
{
RECT ButtonSize;
long srcX;
long srcY;
long srcWidth;
long srcHeight;
public:
__declspec(property(get = _getLButtonImage, put = _setLButtonImage)) CGapiSurface lButtonImage;
CMensButton( )
{
//nError = imgMain->CreateSurface(TEXT("mainmenu.gfx"));
_lButtonImage=new CGapiSurface();
};
virtual ~CMensButton() {};
CGapiSurface _setLButtonImage( TCHAR* anImagePath )
{
_lButtonImage->CreateSurface( anImagePath );
return *_lButtonImage;
}
CGapiSurface _getLButtonImage()
{
return *_lButtonImage;
}
private:
CGapiSurface *_lButtonImage;
};
I use this in my calls:
- Code:
// This is in my class as local variable
CMensButton *appButton[4];
// This is in my initGFX() function, which is called in the
// CreateSurfaces() function.
appButton[0] = new CMensButton();
appButton[0]->ButtonSize.left = 0;
appButton[0]->ButtonSize.right = 120;
appButton[0]->ButtonSize.top = 0;
appButton[0]->ButtonSize.bottom = 30;
appButton[0]->lButtonImage = TEXT("mainbuttons.gfx");
If someone can help me out with this, I would be very grateful. Thanks in Advance!
Hiu.