ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
assets.h File Reference

Asset routines for the ASW library. More...

#include <string>
#include "./color.h"
#include "./types.h"
#include "./util.h"
Include dependency graph for assets.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  asw
 
namespace  asw::assets
 

Functions

std::string asw::assets::get_path (const std::string &filename)
 Get the full path to an asset given its filename. The filename is relative to the base path of the application (the executable directory, or Contents/Resources in a macOS bundle).
 
std::string asw::assets::get_save_path (const std::string &org, const std::string &app)
 Get a writable folder for save files and settings, unique to the organisation and application. The folder is created if needed.
 
std::string asw::assets::read_save (const std::string &org, const std::string &app, const std::string &name)
 Read save data written by write_save, e.g. progress or settings.
 
bool asw::assets::write_save (const std::string &org, const std::string &app, const std::string &name, const std::string &data)
 Write save data, replacing what was saved under the name before.
 
asw::Texture asw::assets::load_texture (const std::string &filename)
 Loads a texture from a file. Formats supported are PNG, ICO, CUR, BMP, GIF, JPG, LBM, PCX, PNM, TIF, XCF, XPM, XV, and WEBP. This will abort if the file is not found.
 
asw::Texture asw::assets::load_texture (const std::string &filename, const std::string &key)
 Load a texture from a file and cache it.
 
asw::Texture asw::assets::get_texture (const std::string &key)
 Get a cached texture.
 
void asw::assets::unload_texture (const std::string &key)
 Remove a cached texture.
 
asw::Texture asw::assets::create_texture (int w, int h)
 Create a Texture given the specified dimensions.
 
asw::Texture asw::assets::create_radial_gradient (int size, asw::Color inner, asw::Color outer, asw::Falloff falloff=asw::Falloff::Smooth)
 Create a square texture with a radial gradient. The colour goes from inner at the centre to outer at the edge. Useful for lights.
 
asw::Font asw::assets::load_font (const std::string &filename, float size, asw::FontStyle style=asw::FontStyle::Smooth)
 Loads a TTF font from a file. This will abort if the file is not found.
 
asw::Font asw::assets::load_font (const std::string &filename, float size, const std::string &key, asw::FontStyle style=asw::FontStyle::Smooth)
 Load a font from a file and cache it.
 
asw::Font asw::assets::get_font (const std::string &key)
 Get a cached font.
 
void asw::assets::unload_font (const std::string &key)
 Remove a cached font.
 
asw::Sample asw::assets::load_sample (const std::string &filename)
 Loads a sample from a file. Formats supported are WAV, AIFF, RIFF, OGG and VOC. This will abort if the file is not found.
 
asw::Sample asw::assets::load_sample (const std::string &filename, const std::string &key)
 Load a sample from a file and cache it.
 
asw::Sample asw::assets::get_sample (const std::string &key)
 Get a cached sample.
 
void asw::assets::unload_sample (const std::string &key)
 Remove a cached sample.
 
asw::Music asw::assets::load_music (const std::string &filename)
 Loads a music file from a file. Formats supported are WAV, AIFF, RIFF, OGG and VOC. This will abort if the file is not found.
 
asw::Music asw::assets::load_music (const std::string &filename, const std::string &key)
 Load a music file from a file and cache it.
 
asw::Music asw::assets::get_music (const std::string &key)
 Get a cached music.
 
void asw::assets::unload_music (const std::string &key)
 Remove a cached music.
 
void asw::assets::clear_all ()
 Clear all cached assets. This will remove all cached textures, fonts, samples, and music.
 

Detailed Description

Asset routines for the ASW library.

Author
Allan Legemaate (alege.nosp@m.maat.nosp@m.e@gma.nosp@m.il.c.nosp@m.om)
Date
2023-09-20

Definition in file assets.h.