#include #include #include #include "Magnum/Text/AbstractFont.h" #include "Magnum/Text/AbstractFontConverter.h" #include "Magnum/Trade/AbstractImageConverter.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; Containers::Pointer 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; fontManager.registerExternalManager(importerManager); // 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] */ Containers::Pointer importer = manager.instantiate("AnyImageImporter"); /* Delegates to the DdsImporter plugin, if it's available */ importer->openFile("texture.dds"); /* [anyimporter] */ } { PluginManager::Manager manager; /* [configuration] */ Containers::Pointer importer = manager.instantiate("AssimpImporter"); importer->configuration().setValue("mergeAnimationClips", true); importer->configuration().group("postprocess")->setValue("PreTransformVertices", true); /* [configuration] */ } { /* [MagnumFont-importer-register] */ PluginManager::Manager importerManager; PluginManager::Manager fontManager; fontManager.registerExternalManager(importerManager); /* [MagnumFont-importer-register] */ } { /* [MagnumFontConverter-imageconverter-register] */ PluginManager::Manager imageConverterManager; PluginManager::Manager fontConverterManager; fontConverterManager.registerExternalManager(imageConverterManager); /* [MagnumFontConverter-imageconverter-register] */ } }