|
MochiEngine
|
This class allows rendering with SDL3 in "the simple way", that is showing textures with SDL_RenderTexture instead of using the GPU module. More...
#include <SDLRenderer.h>
Public Member Functions | |
| SDLRenderer (const char *appName, const char *appVersion, const char *appId, const char *windowName) | |
| Initializes the renderer and window for the application, setting the necessary metadata for the game to work. | |
| SDL_Renderer * | GetRenderer () const |
| SDL_Window * | GetWindow () const |
| virtual void | StartFrameRendering () const override |
| Called before rendering anything. Sets a render color and clears the window. | |
| virtual void | Render (std::vector< RenderCommand > renderQueue, Camera *camera) const override |
| Orders the textures by zindex and renders them on screen depending on the camera position. | |
| virtual void | FinishRendering () const override |
| Present the screen. | |
| virtual std::unique_ptr< AbstractTextureFactory > | CreateTextureFactory (FS::PackCatalog *catalog) const |
| Creates (without ownership) a texture factory of the type compatible with the renderer. | |
| virtual std::unique_ptr< AbstractGUI > | CreateGUI (FS::PackCatalog *catalog, Input::IActionManager *actionManager) |
| Creates (without ownership) the GUI system compatible with the renderer. | |
| virtual std::unique_ptr< Debug::IGizmos > | CreateGizmos () |
| Creates (without ownership) a gizmos system compatible with the renderer. This system is only relevant on debug mode. | |
This class allows rendering with SDL3 in "the simple way", that is showing textures with SDL_RenderTexture instead of using the GPU module.
Besides that, SDLRenderer is responsible for creating AbstractTextureFactory of the type SDLTextureFactory that generates SDLTexture and AbstractGUI of the type SDLGUI.
Ownership:
Guarantees:
| Mochi::Graphics::SDLRenderer::SDLRenderer | ( | const char * | appName, |
| const char * | appVersion, | ||
| const char * | appId, | ||
| const char * | windowName ) |
Initializes the renderer and window for the application, setting the necessary metadata for the game to work.
| appName | Name of the application. |
| appVersion | Version of the application. |
| appId | Unique string defined as a reverse id used to identify the application. |
| windowName | The name that will show on the top of the window. |
|
virtual |
Creates (without ownership) a gizmos system compatible with the renderer. This system is only relevant on debug mode.
Implements Mochi::Graphics::IRenderer.
|
virtual |
Creates (without ownership) the GUI system compatible with the renderer.
| catalog | The file catalog used for the GUI system to load files from. |
| actionManager | The action manager, used to manage UI interactions. |
Implements Mochi::Graphics::IRenderer.
|
virtual |
Creates (without ownership) a texture factory of the type compatible with the renderer.
| catalog | The file catalog used for the factory to load files from. |
Implements Mochi::Graphics::IRenderer.
|
overridevirtual |
Present the screen.
Implements Mochi::Graphics::IRenderer.
|
overridevirtual |
Orders the textures by zindex and renders them on screen depending on the camera position.
As this renderer knows that every texture coming in the renderQueue is an SDLTexture, it performs
| renderQueue | List of render commands to render. |
| camera | The camera on which to project the render. |
Implements Mochi::Graphics::IRenderer.
|
overridevirtual |
Called before rendering anything. Sets a render color and clears the window.
Implements Mochi::Graphics::IRenderer.