class hiro::Resource

Overview

Data storage and application interface for every module. More…

#include <Resource.h>

class Resource {
public:
    // fields

    const hiro::ResourceId ID;

    // construction

    Resource(const hiro::ResourceId& id);
    Resource(const std::string& name, const std::string& category);

    // methods

    virtual hiro::PGadget CreateGadget() = 0;
    void ResetGadgets();
    virtual void Update(float delta_time);

protected:
    // methods

    void DrawOnNextUpdate() const;
};

Detailed Documentation

Data storage and application interface for every module.

Each custom module implementation should override Resource and create a custom class. The custom class should specify type of Gadget object to create. The custom Resource objects are is created by user application, and registered in HIRO as shared pointer via hiro::AddResource function.

Fields

const hiro::ResourceId ID

Unique identifier of this object.

Construction

Resource(const hiro::ResourceId& id)

Constructor that assign specified ResourceId.

Resource(const std::string& name, const std::string& category)

Constructor that creates ResourceId from the specified name and category parameters.

Methods

virtual hiro::PGadget CreateGadget() = 0

Override this method to create custom Gadget type objects.

void ResetGadgets()

Forces all existing Gadget objects created by this to be destroyed and created again.

virtual void Update(float delta_time)

Update method is called by the HIRO engine automatically every frame.

Parameters:

delta_time

Specifies the number of seconds since the last Update call.

void DrawOnNextUpdate() const

Tells the system to render on next update. Effect only when “optimized rendering” enabled.