Hello,
I am still working on this project: FSDefender and before implementing new stuff I would like to clean up some things.
One problem I have is to access the ResourceCache from my own classes.
My original workaround was to have a class member of that type and pass a pointer as a function argument which had to be called after the the constructor.
// purpose of this class is to change the skybox texture upon entering a new directory
#include <Urho3D/Graphics/Skybox.h>
#include <Urho3D/Resource/ResourceCache.h>
using namespace Urho3D;
class FSDSkybox
{
private:
ResourceCache* m_cache;
Node* m_parent;
Node* m_skyboxNode;
Skybox* m_skybox;
static Material* m_canyonMaterial;
static Material* m_spaceMaterial;
public:
FSDSkybox();
void init(Node* parent_, ResourceCache* cache_);
void updateMaterial();
};
However I am sure there must be a better way to do that. I have once tried to inherit from component but it didn’t help.