Chronos 0.0
A advanced 2D rendering and animation system
|
The main manager of chronos. More...
#include <chronos.hpp>
Public Member Functions | |
Manager (Initializer initializer) | |
Constructor for chronos. The initalizer struct with the necessary options to be passed. | |
GLFWwindow * | getWindow () |
Gets a reference to the GLFWWindow. | |
void | drawFrame () |
Draws the current frame to the window. | |
int | addText (Chronos::Engine::TextParams params, std::string fontType, int fontSize) |
Adds text to the window. | |
int | addShape (Chronos::Manager::ShapeParams shapeParams, int texture) |
Adds a textured rectangle to the window. | |
int | addShape (Chronos::Manager::ShapeParams shapeParams) |
Adds a soild color rectangle to the window. | |
void | updateShape (int objectNo, Chronos::Manager::ShapeParams shapeParams) |
Updates the polygon(any) with the new parameters. | |
std::vector< std::pair< int, Chronos::Manager::ShapeParams > > | getShapeDetails () |
void | updateText (int objectNo, Chronos::Engine::TextParams params) |
Updates the text with the new parameters. | |
std::vector< std::pair< int, Chronos::Engine::TextParams > > | getTextDetails () |
Returns the details of all text defined. | |
void | removeObject (int objectNo) |
int | changeBackgroundColor (float r, float g, float b) |
Changes the background color of the window. | |
int | addTexture (std::string texturePath, std::string textureName) |
Loads a texture from file. | |
void | removeTexture (int textureNo) |
Removes the texture from the window. | |
std::vector< TextureDetails > | getTextureDetails () |
Returns the details of all textures defined. | |
void | changePresentMode (std::string presentMode) |
Changes the present mode of the swapchain. | |
std::vector< std::string > | getMSAAModes () |
void | changeMSAA (std::string mode) |
int | addRig (int x, int y) |
void | removeRig (int rigNo) |
void | rigAddBone (int rigNo, int parentNo) |
void | rigRemoveBone (int rigNo, int boneNo) |
void | rigAddChild (int rigNo, int parentNo, int childNo) |
void | rigRemoveChild (int rigNo, int parentNo, int childNo) |
void | rigSetRelX (int rigNo, int boneNo, float relX) |
void | rigSetRelY (int rigNo, int boneNo, float relY) |
void | rigSetLength (int rigNo, int boneNo, float length) |
void | rigSetAngle (int rigNo, int boneNo, float angle) |
void | rigSetParent (int rigNo, int boneNo, int parentNo) |
float | rigGetRelX (int rigNo, int boneNo) |
float | rigGetRelY (int rigNo, int boneNo) |
float | rigGetLength (int rigNo, int boneNo) |
float | rigGetAngle (int rigNo, int boneNo) |
float | rigGetX (int rigNo, int boneNo) |
float | rigGetY (int rigNo, int boneNo) |
int | rigGetParent (int rigNo, int boneNo) |
std::vector< int > | rigGetChildren (int rigNo, int boneNo) |
int | addKeyframeVariable (std::vector< std::pair< float, float > > keyframes) |
void | removeKeyframeVariable (int keyframeNo) |
void | keyframeSetTime (int keyframeNo, float time) |
void | keyframeSetKeyframe (int keyframeNo, int keyframe) |
int | keyframeGetKeyframe (int keyframeNo) |
std::vector< std::pair< float, float > > | getKeyframes (int keyframeNo) |
float | keyframeGetVariable (int keyframeNo) |
Private Attributes | |
Chronos::Engine::Engine | engine |
The backend Vulkan engine, used for rendering the desired shapes and text.s. | |
Chronos::Animation::AnimationManager | animManager |
The main manager of chronos.
Only this class must be used for interfacing with chronos. Do not use the internal classes for this Any changes to the window can be done via this object. Please use only the functions and variables in this class. For more information, refer to the individual methods and variables and the examples
Definition at line 109 of file chronos.hpp.
Chronos::Manager::Manager::Manager | ( | Initializer | initializer | ) |
Constructor for chronos. The initalizer struct with the necessary options to be passed.
For options, refer to the Initializer struct
Definition at line 26 of file manager.cpp.
References Chronos::Manager::Initializer::BackgroundColor, Chronos::Manager::Initializer::WindowHeight, and Chronos::Manager::Initializer::WindowWidth.
|
inline |
Definition at line 457 of file chronos.hpp.
References animManager.
|
inline |
int Chronos::Manager::Manager::addShape | ( | Chronos::Manager::ShapeParams | shapeParams | ) |
Adds a soild color rectangle to the window.
Use this to add a shape rectangle to the window. Please note that this function only supports solid color shapes.
Options for the shape are defined in the ShapeParams struct. The color field in the struct must be filled. For options related to the shape, please refer the struct. To add other types of shapes, such as textured use the other overrides available.
It returns a objectNo that can be used for modifying the shape in other functions in this class
shapeParams | The parameters(x, y, rotation... etc) for the shape |
Definition at line 26 of file managerShapeFunctions.cpp.
References Chronos::Engine::ObjectManager::addObject(), Chronos::Engine::Engine::device, engine, Chronos::Engine::ColoredRectangle::init(), Chronos::Engine::Engine::objectManager, and Chronos::Engine::ColoredRectangle::params.
int Chronos::Manager::Manager::addShape | ( | Chronos::Manager::ShapeParams | shapeParams, |
int | texture | ||
) |
Adds a textured rectangle to the window.
Use this to add a shape rectangle to the window. Please note that this function only supports textured shapes.
Options for the shape are defined in the ShapeParams struct. The color field in the struct is not used, It can be skipped. The texture field must be set to the textureNo of the texture to be used. A texture path must be selected. To add other types of shapes, such as colored , use the other overrides available.
It returns an objectNo that can be used for modifying the shape in other functions in this class
shapeParams | The parameters(x, y, rotation... etc) for the shape) |
texture | The textureNo of the texture to be used |
Definition at line 38 of file managerShapeFunctions.cpp.
References Chronos::Engine::TexturedRectangle::init(), and Chronos::Engine::TexturedRectangle::params.
int Chronos::Manager::Manager::addText | ( | Chronos::Engine::TextParams | params, |
std::string | fontType, | ||
int | fontSize | ||
) |
Adds text to the window.
If you want to add text to the window, this function must be used. It returns an objectNo, that is used for updating, modifyign and removing the text instance One may select the fontType and fontSize from the available options. The fontType and fontSize must be selected from the available options. Font size may be from 6 to 50. The fontType may be one of the following:
An example of how this function is called is:
In the above, params refer to the text parameters that are assumed to be defined and filled. The necessary functions must be defined in the struct. For the options, please refer to the Text struct
params | The necessary parameters needed for rendering text |
Definition at line 26 of file managerTextFunctions.cpp.
References Chronos::Engine::ObjectManager::addObject(), Chronos::Engine::Engine::device, engine, Chronos::Engine::getFontType(), Chronos::Engine::Text::init(), Chronos::Engine::Engine::objectManager, Chronos::Engine::Text::params, and Chronos::Engine::TextParams::text.
int Chronos::Manager::Manager::addTexture | ( | std::string | texturePath, |
std::string | textureName | ||
) |
Loads a texture from file.
If a texture is needed to be loaded from a file, then this function can be used. The texture is loaded from the file and added to the texture manager. The textureNo is returned, which can be used for referencing the texture in other functions.
texturePath | The path of the texture file |
textureName | The name of the texture. This must be unique. |
Definition at line 25 of file managerTextureFunctions.cpp.
References Chronos::Engine::TextureManager::addTexture(), engine, getTextureDetails(), and Chronos::Engine::Engine::textureManager.
int Chronos::Manager::Manager::changeBackgroundColor | ( | float | r, |
float | g, | ||
float | b | ||
) |
Changes the background color of the window.
If changing the background color of the window is desired, then by passing the RGB values to this function, it may be accomplished.
r | Red value |
g | Green value |
b | Blue value |
Definition at line 57 of file manager.cpp.
|
inline |
Definition at line 366 of file chronos.hpp.
References Chronos::Engine::Engine::changeMSAA(), and engine.
|
inline |
Changes the present mode of the swapchain.
The present mode is the mode in which the images are presented to the screen. There are various methods available. this can be used to cap or unlock the framerate, control tearing etc. Some of the presentation modes available are:
mode | The mode to change to. It can be one of the following:
|
Definition at line 356 of file chronos.hpp.
References engine, and Chronos::Engine::Engine::setPresentMode().
void Chronos::Manager::Manager::drawFrame | ( | ) |
Draws the current frame to the window.
This must called every frame during the game loop.
This function updates all the attributes of the objects defined by the user and submitted to chronos. It then submits sthe necessary information to the GPU to render the frame.
Definition at line 52 of file manager.cpp.
|
inline |
Definition at line 482 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 361 of file chronos.hpp.
References engine, and Chronos::Engine::Engine::getAvailableMSAAModes().
std::vector< std::pair< int, Chronos::Manager::ShapeParams > > Chronos::Manager::Manager::getShapeDetails | ( | ) |
Definition at line 52 of file managerShapeFunctions.cpp.
References Chronos::Engine::ColoredRectangle::params, Chronos::Engine::TexturedRectangle::params, Chronos::Engine::TypeColoredRectangle, and Chronos::Engine::TypeTexturedRectangle.
std::vector< std::pair< int, Chronos::Engine::TextParams > > Chronos::Manager::Manager::getTextDetails | ( | ) |
Returns the details of all text defined.
If the details of the text are needed, this function can be used to get the details of all text. It returns a vector of pairs, where the first element is the textNo and the second element is the textParams.
Definition at line 61 of file managerTextFunctions.cpp.
References Chronos::Engine::TypeText.
std::vector< Chronos::Manager::TextureDetails > Chronos::Manager::Manager::getTextureDetails | ( | ) |
Returns the details of all textures defined.
If the details of the textures are needed, this function can be used to get the details of all textures. It returns a vector of TextureDetails, where the textureName, texturePath and textureNo are returned.
Definition at line 41 of file managerTextureFunctions.cpp.
References Chronos::Manager::TextureDetails::height, Chronos::Manager::TextureDetails::textureName, Chronos::Manager::TextureDetails::textureNo, Chronos::Manager::TextureDetails::texturePath, and Chronos::Manager::TextureDetails::width.
GLFWwindow * Chronos::Manager::Manager::getWindow | ( | ) |
Gets a reference to the GLFWWindow.
Since Chronos initialzes the window, along with managing it, the window is with chronos.
However for input handling and advanced window management, chronos will not do this. Instead you are expected to directly call the GLFW functions and define the options yourself.
Definition at line 25 of file manager.cpp.
References engine, and Chronos::Engine::Engine::window.
|
inline |
Definition at line 477 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 487 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 472 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 467 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 462 of file chronos.hpp.
References animManager.
void Chronos::Manager::Manager::removeObject | ( | int | objectNo | ) |
Definition at line 68 of file manager.cpp.
|
inline |
Definition at line 370 of file chronos.hpp.
References animManager.
void Chronos::Manager::Manager::removeTexture | ( | int | textureNo | ) |
Removes the texture from the window.
By referencing the textureNo, the manager removes and destroys the texture from the screen.
textureNo | The reference to the texture |
Definition at line 35 of file managerTextureFunctions.cpp.
|
inline |
Definition at line 372 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 382 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 432 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 452 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 427 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 447 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 417 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 422 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 437 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 442 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 377 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 387 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 407 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 402 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 412 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 392 of file chronos.hpp.
References animManager.
|
inline |
Definition at line 397 of file chronos.hpp.
References animManager.
void Chronos::Manager::Manager::updateShape | ( | int | objectNo, |
Chronos::Manager::ShapeParams | shapeParams | ||
) |
Updates the polygon(any) with the new parameters.
After initializing the shape, if you want to change the parameters of the shape to new attributes, using the shapeNo and passing the shapeParams, the new parameters can be propogated to the shape. The results will be displayed on the next drawFrame()
call.
If textured shape is chosen then the color field will have no effect on the shape. The texture will be always be displayed.
objectNo | The objectNo reference to the shape. Generated during `addObject() call. |
shapeParams | The updated shape parameters to update the shape with. |
Definition at line 70 of file managerShapeFunctions.cpp.
References Chronos::Engine::ColoredRectangle::params, Chronos::Engine::TexturedRectangle::params, Chronos::Engine::TypeColoredRectangle, and Chronos::Engine::TypeTexturedRectangle.
void Chronos::Manager::Manager::updateText | ( | int | objectNo, |
Chronos::Engine::TextParams | params | ||
) |
Updates the text with the new parameters.
After initializing the text, if you want to change the parameters of the text to new attributes, using the objectNo and passing the textParams, the new parameters can be propogated to the text. The results will be displayed on the next drawFrame()
call.
textNo | The objectNo reference to the text. Generated during ()
|
params | The updated text parameters to update the text with. |
Definition at line 43 of file managerTextFunctions.cpp.
References Chronos::Engine::TextParams::text, and Chronos::Engine::TypeText.
|
private |
Definition at line 511 of file chronos.hpp.
|
private |
The backend Vulkan engine, used for rendering the desired shapes and text.s.
Definition at line 509 of file chronos.hpp.