Added ability to open, close and render fonts
This commit is contained in:
1 parent
e3f4f9c94f
commit
dbc8c88b89
6 files changed
+111
-9
No files matched your search
@@ -4,6 +4,7 @@
|
||||
#include "Renderer.h"
|
||||
#include "SDL_mixer.h"
|
||||
#include "SDL_render.h"
|
||||
#include "SDL_ttf.h"
|
||||
#include "reusable_ids.h"
|
||||
#include <stddef.h>
|
||||
|
||||
@@ -15,6 +16,7 @@ typedef enum {
|
||||
ASSET_TYPE_IMAGE,
|
||||
ASSET_TYPE_AUDIO_FX,
|
||||
ASSET_TYPE_MUSIC,
|
||||
ASSET_TYPE_FONT,
|
||||
|
||||
ASSET_TYPE_COUNT
|
||||
} AssetType;
|
||||
@@ -25,6 +27,7 @@ AssetID load_asset_to_manager(AssetManager *am, const char *path,
|
||||
AssetType type, Renderer *renderer);
|
||||
void remove_asset_from_manager(AssetManager *am, AssetID *id_ptr);
|
||||
SDL_Texture *get_texture(AssetManager *am, AssetID id);
|
||||
TTF_Font *get_font(AssetManager *am, AssetID id);
|
||||
Mix_Chunk *get_audio_chunk(AssetManager *am, AssetID id);
|
||||
Mix_Music *get_music(AssetManager *am, AssetID id);
|
||||
void destroy_asset_manager(AssetManager **am);
|
||||
|
||||
@@ -12,15 +12,18 @@
|
||||
extern "C" {
|
||||
#endif // !__cplusplus
|
||||
|
||||
bool init_game(const char *game_name, uint32_t window_width,
|
||||
uint32_t window_height, SDL_Color window_background_color,
|
||||
bool full_screen, uint8_t audio_tracks);
|
||||
bool init_engine(const char *game_name, uint32_t window_width,
|
||||
uint32_t window_height, SDL_Color window_background_color,
|
||||
bool full_screen, uint8_t audio_tracks);
|
||||
bool game_running();
|
||||
ObjectID add_object(void *object, EventHandlerPtr eh, UpdateFuncPtr uf,
|
||||
RenderFuncPtr rf);
|
||||
void remove_object(ObjectID *id);
|
||||
AssetID load_asset(const char *path, AssetType type);
|
||||
void render_texture_asset(AssetID id, float x, float y, float w, float h);
|
||||
void render_text_with_font_asset(AssetID id, const char *text, float x,
|
||||
float y);
|
||||
void set_font_asset_size(AssetID id, uint32_t size);
|
||||
int8_t play_audio_asset(AssetID id, int16_t loops, bool fade_in,
|
||||
uint32_t fade_length_in_ms);
|
||||
void pause_audio_asset_on_track(AssetID id, uint8_t track);
|
||||
@@ -54,7 +57,7 @@ void close_asset(AssetID *id);
|
||||
void handle_events();
|
||||
void update();
|
||||
void render();
|
||||
void close_game();
|
||||
void close_engine();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_render.h"
|
||||
#include "SDL_surface.h"
|
||||
#include "SDL_video.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -16,6 +17,8 @@ Renderer *create_renderer();
|
||||
bool init_renderer(Renderer *renderer, SDL_Window *window);
|
||||
SDL_Texture *load_texture(const Renderer *renderer, const char *path);
|
||||
void render_clear(const Renderer *renderer, SDL_Color color);
|
||||
void render_surface(const Renderer *renderer, SDL_Surface *surface, float x,
|
||||
float y, float w, float h);
|
||||
void render_texture(const Renderer *renderer, SDL_Texture *texture, float x,
|
||||
float y, float w, float h);
|
||||
void swap_buffers(const Renderer *renderer);
|
||||
|
||||
Reference in new issue
Block a user