This section will guide you through using the Dominique library with a sample code snippet. We will demonstrate how to initialize and run an application using the library.
Basic Usage
Below is an example of how to set up and run a basic application using the Dominique Engine in C++.
# main.cpp
#ifndef APP_VERSION
#define APP_VERSION "0.0.1"
#endif
#include <iostream>
#include "dengine/core.h"
#include "dengine/sdl_helpers.h"
int main() {
// Initialize the application
de::DE App;
// Configure the application
App.config.title = "DEngine App";
App.config.width = 800;
App.config.height = 600;
// Log SDL2 renderer information
de::logSDL2renderersInfo();
// Initialize, run, and clean up the application
de::core::Init(App);
de::core::Run(App);
de::core::Clean(App);
return 0;
}
Step-by-Step Explanation
1. Include the Required Headers
#include "dengine/core.h"
#include "dengine/sdl_helpers.h"
dengine/core.h
: Core functionality of Dominique Engine.dengine/sdl_helpers.h
: SDL2 utilities and renderer setup.
2. Initialize the Application
de::DE App;
- Creates an instance of the
DE
class representing the application.
3. Configure the Application
App.config.title = "DEngine App";
App.config.width = 800;
App.config.height = 600;
- Sets application window properties like title, width, and height.
4. Log SDL2 Renderer Information
de::logSDL2renderersInfo();
- Logs available SDL2 renderers for debugging and system information.
5. Initialize, Run, and Clean Up the Application
de::core::Init(App); // Initialize the engine
de::core::Run(App); // Run the application
de::core::Clean(App); // Clean up resources
- Initializes the engine, runs the main loop, and releases resources when the application ends.
6. Main Function Execution
return 0;
- Terminates the program successfully.
Advanced Usage
For more advanced features such as scene management, custom shaders, and model loading, refer to the Dominique Engine Documentation. This includes details about:
- Scene composition
- Custom rendering pipelines
- Asset management (models, textures, and shaders)
Troubleshooting
If you encounter issues, follow these steps:
- Check Configuration: Ensure all configuration settings like title, width, and height are correct.
- Log Information: Use logging functions such as
de::logSDL2renderersInfo()
for debugging system information. - Verify Library Setup: Ensure the correct paths for libraries and includes in your build system.
Further Assistance
For additional help, visit the Dominique GitHub Repository. You can also open an issue for community support or contribute to the project.
Thank you for using Dominique Engine! We hope this guide helps you create amazing visual and creative projects. If you have feedback or suggestions, let us know.