#include #include #include "Magnum/Text/AbstractFont.h" #include "Magnum/Trade/AbstractImporter.h" #ifdef __has_include #if __has_include() && \ __has_include() /* [static-import] */ /* No need to do this if you use CMake */ #include #include /* [static-import] */ #endif #endif using namespace Magnum; int main() { /* [loading] */ { PluginManager::Manager manager; std::unique_ptr importer = manager.loadAndInstantiate("TgaImporter"); if(!importer) Fatal{} << "Cannot load the TgaImporter plugin"; // Use the plugin... /* At the end of the scope the importer instance gets deleted and then the manager automatically unloads the plugin on destruction */ } /* [loading] */ { /* [dependencies] */ PluginManager::Manager importerManager; PluginManager::Manager fontManager; // As a side effect TgaImporter is loaded by importerManager fontManager.load("MagnumFont"); /* [dependencies] */ } { /* [aliases] */ PluginManager::Manager manager; manager.setPreferredPlugins("TrueTypeFont", {"HarfBuzzFont", "FreeTypeFont"}); /* [aliases] */ } { PluginManager::Manager manager; /* [anyimporter] */ std::unique_ptr importer = manager.instantiate("AnyImageImporter"); importer->openFile("texture.dds"); /* Delegates to the DdsImporter plugin */ /* [anyimporter] */ } { PluginManager::Manager manager; /* [configuration] */ std::unique_ptr importer = manager.instantiate("AssimpImporter"); importer->configuration().group("postprocess")->setValue("PreTransformVertices", true); /* [configuration] */ } }