assets.h (461B)
1 #pragma once 2 3 #include "intrinsics.h" 4 #include "renderer.h" 5 6 enum AssetType { 7 AT_BITMAP, 8 AT_SOUND, 9 }; 10 11 enum AssetHandle { 12 // bitmaps 13 ASSET_FONT, 14 15 // sounds 16 17 ASSET_COUNT, 18 }; 19 20 struct BitmapData { 21 u32 width; 22 u32 height; 23 u8 * data; 24 }; 25 26 struct SoundData { 27 u32 num_samples; 28 u32 sample_rate; 29 u32 num_channels; 30 31 s16 * samples; 32 }; 33 34 struct Asset { 35 AssetType type; 36 union { 37 struct { 38 BitmapData bitmap; 39 Texture texture; 40 }; 41 SoundData sound; 42 }; 43 };