mirror of
https://github.com/raysan5/raylib.git
synced 2026-04-20 05:53:40 -04:00
REVIEWED: examples memory allocators, using raylib provided macros
This commit is contained in:
@ -51,8 +51,8 @@ int main(void)
|
||||
// NOTE: We can have up to 256 values for tile ids and for tile fog state,
|
||||
// probably we don't need that many values for fog state, it can be optimized
|
||||
// to use only 2 bits per fog state (reducing size by 4) but logic will be a bit more complex
|
||||
map.tileIds = (unsigned char *)calloc(map.tilesX*map.tilesY, sizeof(unsigned char));
|
||||
map.tileFog = (unsigned char *)calloc(map.tilesX*map.tilesY, sizeof(unsigned char));
|
||||
map.tileIds = (unsigned char *)RL_CALLOC(map.tilesX*map.tilesY, sizeof(unsigned char));
|
||||
map.tileFog = (unsigned char *)RL_CALLOC(map.tilesX*map.tilesY, sizeof(unsigned char));
|
||||
|
||||
// Load map tiles (generating 2 random tile ids for testing)
|
||||
// NOTE: Map tile ids should be probably loaded from an external map file
|
||||
@ -149,8 +149,8 @@ int main(void)
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
free(map.tileIds); // Free allocated map tile ids
|
||||
free(map.tileFog); // Free allocated map tile fog state
|
||||
RL_FREE(map.tileIds); // Free allocated map tile ids
|
||||
RL_FREE(map.tileFog); // Free allocated map tile fog state
|
||||
|
||||
UnloadRenderTexture(fogOfWar); // Unload render texture
|
||||
|
||||
|
||||
Reference in New Issue
Block a user