4#include <SDL3_image/SDL_image.h>
5#include <SDL3_mixer/SDL_mixer.h>
6#include <SDL3_ttf/SDL_ttf.h>
16 if (temp ==
nullptr) {
20 SDL_SetTextureScaleMode(temp, SDL_SCALEMODE_NEAREST);
21 SDL_SetTextureBlendMode(temp, SDL_BLENDMODE_BLEND);
23 return {temp, SDL_DestroyTexture};
27 TTF_Font* temp = TTF_OpenFont(filename.c_str(), size);
29 if (temp ==
nullptr) {
33 return {temp, TTF_CloseFont};
37 Mix_Chunk* temp = Mix_LoadWAV(filename.c_str());
39 if (temp ==
nullptr) {
43 return {temp, Mix_FreeChunk};
47 Mix_Music* temp = Mix_LoadMUS(filename.c_str());
49 if (temp ==
nullptr) {
53 return {temp, Mix_FreeMusic};
59 SDL_TEXTUREACCESS_TARGET, w, h);
61 return {text, SDL_DestroyTexture};
Asset routines for the ASW library.
Display and window routines for the ASW library.
asw::Sample loadSample(const std::string &filename)
Loads a sample from a file. Formats supported are WAV, AIFF, RIFF, OGG and VOC. This will abort if th...
asw::Font loadFont(const std::string &filename, float size)
Loads a TTF font from a file. This will abort if the file is not found.
asw::Music loadMusic(const std::string &filename)
Loads a music file from a file. Formats supported are WAV, AIFF, RIFF, OGG and VOC....
asw::Texture loadTexture(const std::string &filename)
Loads a texture from a file. Formats supported are PNG, ICO, CUR, BMP, GIF, JPG, LBM,...
asw::Texture createTexture(int w, int h)
Create a Texture given the specified dimensions.
asw::Renderer * renderer
The renderer for the display module.
void abortOnError(const std::string &message)
Abort program and display error message.
std::shared_ptr< Mix_Chunk > Sample
Alias for a shared pointer to an Mix_Chunk.
std::shared_ptr< TTF_Font > Font
Alias for a shared pointer to an TTF_Font.
std::shared_ptr< Mix_Music > Music
Alias for a shared pointer to an Mix_Music.
std::shared_ptr< SDL_Texture > Texture
Alias for a shared pointer to an SDL_Texture.
Types used throughout the ASW library.
General utility functions.