Sigrid Solveig Haflínudóttirwip Plan 9 port8024a895 years agoHistory
71 lines · 1.7 KB · C
RawDownload
#ifndef _loader_h_#define _loader_h_ #include <SDL2/SDL.h>#include <SDL2/SDL_image.h>#include <SDL2/SDL_mixer.h> /*Copyright (c) 2013-2021 Devine Lu Linvega2018 web port by rezmason2021 C89 port by rezmason Permission to use, copy, modify, and distribute this software for anypurpose with or without fee is hereby granted, provided that the abovecopyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIESWITH REGARD TO THIS SOFTWARE.*/ /*	The loader module is a utility for creating	and destroying assets, and separately, for	loading and unloading their data from disk.	It encapsulates SDL calls to load and process	these assets. 	Most of these assets are created when the game	initializes, but some are so large,	and are presented so infrequently, that they	are loaded only when needed. These different	load policies are represented	by the LoadType enum.*/ typedef enum {	LOADTYPE_MANUAL,	LOADTYPE_LAZY,	LOADTYPE_LAZIER} LoadType; typedef struct {	int w, h;	char *filePath;	SDL_Texture *texture;	LoadType loadType;} Image; typedef struct {	char *path;	Mix_Chunk *chunk;	float volume;} Sound; void Loader_Init(SDL_Renderer *renderer);void Loader_Quit(void); Image *Loader_CreateImage(Image **ptr, LoadType loadType, char *path);int Loader_LoadImage(Image *image);void Loader_UnloadImage(Image *image);void Loader_DestroyImage(Image *image); Sound *Loader_CreateSound(Sound **ptr, char *path, float volume);int Loader_LoadSound(Sound *sound);void Loader_UnloadSound(Sound *sound);void Loader_DestroySound(Sound *sound); int Loader_LoadText(char **ptr, char *path);int Loader_LoadCursor(SDL_Cursor **ptr, char *path); #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t