#include <IconLoader.h>
Public Member Functions | |
| IconLoader (HMODULE pDll, ID3D11Device *pD11Device) | |
| ~IconLoader () override | |
| void | RegisterFile (IconLoaderKey auto pName, const std::filesystem::path &pFilepath) |
| void | RegisterUrl (IconLoaderKey auto pName, const std::string &pUrl) |
| void | RegisterGw2Dat (IconLoaderKey auto pName, const std::string &pId) |
| void | RegisterResource (IconLoaderKey auto pName, UINT pId) |
| ID3D11ShaderResourceView * | Draw (IconLoaderKey auto pName) |
Public Member Functions inherited from ArcdpsExtension::Singleton< IconLoader > | |
| ~Singleton () override | |
Public Member Functions inherited from ArcdpsExtension::BaseSingleton | |
| virtual | ~BaseSingleton ()=default |
Additional Inherited Members | |
Static Public Member Functions inherited from ArcdpsExtension::Singleton< IconLoader > | |
| static T2 & | instance () |
| static T2 & | init (Args &&... args) |
| static void | f (std::function< void(T2 &)> action) |
| static void | f (std::function< void(IconLoader &)> action) |
| static void | reset () |
Static Protected Member Functions inherited from ArcdpsExtension::BaseSingleton | |
| static BaseSingleton * | Store (std::unique_ptr< BaseSingleton > &&ptr) |
| static void | Clear (BaseSingleton *ptr) |
Load icons in a separate thread.
Always have an enum or any other list of numbers as unique ID.
Make sure to call IconLoader::init(HMODULE, ID3D11Device*) before you use this class. If instance() is called without init(), an exception is thrown.
Class-Internal flow:
| ArcdpsExtension::IconLoader::IconLoader | ( | HMODULE | pDll, |
| ID3D11Device * | pD11Device | ||
| ) |
Call IconLoader::init(HMODULE, ID3D11Device*) in mod_init(). If this is not called properly, it will crash when icons are loaded.
| pDll | The DLL of this module (the one to load resources from) |
| pD11Device | The D3D11 device |
|
override |
| ID3D11ShaderResourceView * ArcdpsExtension::IconLoader::Draw | ( | IconLoaderKey auto | pName | ) |
Get the ResourceView* from a previously Registered Icon.
| pName | UID of the Icon (will be casted to IconLoaderKeyType) |
| void ArcdpsExtension::IconLoader::RegisterFile | ( | IconLoaderKey auto | pName, |
| const std::filesystem::path & | pFilepath | ||
| ) |
Register an Icon that will be loaded from a file.
| pName | UID of the Icon (will be casted to IconLoaderKeyType) |
| pFilepath | The Path to the file that will be loaded (has to exist, else nothing happens) |
| void ArcdpsExtension::IconLoader::RegisterGw2Dat | ( | IconLoaderKey auto | pName, |
| const std::string & | pId | ||
| ) |
Register an Icon that will be downloaded from gw2dat.com. It will cache files in the Temp Dir.
| pName | UID of the Icon (will be casted to IconLoaderKeyType) |
| pId | The ID to download from gw2dat.com (.png will be added to the id) |
| void ArcdpsExtension::IconLoader::RegisterResource | ( | IconLoaderKey auto | pName, |
| UINT | pId | ||
| ) |
Register an Icon that will be loaded from the Resource of the module defined in Setup().
| pName | UID of the Icon (will be casted to IconLoaderKeyType) |
| pId | The ID of the resource to load (normally defined in resource.h) |
| void ArcdpsExtension::IconLoader::RegisterUrl | ( | IconLoaderKey auto | pName, |
| const std::string & | pUrl | ||
| ) |
Register an Icon that will be downloaded and then loaded. It will cache files in the Temp Dir.
| pName | UID of the Icon (will be casted to IconLoaderKeyType) |
| pUrl | The URL to download (has to be a full link, like https://wiki.guildwars2.com/images/4/4c/Alacrity.png) |