Line 1:
Line 1:
−
== Foreward ==
== Foreward ==
Line 37:
Line 36:
There are two ways a class instance can be created. LibwiiGui uses both methods. When you want a class to be able to be accessed by any other function, you will want to create it with an asterisk, which declares a pointer to your class. You will want to use this for your main GuiWindow, which should contain the background, and every other window (these other windows will be your menus). You also will want to initially set it to NULL for safety's sake.
There are two ways a class instance can be created. LibwiiGui uses both methods. When you want a class to be able to be accessed by any other function, you will want to create it with an asterisk, which declares a pointer to your class. You will want to use this for your main GuiWindow, which should contain the background, and every other window (these other windows will be your menus). You also will want to initially set it to NULL for safety's sake.
−
<source lang = "c++" >
+
<source lang = "cpp" >
GuiWindow * mainWindow = NULL;
GuiWindow * mainWindow = NULL;
</source>
</source>
Line 43:
Line 42:
These declarations should be at the top of the file, underneath the includes. Then, when using it, you will use ->
These declarations should be at the top of the file, underneath the includes. Then, when using it, you will use ->
−
<source lang = "c++">
+
<source lang = "cpp">
mainWindow->Append(image);
mainWindow->Append(image);
</source>
</source>
Line 49:
Line 48:
If you have a class that is only relavent to the function you are in (e.g. a menu) you will want to declare the instance inside the function:
If you have a class that is only relavent to the function you are in (e.g. a menu) you will want to declare the instance inside the function:
−
<source lang = "c++">
+
<source lang = "cpp">
int menu_function(){
int menu_function(){
GuiWindow menuwindow;
GuiWindow menuwindow;
Line 58:
Line 57:
and then use the dot:
and then use the dot:
−
<source lang = "c++">
+
<source lang = "cpp">
int menu_function(){
int menu_function(){
GuiWindow menuwindow;
GuiWindow menuwindow;