1 /**********************************************************************************************
3 * raylib.utils - Some common utility functions
8 * Copyright (c) 2014-2021 Ramon Santamaria (@raysan5)
10 * This software is provided "as-is", without any express or implied warranty. In no event
11 * will the authors be held liable for any damages arising from the use of this software.
13 * Permission is granted to anyone to use this software for any purpose, including commercial
14 * applications, and to alter it and redistribute it freely, subject to the following restrictions:
16 * 1. The origin of this software must not be misrepresented; you must not claim that you
17 * wrote the original software. If you use this software in a product, an acknowledgment
18 * in the product documentation would be appreciated but is not required.
20 * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
21 * as being the original software.
23 * 3. This notice may not be removed or altered from any source distribution.
25 **********************************************************************************************/
30 #if defined(PLATFORM_ANDROID)
31 #include <stdio.h> // Required for: FILE
32 #include <android/asset_manager.h> // Required for: AAssetManager
35 #if defined(SUPPORT_TRACELOG)
36 #define TRACELOG(level, ...) TraceLog(level, __VA_ARGS__)
38 #if defined(SUPPORT_TRACELOG_DEBUG)
39 #define TRACELOGD(...) TraceLog(LOG_DEBUG, __VA_ARGS__)
41 #define TRACELOGD(...) (void)0
44 #define TRACELOG(level, ...) (void)0
45 #define TRACELOGD(...) (void)0
48 //----------------------------------------------------------------------------------
50 //----------------------------------------------------------------------------------
51 #if defined(PLATFORM_ANDROID)
52 #define fopen(name, mode) android_fopen(name, mode)
55 //----------------------------------------------------------------------------------
56 // Types and Structures Definition
57 //----------------------------------------------------------------------------------
59 extern "C" { // Prevents name mangling of functions
62 //----------------------------------------------------------------------------------
63 // Global Variables Definition
64 //----------------------------------------------------------------------------------
67 //----------------------------------------------------------------------------------
68 // Module Functions Declaration
69 //----------------------------------------------------------------------------------
70 #if defined(PLATFORM_ANDROID)
71 void InitAssetManager(AAssetManager *manager, const char *dataPath); // Initialize asset manager from android app
72 FILE *android_fopen(const char *fileName, const char *mode); // Replacement for fopen() -> Read-only!