#include <IconLoader.h>
Public Member Functions | |
IconLoader () | |
~IconLoader () override | |
void | Setup (HMODULE pDll, ID3D11Device *pD11Device) |
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) |
![]() | |
~Singleton () override | |
![]() | |
virtual | ~BaseSingleton ()=default |
Additional Inherited Members | |
![]() | |
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 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 Setup()
before you use this class.
Class-Internal flow:
ArcdpsExtension::IconLoader::IconLoader | ( | ) |
|
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 ) |
void ArcdpsExtension::IconLoader::Setup | ( | HMODULE | pDll, |
ID3D11Device * | pD11Device | ||
) |
Call 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 |