About Store Forum Documentation Contact



Post Reply 
working with class::
Author Message
Qbound Offline
Member

Post: #1
working with class::
Hi there,

i have a little question about oop and esenthel.

Lets say i have a small class:
Code:
// Header File - CGAME.H
class cgame{
protected:
bool m_bFLAG_Running;
GuiObjs m_GUIOBJS_INTRO;

public:
cgame(){};
~cgame(){};

void Init( void );

void setFLAG_isRunning( bool bFLAG){ m_bFLAG_Running = bFLAG; };
bool getFLAG_isRunning( void ){ return m_bFLAG_Running; };

static void BUTTON_EXIT( PTR );
}

// Source File CGAME.CPP
void cgame::Init( void ){
// Load Login
    if( m_GUIOBJS_INTRO.load( "gui/style/nf/nf_login.gobj" ) )
    {
        // Gui found and loaded
        Gui += m_GUIOBJS_INTRO;

        // GUI Bindings
        m_GUIOBJS_INTRO.getButton("button_login").func( CGAME::BTN_EXIT );
        
    } else return false;
}

void CGAME::BTN_EXIT( Ptr ){ /*setFLAG_isRunning( false );*/ }

I have now the problem that i can not access a non static member of my class and therefore i can not set the FLAG_isRunning to false.
The reason is that i have to set a function pointer in the m_GUIOBJS_INTRO.getButton("button_login").func( >>POINTER HERE<< ).

any hint for me?

cu
Oliver
06-23-2010 05:29 PM
Find all posts by this user Quote this message in a reply
menajev Offline
Member

Post: #2
RE: working with class::
Read some tutorial about oop. You haven't even defined cgame object...
06-23-2010 05:41 PM
Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #3
RE: working with class::
thanks for the comment.
That is not the working code it is only a small test or better said 'pseudo' code to understand the problem and it is right from my brain and not copied smile

cu
Oliver
06-23-2010 05:49 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: working with class::
static void CGAME::BTN_EXIT( CGAME & cgame){ cgame.method();}


m_GUIOBJS_INTRO.getButton("button_login").func( CGAME::BTN_EXIT , T );
06-23-2010 05:58 PM
Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #5
RE: working with class::
Hi Grzegorz,

ah ok... i can use the Ptr for my 'this' pointer?
I thought it would be used by the gui.

it works perferct smile

thanks,
Oliver
06-23-2010 06:07 PM
Find all posts by this user Quote this message in a reply
Post Reply