To1ne, don`t give up. It seems you have some things to learn about C++ yet, but you will finally get there.
To1ne wrote:But how do I use the arguments "BetaGUI::Button*" & "BetaGUI::FocusState" ?
Something like:
Code: Select all
class BetaGUIListener : public BetaGUI::GUIListener
{
public:
void do_sth(BetaGUI::Button*, BetaGUI::FocusState)
{
if (Button == mGUI_ExitButton)
mShutdown = true;
}
};
doesn't work because "mGUI_ExitButton" and "mShutdown" are not yet declared.
Or do I have to make a new function for every button? Or place the code somewhere else?
They are declared in the your ExampleApplication class, so using them in BetaGUIListener (or whatever the child of BetaGUI::GUIListener is called) means they are out of scope.
You might as well put the do_sth() method in your ExampleApplication class and let it derive BetaGUI::GUIListener itself. Then you dont have to worry about scope. This is possibly a better
way to do it than in my somewhat messy example. I just wanted some function to get called, you know, from there on I know what to do ..
The most critcal pieces of code are this:
Code: Select all
mGUI_ExitWindow = mGUI->createWindow(100,100,320,164, "betagui", BetaGUI::WFT_MOVE, "SceneNode Inspector", mBetaGUIListener);
mGUI_ExitButton = mGUI_ExitWindow->createButton(8,-4, "Cancel", (BetaGUI::ButtonMethodPtr) &BetaGUIListener::do_sth);
and this:
Code: Select all
class BetaGUIListener : public BetaGUI::GUIListener
{
public:
void do_sth(BetaGUI::Button*, BetaGUI::FocusState)
{
//add your code here
}
};
Because they show how you can get hold of the the crucial last paramter for the BetaGUI::createWindow() and BetaGUI::createButton() methods, telling BetaGUI which functions are to get called.
Also try to understand how to create and move the mouse pointer and inject its position to BetaGUI.
The rest of my code is not really important and can be written much cleaner if you have the time.
If its over your head right now, better start with the more basic problems of writing your own mouse and keyboard input and not calling the ExampleApplicationFrameListener, that helped me a lot. I think it is this tutorial:
http://www.ogre3d.org/wiki/index.php/Basic_Tutorial_4
What I would like to see is that someone with a deeper knowledge puts up a minimal BetaGUI application, for absolute beginners like To1ne and me .. It should not require a lot of code.