Skip to content

Resource Loader

Twarit Waikar edited this page Dec 13, 2018 · 4 revisions

Rubeus: Resource Loader

Created by SDSLabs with ❤️

The Rubeus Engine's resource loader is a simple wrapper for functions/libraries that load assets for Rubeus. However, sound loading is managed by Symphony Audio Engine but the resource loader hands opening text files and images.

Jargon

Resource loader uses pure C++ file I/O to open test file streams and DevIL (formerly known as OpenIL) for loading images.

How to use the Resource loader?

Let's see how to use the Resource loader in C++ code. You would expect to see these scripts inside begin() or onHit() functions of your levels and objects.

// Do not write 'using namespace' outside of function definitions
	using namespace Rubeus;
	using namespace Rubeus::UtilityComponents;

	// Gain access to the Resource loader
	auto * loader = Rubeus::Engine->getResourceLoader();

        // Load an image to memory
	auto * image = loader->loadImageFile("Assets/debug.png");

        // Copy the image for personal use
        RImage myImage;
        *myImage = *image;
       
        // Do something with the image copy
        // Don't modify image(as acquired from resource manager). It will affect the image on disk when deleted        

        // Delete the loaded image from memory
        loader->deleteImage();

Contributor's Guide

Resource loader uses pure C++ to open files. Currently only images and text files are supported. For images, DevIL actually provides a plethora of modification which can be done on the loaded image. Support for such modifications is in development.