Archive 17/01/2023.

Resource fetch define

Modanung

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"));
lebrewer

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