2014-09-16 22:51:31 +02:00
|
|
|
/**********************************************************************************************
|
2014-01-23 12:36:18 +01:00
|
|
|
*
|
2017-03-20 20:34:44 +01:00
|
|
|
* raylib.utils - Some common utility functions
|
2014-01-23 12:36:18 +01:00
|
|
|
*
|
2014-09-03 16:51:28 +02:00
|
|
|
*
|
2017-03-20 20:34:44 +01:00
|
|
|
* LICENSE: zlib/libpng
|
|
|
|
|
*
|
2025-01-01 00:02:52 +01:00
|
|
|
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
|
2014-09-03 16:51:28 +02:00
|
|
|
*
|
|
|
|
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
2014-01-23 12:36:18 +01:00
|
|
|
* will the authors be held liable for any damages arising from the use of this software.
|
|
|
|
|
*
|
2014-09-03 16:51:28 +02:00
|
|
|
* Permission is granted to anyone to use this software for any purpose, including commercial
|
2014-01-23 12:36:18 +01:00
|
|
|
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
|
|
|
|
*
|
2014-09-03 16:51:28 +02:00
|
|
|
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
|
|
|
|
* wrote the original software. If you use this software in a product, an acknowledgment
|
2014-01-23 12:36:18 +01:00
|
|
|
* in the product documentation would be appreciated but is not required.
|
|
|
|
|
*
|
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
|
|
|
|
* as being the original software.
|
|
|
|
|
*
|
|
|
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
|
|
|
*
|
|
|
|
|
**********************************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef UTILS_H
|
|
|
|
|
#define UTILS_H
|
|
|
|
|
|
2014-09-16 22:51:31 +02:00
|
|
|
#if defined(PLATFORM_ANDROID)
|
2016-06-02 01:26:44 +02:00
|
|
|
#include <stdio.h> // Required for: FILE
|
|
|
|
|
#include <android/asset_manager.h> // Required for: AAssetManager
|
2014-09-16 22:51:31 +02:00
|
|
|
#endif
|
|
|
|
|
|
2023-10-09 11:17:22 +02:00
|
|
|
#if defined(SUPPORT_TRACELOG)
|
2020-02-03 18:31:30 +01:00
|
|
|
#define TRACELOG(level, ...) TraceLog(level, __VA_ARGS__)
|
2020-02-03 19:26:28 +01:00
|
|
|
|
2020-02-03 18:31:30 +01:00
|
|
|
#if defined(SUPPORT_TRACELOG_DEBUG)
|
|
|
|
|
#define TRACELOGD(...) TraceLog(LOG_DEBUG, __VA_ARGS__)
|
|
|
|
|
#else
|
2020-02-03 19:13:24 +01:00
|
|
|
#define TRACELOGD(...) (void)0
|
2020-02-03 18:31:30 +01:00
|
|
|
#endif
|
|
|
|
|
#else
|
2020-02-03 19:13:24 +01:00
|
|
|
#define TRACELOG(level, ...) (void)0
|
|
|
|
|
#define TRACELOGD(...) (void)0
|
2020-02-03 18:31:30 +01:00
|
|
|
#endif
|
|
|
|
|
|
2014-01-23 12:36:18 +01:00
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
|
// Some basic Defines
|
|
|
|
|
//----------------------------------------------------------------------------------
|
2014-09-16 22:51:31 +02:00
|
|
|
#if defined(PLATFORM_ANDROID)
|
2019-10-17 17:18:03 +02:00
|
|
|
#define fopen(name, mode) android_fopen(name, mode)
|
2014-09-16 22:51:31 +02:00
|
|
|
#endif
|
|
|
|
|
|
2014-01-23 12:36:18 +01:00
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
|
// Types and Structures Definition
|
|
|
|
|
//----------------------------------------------------------------------------------
|
2021-08-15 13:02:53 +02:00
|
|
|
//...
|
2014-01-23 12:36:18 +01:00
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
|
// Global Variables Definition
|
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
|
// Nop...
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
|
// Module Functions Declaration
|
|
|
|
|
//----------------------------------------------------------------------------------
|
2022-08-02 17:25:24 +02:00
|
|
|
#if defined(__cplusplus)
|
2021-08-15 13:02:53 +02:00
|
|
|
extern "C" { // Prevents name mangling of functions
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-09-16 22:51:31 +02:00
|
|
|
#if defined(PLATFORM_ANDROID)
|
2020-03-05 18:12:41 +01:00
|
|
|
void InitAssetManager(AAssetManager *manager, const char *dataPath); // Initialize asset manager from android app
|
2021-07-09 17:36:20 +02:00
|
|
|
FILE *android_fopen(const char *fileName, const char *mode); // Replacement for fopen() -> Read-only!
|
2014-09-16 22:51:31 +02:00
|
|
|
#endif
|
2014-04-09 20:25:26 +02:00
|
|
|
|
2022-08-02 17:25:24 +02:00
|
|
|
#if defined(__cplusplus)
|
2014-01-23 12:36:18 +01:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2018-04-07 22:29:53 +02:00
|
|
|
#endif // UTILS_H
|