Review heades usage

This is a first step toward a bigger project. Some modules could be
ported to header-only to be used as standalone.
This commit is contained in:
Ray 2016-06-02 01:26:44 +02:00
parent 7afa0b09ab
commit 17878550b1
8 changed files with 54 additions and 52 deletions

View file

@ -37,24 +37,24 @@
#include "AL/al.h" // OpenAL basic header #include "AL/al.h" // OpenAL basic header
#include "AL/alc.h" // OpenAL context header (like OpenGL, OpenAL requires a context to work) #include "AL/alc.h" // OpenAL context header (like OpenGL, OpenAL requires a context to work)
#include "AL/alext.h" // extensions for other format types #include "AL/alext.h" // OpenAL extensions for other format types
#include <stdlib.h> // Declares malloc() and free() for memory management #include <stdlib.h> // Required for: malloc(), free()
#include <string.h> // Required for strcmp() #include <string.h> // Required for: strcmp(), strncmp()
#include <stdio.h> // Used for .WAV loading #include <stdio.h> // Required for: FILE, fopen(), fclose(), fread()
#if defined(AUDIO_STANDALONE) #if defined(AUDIO_STANDALONE)
#include <stdarg.h> // Used for functions with variable number of parameters (TraceLog()) #include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
#else #else
#include "utils.h" // rRES data decompression utility function #include "utils.h" // Required for: DecompressData()
// NOTE: Includes Android fopen function map // NOTE: Includes Android fopen() function map
#endif #endif
//#define STB_VORBIS_HEADER_ONLY //#define STB_VORBIS_HEADER_ONLY
#include "stb_vorbis.h" // OGG loading functions #include "stb_vorbis.h" // OGG loading functions
#define JAR_XM_IMPLEMENTATION #define JAR_XM_IMPLEMENTATION
#include "jar_xm.h" // For playing .xm files #include "jar_xm.h" // XM loading functions
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Defines and Macros // Defines and Macros

View file

@ -29,13 +29,13 @@
#include "utils.h" // Android fopen function map #include "utils.h" // Android fopen function map
#endif #endif
#include <stdio.h> // Standard input/output functions, used to read model files data #include <stdio.h> // Required for: FILE, fopen(), fclose(), fscanf(), feof(), rewind(), fgets()
#include <stdlib.h> // Declares malloc() and free() for memory management #include <stdlib.h> // Required for: malloc(), free()
#include <string.h> // Required for strcmp() #include <string.h> // Required for: strcmp()
#include <math.h> // Used for sin, cos, tan #include <math.h> // Required for: sin(), cos()
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2 #include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
#include "raymath.h" // Required for data type Matrix and Matrix functions #include "raymath.h" // Matrix data type and Matrix functions
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Defines and Macros // Defines and Macros
@ -605,7 +605,7 @@ Model LoadModel(const char *fileName)
// TODO: Initialize default data for model in case loading fails, maybe a cube? // TODO: Initialize default data for model in case loading fails, maybe a cube?
if (strcmp(GetExtension(fileName),"obj") == 0) model.mesh = LoadOBJ(fileName); if (strcmp(GetExtension(fileName), "obj") == 0) model.mesh = LoadOBJ(fileName);
else TraceLog(WARNING, "[%s] Model extension not recognized, it can't be loaded", fileName); else TraceLog(WARNING, "[%s] Model extension not recognized, it can't be loaded", fileName);
if (model.mesh.vertexCount == 0) TraceLog(WARNING, "Model could not be loaded"); if (model.mesh.vertexCount == 0) TraceLog(WARNING, "Model could not be loaded");
@ -764,7 +764,7 @@ Material LoadMaterial(const char *fileName)
{ {
Material material = { 0 }; Material material = { 0 };
if (strcmp(GetExtension(fileName),"mtl") == 0) material = LoadMTL(fileName); if (strcmp(GetExtension(fileName), "mtl") == 0) material = LoadMTL(fileName);
else TraceLog(WARNING, "[%s] Material extension not recognized, it can't be loaded", fileName); else TraceLog(WARNING, "[%s] Material extension not recognized, it can't be loaded", fileName);
return material; return material;

View file

@ -29,40 +29,40 @@
#include "rlgl.h" #include "rlgl.h"
#include <stdio.h> // Standard input / output lib #include <stdio.h> // Standard input / output lib
#include <stdlib.h> // Declares malloc() and free() for memory management, rand() #include <stdlib.h> // Required for: malloc(), free(), rand()
#include <string.h> // Declares strcmp(), strlen(), strtok() #include <string.h> // Required for: strcmp(), strlen(), strtok()
#ifndef RLGL_STANDALONE #ifndef RLGL_STANDALONE
#include "raymath.h" // Required for Vector3 and Matrix functions #include "raymath.h" // Required for Vector3 and Matrix functions
#endif #endif
#if defined(GRAPHICS_API_OPENGL_11) #if defined(GRAPHICS_API_OPENGL_11)
#ifdef __APPLE__ // OpenGL include for OSX #ifdef __APPLE__
#include <OpenGL/gl.h> #include <OpenGL/gl.h> // OpenGL 1.1 library for OSX
#else #else
#include <GL/gl.h> // Basic OpenGL include #include <GL/gl.h> // OpenGL 1.1 library
#endif #endif
#endif #endif
#if defined(GRAPHICS_API_OPENGL_33) #if defined(GRAPHICS_API_OPENGL_33)
#ifdef __APPLE__ // OpenGL include for OSX #ifdef __APPLE__
#include <OpenGL/gl3.h> #include <OpenGL/gl3.h> // OpenGL 3 library for OSX
#else #else
//#define GLEW_STATIC //#define GLEW_STATIC
//#include <GL/glew.h> // GLEW header, includes OpenGL headers //#include <GL/glew.h> // GLEW header, includes OpenGL headers
#include "glad.h" // glad header, includes OpenGL headers #include "glad.h" // GLAD library, includes OpenGL headers
#endif #endif
#endif #endif
#if defined(GRAPHICS_API_OPENGL_ES2) #if defined(GRAPHICS_API_OPENGL_ES2)
#include <EGL/egl.h> #include <EGL/egl.h> // EGL library
#include <GLES2/gl2.h> #include <GLES2/gl2.h> // OpenGL ES 2.0 library
#include <GLES2/gl2ext.h> #include <GLES2/gl2ext.h> // OpenGL ES 2.0 extensions library
#endif #endif
#if defined(RLGL_STANDALONE) #if defined(RLGL_STANDALONE)
#include <stdarg.h> // Used for functions with variable number of parameters (TraceLog()) #include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
#endif #endif // NOTE: Used on TraceLog()
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Defines and Macros // Defines and Macros

View file

@ -32,15 +32,15 @@
//#define RLGL_STANDALONE // NOTE: To use rlgl as standalone lib, just uncomment this line //#define RLGL_STANDALONE // NOTE: To use rlgl as standalone lib, just uncomment this line
#ifndef RLGL_STANDALONE #ifndef RLGL_STANDALONE
#include "raylib.h" // Required for typedef(s): Model, Shader, Texture2D #include "raylib.h" // Required for: Model, Shader, Texture2D
#include "utils.h" // Required for function TraceLog() #include "utils.h" // Required for: TraceLog()
#endif #endif
#ifdef RLGL_STANDALONE #ifdef RLGL_STANDALONE
#define RAYMATH_STANDALONE #define RAYMATH_STANDALONE
#endif #endif
#include "raymath.h" // Required for types: Vector3, Matrix #include "raymath.h" // Required for: Vector3, Matrix
// Select desired OpenGL version // Select desired OpenGL version
// NOTE: Those preprocessor defines are only used on rlgl module, // NOTE: Those preprocessor defines are only used on rlgl module,

View file

@ -25,16 +25,16 @@
#include "raylib.h" #include "raylib.h"
#include <stdlib.h> // Declares malloc() and free() for memory management #include <stdlib.h> // Required for: malloc(), free()
#include <string.h> // String management functions (just strlen() is used) #include <string.h> // Required for: strlen()
#include <stdarg.h> // Used for functions with variable number of parameters (FormatText()) #include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
#include <stdio.h> // Standard input / output lib #include <stdio.h> // Required for: FILE, fopen(), fclose(), fscanf(), feof(), rewind(), fgets()
#include "utils.h" // Required for function GetExtension() #include "utils.h" // Required for: GetExtension()
// Following libs are used on LoadTTF() // Following libs are used on LoadTTF()
#define STB_TRUETYPE_IMPLEMENTATION #define STB_TRUETYPE_IMPLEMENTATION
#include "stb_truetype.h" #include "stb_truetype.h" // Required for: stbtt_BakeFontBitmap()
// Rectangle packing functions (not used at the moment) // Rectangle packing functions (not used at the moment)
//#define STB_RECT_PACK_IMPLEMENTATION //#define STB_RECT_PACK_IMPLEMENTATION

View file

@ -29,8 +29,8 @@
#include "raylib.h" #include "raylib.h"
#include <stdlib.h> // Declares malloc() and free() for memory management #include <stdlib.h> // Required for: malloc(), free()
#include <string.h> // Required for strcmp(), strrchr(), strncmp() #include <string.h> // Required for: strcmp(), strrchr(), strncmp()
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3 or ES2 #include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3 or ES2
// Required: rlglLoadTexture() rlDeleteTextures(), // Required: rlglLoadTexture() rlDeleteTextures(),
@ -40,10 +40,12 @@
// NOTE: Includes Android fopen function map // NOTE: Includes Android fopen function map
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" // Used to read image data (multiple formats support) #include "stb_image.h" // Required for: stbi_load()
// NOTE: Used to read image data (multiple formats support)
#define STB_IMAGE_RESIZE_IMPLEMENTATION #define STB_IMAGE_RESIZE_IMPLEMENTATION
#include "stb_image_resize.h" // Used on image scaling function: ImageResize() #include "stb_image_resize.h" // Required for: stbir_resize_uint8()
// NOTE: Used for image scaling on ImageResize()
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Defines and Macros // Defines and Macros

View file

@ -35,14 +35,14 @@
#include <android/asset_manager.h> #include <android/asset_manager.h>
#endif #endif
#include <stdlib.h> // malloc(), free() #include <stdlib.h> // Required for: malloc(), free()
#include <stdio.h> // printf(), fprintf() #include <stdio.h> // Required for: fopen(), fclose(), fputc(), fwrite(), printf(), fprintf(), funopen()
#include <stdarg.h> // Used for functions with variable number of parameters (TraceLog()) #include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
//#include <string.h> // String management functions: strlen(), strrchr(), strcmp() //#include <string.h> // Required for: strlen(), strrchr(), strcmp()
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
#define STB_IMAGE_WRITE_IMPLEMENTATION #define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h" // Create PNG file #include "stb_image_write.h" // Required for: stbi_write_png()
#endif #endif
#include "tinfl.c" #include "tinfl.c"

View file

@ -27,8 +27,8 @@
#define UTILS_H #define UTILS_H
#if defined(PLATFORM_ANDROID) #if defined(PLATFORM_ANDROID)
#include <stdio.h> // Defines FILE struct #include <stdio.h> // Required for: FILE
#include <android/asset_manager.h> // defines AAssetManager struct #include <android/asset_manager.h> // Required for: AAssetManager
#endif #endif
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------