|
GlistEngine
|
#include <gBasePlugin.h>


Public Member Functions | |
| gBasePlugin () | |
| virtual | ~gBasePlugin () |
| virtual void | setup () |
| virtual void | update () |
| virtual void | charPressed (unsigned int unicode) |
| virtual void | keyPressed (int key) |
| virtual void | keyReleased (int key) |
| virtual void | mouseMoved (int x, int y) |
| virtual void | mouseDragged (int x, int y, int button) |
| virtual void | mousePressed (int x, int y, int button) |
| virtual void | mouseReleased (int x, int y, int button) |
| virtual void | mouseScrolled (int x, int y) |
| virtual void | mouseEntered () |
| virtual void | mouseExited () |
| virtual void | onEvent (gEvent &event) |
Public Member Functions inherited from gRenderObject | |
| gRenderObject () | |
| int | getScreenWidth () |
| int | getScreenHeight () |
| void | pushMatrix () |
| void | popMatrix () |
Public Member Functions inherited from gObject | |
| gObject () | |
| void | logi (std::string message) |
| void | logd (std::string message) |
| void | logw (std::string message) |
| void | loge (std::string message) |
| void | logi (std::string tag, std::string message) |
| void | logd (std::string tag, std::string message) |
| void | logw (std::string tag, std::string message) |
| void | loge (std::string tag, std::string message) |
Static Public Attributes | |
| static std::list< gBasePlugin * > | usedplugins |
Static Public Attributes inherited from gObject | |
| static const int | LOGLEVEL_SILENT |
| static const int | LOGLEVEL_DEBUG |
| static const int | LOGLEVEL_INFO |
| static const int | LOGLEVEL_WARNING |
| static const int | LOGLEVEL_ERROR |
Additional Inherited Members | |
Static Public Member Functions inherited from gRenderObject | |
| static void | setScreenSize (int screenWidth, int screenHeight) |
| static void | setUnitScreenSize (int unitWidth, int unitHeight) |
| static void | setScreenScaling (int screenScaling) |
| static void | enableShadowMapping () |
| static void | disableShadowMapping () |
| static bool | isShadowMappingEnabled () |
| static gRenderer * | getRenderer () |
| static void | destroyRenderer () |
| static void | createRenderer () |
Static Public Member Functions inherited from gObject | |
| static std::string | gGetAppDir () |
| static std::string | gGetAssetsDir () |
| static void | gSetAssetsDir (std::string assetsDir) |
| static std::string | gGetFilesDir () |
| static std::string | gGetImagesDir () |
| static std::string | gGetFontsDir () |
| static std::string | gGetModelsDir () |
| static std::string | gGetTexturesDir () |
| static std::string | gGetShadersDir () |
| static std::string | gGetSoundsDir () |
| static std::string | gGetDatabasesDir () |
| static std::string | gGetVideosDir () |
| static void | setCurrentResolution (int scalingNo, int currentResolutionNo) |
Static Protected Attributes inherited from gRenderObject | |
| static bool | isshadowmappingenabled |
Static Protected Attributes inherited from gObject | |
| static int | renderpassnum |
| static int | renderpassno |
| static int | releasescaling |
| static int | releaseresolution |
This class should be extended whenever you are developing a new plugin for your project.
Developers should add their plugins inside ../dev/glist/glistplugins folder. If the folder does not exist, it should be added. The file structure inside of the glistplugins should be like 'glistplugins/gipPlugin'. Every plugin folder should have atleast a src folder with .cpp and .h files of that plugin inside it.
Plugins should be classes that help the project by reducing the amount of code that's being repeated. For example, buttons are a way to run certain functions at the click of a mouse on a certain area. In that case a plugin, such as gipButton, can be used to reduce the amount of code that's being written inside the mouse state functions for the current canvas.
When naming the plugins, developers are encouraged to add the 'gip' prefix to whichever plugin that's being created. Ex: gipButton, gipMenu, gipTitle. It's important to keep this naming convention, as that makes reading the file structure easier for the whole team if a developer has one. If not, it should still be used for when publishing the code online.
gBasePlugin is a class that gets updated by the engine and therefore gets updated at the same time as other classes that has update function.
The functions in this class should never be called manually, as that's handled by the engine, and doing so might raise errors that are unknown.
| gBasePlugin::gBasePlugin | ( | ) |
|
virtual |
|
virtual |
This function gets the unicode representation of the pressed key as it's parameter.
Can be either used for printing or drawing the key that's been pressed, or for the input controls.
| key | Unicode representation of the pressed key on the keyboard. |
|
virtual |
Gets called each time a key is pressed on the keyboard.
If the developer wants the plugin to do something when a key is being pressed, the functionality should be defined in this function.
This function should only contain a code that updates a keystate, with some exceptions. Not doing so might lead to a spaghetti code.
| key | The keycode of the key that has been pressed. |
|
virtual |
Gets called each time a key is released on the keyboard.
If the developer wants the plugin to do something when a key is being released, the functionality should be defined in this function.
This function should only contain a code that updates a keystate, with some exceptions. Not doing so might lead to a spaghetti code.
| key | The keycode of the key that has been released. |
|
virtual |
Gets called every time the mouse is being dragged on the current canvas.
This function is triggered when the mouse is being moved with a mouse button currently being pressed. For that, as long as a mouse button is being pressed while the mouse is being moved on the canvas, this function cancels the trigger on the mouseMoved() function.
| x | Mouse's current x coordinate on the canvas space |
| y | Mouse's current y coordinate on the canvas space |
| button | The mouse button that's being pressed while moving the mouse |
|
virtual |
Gets called when the mouse enters the current canvas.
This function gets called only once when the cursor enters the current canvas and does not get called repeatedly while inside the canvas. And for the cursor to enter the canvas, it has to exit the canvas once.
|
virtual |
Gets called when the mouse exits the current canvas.
This function also gets called once when the cursor exits the current canvas, and does not get called repeatedly while outside the canvas.
|
virtual |
Gets called every time the mouse moves on the current canvas.
| x | Mouse's current x coordinate on the canvas space |
| y | Mouse's current y coordinate on the canvas space |
|
virtual |
Gets called when a mouse button has been pressed inside the current canvas.
As this function immediately gets triggered when a mouse button is clicked on the current canvas, if not intended, most click events should be handled inside the mouseReleased function.
If an immediate response is needed for an action, use this function instead.
| x | Mouse's x coordinate when the button was pressed. |
| y | Mouse's y coordinate when the button was pressed. |
| button | The mouse button that has been pressed. |
|
virtual |
Gets called when a mouse button has been released inside the current canvas.
This function should be used for the events that needs to be triggered after a mouse button click, hence when the button is released.
| x | Mouse's x coordinate when the button was released. |
| y | Mouse's y coordinate when the button was released. |
| button | The mouse button that has been released. |
|
virtual |
Gets called whenever the mouse wheel has been scrolled.
If the mouse that's being used by the user is a normal mouse, it'll always return the y axis movements as a parameter.
The minimum value both axises can receive is 0, which represents the mouse scroll not being moved on that axis. The value's magnitude is determined by how fast the scroll has been moved on that axis.
| x | If greater than 0, mouse is scrolled to the right, if less then 0, it's been scrolled to the left. |
| y | If greater than 0, mouse is scrolled up, if less then 0, it's been scrolled down. |
|
virtual |
|
virtual |
Starting point for each plugin that extends this class.
This function gets called once when this class is instantiated, and is called after the constructor.
Almost every initialization that a plugin has to do, should be made in this function. Certain class functions such as gImage's loadImage, should also be called in this function as it initializes the pixel data for the image.
setup should not be used for re-initalization of variables. Meaning, this function should not be called anywhere in the code, as it might raise some unwanted errors that might be hard to track.
|
virtual |
This function gets called each and every engine update tick. All logic, except the ones including mouse's states, that's related to updating the plugin should be written in this function and this function only.
For the better usage of this function, every functionality that should be updated, should get seperated into different functions and should be called here to allow maintaining the code clean and find errors quicker. Meaning, this function should only hold (other than some exceptions) function calls.
If the plugin should be drawn, it should be in a seperate draw function, then be called in the draw function that belongs to the current canvas.
Exceptions of not using only functions in update should be conditions, that allows/disallows functions to be called.
|
static |
All the plugins that extends this class should add themselves into this deque container in their constructor, as this is not a plugin-specific variable.