You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
3.0 KiB

  1. /**********************************************************************************************
  2. *
  3. * raylib.utils - Some common utility functions
  4. *
  5. *
  6. * LICENSE: zlib/libpng
  7. *
  8. * Copyright (c) 2014-2017 Ramon Santamaria (@raysan5)
  9. *
  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.
  12. *
  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:
  15. *
  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.
  19. *
  20. * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
  21. * as being the original software.
  22. *
  23. * 3. This notice may not be removed or altered from any source distribution.
  24. *
  25. **********************************************************************************************/
  26. #ifndef UTILS_H
  27. #define UTILS_H
  28. #if defined(PLATFORM_ANDROID)
  29. #include <stdio.h> // Required for: FILE
  30. #include <android/asset_manager.h> // Required for: AAssetManager
  31. #endif
  32. #include "rres.h"
  33. #define SUPPORT_SAVE_PNG
  34. //----------------------------------------------------------------------------------
  35. // Some basic Defines
  36. //----------------------------------------------------------------------------------
  37. #if defined(PLATFORM_ANDROID)
  38. #define fopen(name, mode) android_fopen(name, mode)
  39. #endif
  40. //----------------------------------------------------------------------------------
  41. // Types and Structures Definition
  42. //----------------------------------------------------------------------------------
  43. #ifdef __cplusplus
  44. extern "C" { // Prevents name mangling of functions
  45. #endif
  46. //----------------------------------------------------------------------------------
  47. // Global Variables Definition
  48. //----------------------------------------------------------------------------------
  49. // Nop...
  50. //----------------------------------------------------------------------------------
  51. // Module Functions Declaration
  52. //----------------------------------------------------------------------------------
  53. #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
  54. #if defined(SUPPORT_SAVE_BMP)
  55. void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize);
  56. #endif
  57. #if defined(SUPPORT_SAVE_PNG)
  58. void SavePNG(const char *fileName, unsigned char *imgData, int width, int height, int compSize);
  59. #endif
  60. #endif
  61. #if defined(PLATFORM_ANDROID)
  62. void InitAssetManager(AAssetManager *manager); // Initialize asset manager from android app
  63. FILE *android_fopen(const char *fileName, const char *mode); // Replacement for fopen()
  64. #endif
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. #endif // UTILS_H