Resource fetch define

Just a quick one-line tip: I found fetching resources to be a bit tedious and spacy. This simple define seems like the best solution I’ve found so far.

#define RES(x, y) GetSubsystem<ResourceCache>()->GetResource<x>(y)

Turning…

boxModel->SetModel(GetSubsystem<ResourceCache>()->GetResource<Model>("Models/Box.mdl"));

…into:

boxModel->SetModel(RES(Model, "Models/Box.mdl"));
5 Likes

That is a nice tip. Always found a few things to be quite verbose with Urho.

2 Likes