From 00c34a035c6cf32fb688dd06da39db32fa66bc70 Mon Sep 17 00:00:00 2001 From: Ray San Date: Wed, 20 Dec 2017 12:37:08 +0100 Subject: Updated copyright year --- src/shapes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/shapes.c') diff --git a/src/shapes.c b/src/shapes.c index 0b34f921..9f405419 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -13,7 +13,7 @@ * * LICENSE: zlib/libpng * -* Copyright (c) 2014-2017 Ramon Santamaria (@raysan5) +* Copyright (c) 2014-2018 Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. -- cgit v1.2.3 From e1baae02498aab2f4dd84c44732717bb963d18d1 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Mon, 1 Jan 2018 16:54:32 +0100 Subject: Removed function DrawRectangleT() Functionality integrated in DrawRectangle() and selectable with config flag USE_DEFAULT_FONT_TEXTURE --- src/raylib.h | 3 +- src/shapes.c | 180 ++++++++++++++++++++++++++++++++++++----------------------- 2 files changed, 110 insertions(+), 73 deletions(-) (limited to 'src/shapes.c') diff --git a/src/raylib.h b/src/raylib.h index e71ff47b..3e2dbe0c 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -830,14 +830,13 @@ RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color colo RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version) RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle +RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version) RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a vertical-gradient-filled rectangle RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a horizontal-gradient-filled rectangle RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors -RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version) RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline -RLAPI void DrawRectangleT(int posX, int posY, int width, int height, Color color); // Draw rectangle using text character RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version) diff --git a/src/shapes.c b/src/shapes.c index 9f405419..80ba64fa 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -10,6 +10,10 @@ * #define SUPPORT_TRIANGLES_ONLY * Draw shapes using only TRIANGLES, vertex are accumulated in TRIANGLES arrays * +* #define USE_DEFAULT_FONT_TEXTURE +* Draw rectangle shapes using font texture white character instead of default white texture +* Allows drawing rectangles and text with a single draw call, very useful for GUI systems! +* * * LICENSE: zlib/libpng * @@ -245,6 +249,78 @@ void DrawRectangle(int posX, int posY, int width, int height, Color color) DrawRectangleV(position, size, color); } +// Draw a color-filled rectangle (Vector version) +// NOTE: On OpenGL 3.3 and ES2 we use QUADS to avoid drawing order issues (view rlglDraw) +void DrawRectangleV(Vector2 position, Vector2 size, Color color) +{ + if (rlGetVersion() == OPENGL_11) + { + rlBegin(RL_TRIANGLES); + rlColor4ub(color.r, color.g, color.b, color.a); + + rlVertex2i(position.x, position.y); + rlVertex2i(position.x, position.y + size.y); + rlVertex2i(position.x + size.x, position.y + size.y); + + rlVertex2i(position.x, position.y); + rlVertex2i(position.x + size.x, position.y + size.y); + rlVertex2i(position.x + size.x, position.y); + rlEnd(); + } + else if ((rlGetVersion() == OPENGL_21) || (rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20)) + { +#if defined(USE_DEFAULT_FONT_TEXTURE) + // Draw rectangle using font texture white character + rlEnableTexture(GetDefaultFont().texture.id); + + rlBegin(RL_QUADS); + rlColor4ub(color.r, color.g, color.b, color.a); + rlNormal3f(0.0f, 0.0f, 1.0f); + + // NOTE: Default raylib font character 95 is a white square + rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width, + (float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height); + rlVertex2f(rec.x, rec.y); + + rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width, + (float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height); + rlVertex2f(rec.x, rec.y + rec.height); + + rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width, + (float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height); + rlVertex2f(rec.x + rec.width, rec.y + rec.height); + + rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width, + (float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height); + rlVertex2f(rec.x + rec.width, rec.y); + rlEnd(); + + rlDisableTexture(); +#else + rlEnableTexture(GetTextureDefault().id); // Default white texture + + rlBegin(RL_QUADS); + rlColor4ub(color.r, color.g, color.b, color.a); + rlNormal3f(0.0f, 0.0f, 1.0f); + + rlTexCoord2f(0.0f, 0.0f); + rlVertex2f(position.x, position.y); + + rlTexCoord2f(0.0f, 1.0f); + rlVertex2f(position.x, position.y + size.y); + + rlTexCoord2f(1.0f, 1.0f); + rlVertex2f(position.x + size.x, position.y + size.y); + + rlTexCoord2f(1.0f, 0.0f); + rlVertex2f(position.x + size.x, position.y); + rlEnd(); + + rlDisableTexture(); +#endif + } +} + // Draw a color-filled rectangle void DrawRectangleRec(Rectangle rec, Color color) { @@ -292,6 +368,37 @@ void DrawRectangleGradientH(int posX, int posY, int width, int height, Color col // NOTE: Colors refer to corners, starting at top-lef corner and counter-clockwise void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4) { +#if defined(USE_DEFAULT_FONT_TEXTURE) + // Draw rectangle using font texture white character + rlEnableTexture(GetDefaultFont().texture.id); + + rlBegin(RL_QUADS); + rlNormal3f(0.0f, 0.0f, 1.0f); + + // NOTE: Default raylib font character 95 is a white square + rlColor4ub(col1.r, col1.g, col1.b, col1.a); + rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width, + (float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height); + rlVertex2f(rec.x, rec.y); + + rlColor4ub(col2.r, col2.g, col2.b, col2.a); + rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width, + (float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height); + rlVertex2f(rec.x, rec.y + rec.height); + + rlColor4ub(col3.r, col3.g, col3.b, col3.a); + rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width, + (float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height); + rlVertex2f(rec.x + rec.width, rec.y + rec.height); + + rlColor4ub(col4.r, col4.g, col4.b, col4.a); + rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width, + (float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height); + rlVertex2f(rec.x + rec.width, rec.y); + rlEnd(); + + rlDisableTexture(); +#else rlEnableTexture(GetTextureDefault().id); // Default white texture rlBegin(RL_QUADS); @@ -313,70 +420,9 @@ void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, rlTexCoord2f(1.0f, 0.0f); rlVertex2f(rec.x + rec.width, rec.y); rlEnd(); - - // Draw rectangle using font texture white character - /* - rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width, - (float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height); - rlVertex2f(rec.x, rec.y); - - rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width, - (float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height); - rlVertex2f(rec.x, rec.y + rec.height); - - rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width, - (float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height); - rlVertex2f(rec.x + rec.width, rec.y + rec.height); - - rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width, - (float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height); - rlVertex2f(rec.x + rec.width, rec.y); - */ - - rlDisableTexture(); -} - -// Draw a color-filled rectangle (Vector version) -// NOTE: On OpenGL 3.3 and ES2 we use QUADS to avoid drawing order issues (view rlglDraw) -void DrawRectangleV(Vector2 position, Vector2 size, Color color) -{ - if (rlGetVersion() == OPENGL_11) - { - rlBegin(RL_TRIANGLES); - rlColor4ub(color.r, color.g, color.b, color.a); - - rlVertex2i(position.x, position.y); - rlVertex2i(position.x, position.y + size.y); - rlVertex2i(position.x + size.x, position.y + size.y); - - rlVertex2i(position.x, position.y); - rlVertex2i(position.x + size.x, position.y + size.y); - rlVertex2i(position.x + size.x, position.y); - rlEnd(); - } - else if ((rlGetVersion() == OPENGL_21) || (rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20)) - { - rlEnableTexture(GetTextureDefault().id); // Default white texture - rlBegin(RL_QUADS); - rlColor4ub(color.r, color.g, color.b, color.a); - rlNormal3f(0.0f, 0.0f, 1.0f); - - rlTexCoord2f(0.0f, 0.0f); - rlVertex2f(position.x, position.y); - - rlTexCoord2f(0.0f, 1.0f); - rlVertex2f(position.x, position.y + size.y); - - rlTexCoord2f(1.0f, 1.0f); - rlVertex2f(position.x + size.x, position.y + size.y); - - rlTexCoord2f(1.0f, 0.0f); - rlVertex2f(position.x + size.x, position.y); - rlEnd(); - - rlDisableTexture(); - } + rlDisableTexture(); +#endif } // Draw rectangle outline @@ -409,14 +455,6 @@ void DrawRectangleLines(int posX, int posY, int width, int height, Color color) } } -// Draw rectangle using text character (char: 127) -// NOTE: Useful to avoid changing to default white texture -void DrawRectangleT(int posX, int posY, int width, int height, Color color) -{ - DrawTexturePro(GetDefaultFont().texture, GetDefaultFont().chars[95].rec, - (Rectangle){ posX, posY, width, height }, (Vector2){ 0, 0 }, 0.0f, color); -} - // Draw a triangle void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color) { -- cgit v1.2.3 From 0e48396369f7cb3c41a69c9d7dba01328e0dd51c Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 6 Jan 2018 02:44:47 +0100 Subject: Corrected issue with new functionality Using default font texture as base white texture for rectangles reduces draw calls considerably, actually, raygui can be drawn with a single pass! --- src/shapes.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/shapes.c') diff --git a/src/shapes.c b/src/shapes.c index 80ba64fa..fac14760 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -36,6 +36,8 @@ * **********************************************************************************************/ +#define USE_DEFAULT_FONT_TEXTURE + #include "raylib.h" #include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 @@ -280,19 +282,19 @@ void DrawRectangleV(Vector2 position, Vector2 size, Color color) // NOTE: Default raylib font character 95 is a white square rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width, (float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height); - rlVertex2f(rec.x, rec.y); + rlVertex2f(position.x, position.y); rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width, (float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height); - rlVertex2f(rec.x, rec.y + rec.height); + rlVertex2f(position.x, position.y + size.y); rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width, (float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height); - rlVertex2f(rec.x + rec.width, rec.y + rec.height); + rlVertex2f(position.x + size.x, position.y + size.y); rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width, (float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height); - rlVertex2f(rec.x + rec.width, rec.y); + rlVertex2f(position.x + size.x, position.y); rlEnd(); rlDisableTexture(); -- cgit v1.2.3 From d1ef6869a9e9404ce7039ddddad8fa35240d4f42 Mon Sep 17 00:00:00 2001 From: Ray San Date: Fri, 2 Feb 2018 11:01:38 +0100 Subject: Added function DrawRectangleLinesEx() --- src/raylib.h | 1 + src/shapes.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'src/shapes.c') diff --git a/src/raylib.h b/src/raylib.h index 76ad9b55..f881dc68 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -851,6 +851,7 @@ RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Col RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a horizontal-gradient-filled rectangle RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline +RLAPI void DrawRectangleLinesEx(Rectangle rec, int lineThick, Color color); // Draw rectangle outline with extended parameters RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version) diff --git a/src/shapes.c b/src/shapes.c index fac14760..693463ff 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -457,6 +457,21 @@ void DrawRectangleLines(int posX, int posY, int width, int height, Color color) } } +// Draw rectangle outline with extended parameters +void DrawRectangleLinesEx(Rectangle rec, int lineThick, Color color) +{ + if (lineThick > rec.width || lineThick > rec.height) + { + if(rec.width > rec.height) lineThick = rec.height/2; + else if (rec.width < rec.height) lineThick = rec.width/2; + } + + DrawRectangle(rec.x, rec.y, rec.width, lineThick, color); + DrawRectangle(rec.x - lineThick + rec.width, rec.y + lineThick, lineThick, rec.height - lineThick*2, color); + DrawRectangle(rec.x, rec.y + rec.height - lineThick, rec.width, lineThick, color); + DrawRectangle(rec.x, rec.y + lineThick, lineThick, rec.height - lineThick*2, color); +} + // Draw a triangle void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color) { -- cgit v1.2.3 From 1841afad11892bab16976b976d69b7757b617c8b Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sat, 7 Apr 2018 22:29:53 +0200 Subject: Refactor all #define SUPPORT_* into a config.h That way, a user needs only to touch a single file to configure what features raylib is built with. Include guards are left out intentionally, because config.h should only be included in source files, not headers. Later on, config.h can also define the raylib version (#461). --- src/audio.c | 12 +++------- src/config.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/core.c | 12 ++-------- src/models.c | 7 +----- src/rlgl.c | 6 +---- src/rlgl.h | 4 ++-- src/shapes.c | 8 +------ src/text.c | 9 ++----- src/textures.c | 12 +--------- src/utils.c | 2 +- src/utils.h | 6 +++-- 11 files changed, 92 insertions(+), 60 deletions(-) create mode 100644 src/config.h (limited to 'src/shapes.c') diff --git a/src/audio.c b/src/audio.c index 1fcf6f91..3ee1fe81 100644 --- a/src/audio.c +++ b/src/audio.c @@ -11,7 +11,7 @@ * - Manage raw audio context * * CONFIGURATION: -* +* * #define AUDIO_STANDALONE * Define to use the module as standalone library (independently of raylib). * Required types and functions are defined in the same module. @@ -24,7 +24,7 @@ * #define SUPPORT_FILEFORMAT_XM * #define SUPPORT_FILEFORMAT_MOD * #define SUPPORT_FILEFORMAT_FLAC -* Selected desired fileformats to be supported for loading. Some of those formats are +* Selected desired fileformats to be supported for loading. Some of those formats are * supported by default, to remove support, just comment unrequired #define in this module * * LIMITATIONS (only OpenAL Soft): @@ -72,13 +72,7 @@ * **********************************************************************************************/ -// Default configuration flags (supported features) -//------------------------------------------------- -#define SUPPORT_FILEFORMAT_WAV -#define SUPPORT_FILEFORMAT_OGG -#define SUPPORT_FILEFORMAT_XM -#define SUPPORT_FILEFORMAT_MOD -//------------------------------------------------- +#include "config.h" #if !defined(USE_OPENAL_BACKEND) #define USE_MINI_AL 1 // Set to 1 to use mini_al; 0 to use OpenAL. diff --git a/src/config.h b/src/config.h new file mode 100644 index 00000000..40b9d7c4 --- /dev/null +++ b/src/config.h @@ -0,0 +1,74 @@ +/* Edit to control what features raylib is compiled with. */ + +// text.c +/* Default font is loaded on window initialization to be available for the user to render simple text. NOTE: If enabled, uses external module functions to load default raylib font (module: text) */ +#define SUPPORT_DEFAULT_FONT 1 +/* Selected desired fileformats to be supported for loading. */ +#define SUPPORT_FILEFORMAT_FNT 1 +#define SUPPORT_FILEFORMAT_TTF 1 + +// textures.c +/* Selecte desired fileformats to be supported for image data loading. */ +#define SUPPORT_FILEFORMAT_PNG 1 +#define SUPPORT_FILEFORMAT_DDS 1 +#define SUPPORT_FILEFORMAT_HDR 1 +#define SUPPORT_FILEFORMAT_KTX 1 +#define SUPPORT_FILEFORMAT_ASTC 1 +/* #undef SUPPORT_FILEFORMAT_BMP */ +/* #undef SUPPORT_FILEFORMAT_TGA */ +/* #undef SUPPORT_FILEFORMAT_JPG */ +/* #undef SUPPORT_FILEFORMAT_GIF */ +/* #undef SUPPORT_FILEFORMAT_PSD */ +/* #undef SUPPORT_FILEFORMAT_PKM */ +/* #undef SUPPORT_FILEFORMAT_PVR */ + +/* Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop... If not defined only three image editing functions supported: ImageFormat(), ImageAlphaMask(), ImageToPOT() */ +#define SUPPORT_IMAGE_MANIPULATION 1 + +/* Support proedural image generation functionality (gradient, spot, perlin-noise, cellular) */ +#define SUPPORT_IMAGE_GENERATION 1 + +// rlgl.c +/* Support VR simulation functionality (stereo rendering) */ +#define SUPPORT_VR_SIMULATOR 1 +/* Include stereo rendering distortion shader (shader_distortion.h) */ +#define SUPPORT_DISTORTION_SHADER 1 + +// core.c +/* Camera module is included (camera.h) and multiple predefined cameras are available: free, 1st/3rd person, orbital */ +#define SUPPORT_CAMERA_SYSTEM 1 +/* Gestures module is included (gestures.h) to support gestures detection: tap, hold, swipe, drag */ +#define SUPPORT_GESTURES_SYSTEM 1 +/* Mouse gestures are directly mapped like touches and processed by gestures system. */ +#define SUPPORT_MOUSE_GESTURES 1 +/* Use busy wait loop for timing sync, if not defined, a high-resolution timer is setup and used */ +#define SUPPORT_BUSY_WAIT_LOOP 1 +/* Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback() */ +#define SUPPORT_GIF_RECORDING 1 + +// audio.c +/* Desired fileformats to be supported for loading. */ +#define SUPPORT_FILEFORMAT_WAV 1 +#define SUPPORT_FILEFORMAT_OGG 1 +#define SUPPORT_FILEFORMAT_XM 1 +#define SUPPORT_FILEFORMAT_MOD 1 +/* #undef SUPPORT_FILEFORMAT_FLAC */ + +// models.c +/* Selected desired fileformats to be supported for loading. */ +#define SUPPORT_FILEFORMAT_OBJ 1 +#define SUPPORT_FILEFORMAT_MTL 1 + +/* Support procedural mesh generation functions, uses external par_shapes.h library + * NOTE: Some generated meshes DO NOT include generated texture coordinates + */ +#define SUPPORT_MESH_GENERATION 1 + +// utils.c +/* Show TraceLog() output messages. NOTE: By default LOG_DEBUG traces not shown */ +#define SUPPORT_TRACELOG 1 + +/* Support saving image data as PNG fileformat. NOTE: Requires stb_image_write library */ +#define SUPPORT_SAVE_PNG 1 +/* Support saving image data as PMP fileformat. NOTE: Requires stb_image_write library */ +/* #undef SUPPORT_SAVE_BMP */ diff --git a/src/core.c b/src/core.c index e10494c1..0265afd0 100644 --- a/src/core.c +++ b/src/core.c @@ -48,7 +48,7 @@ * Mouse gestures are directly mapped like touches and processed by gestures system. * * #define SUPPORT_BUSY_WAIT_LOOP -* Use busy wait loop for timming sync, if not defined, a high-resolution timer is setup and used +* Use busy wait loop for timing sync, if not defined, a high-resolution timer is setup and used * * #define SUPPORT_GIF_RECORDING * Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback() @@ -81,15 +81,7 @@ * **********************************************************************************************/ -// Default configuration flags (supported features) -//------------------------------------------------- -#define SUPPORT_DEFAULT_FONT -#define SUPPORT_MOUSE_GESTURES -#define SUPPORT_CAMERA_SYSTEM -#define SUPPORT_GESTURES_SYSTEM -#define SUPPORT_BUSY_WAIT_LOOP -#define SUPPORT_GIF_RECORDING -//------------------------------------------------- +#include "config.h" #include "raylib.h" diff --git a/src/models.c b/src/models.c index ae1fc968..0486d17c 100644 --- a/src/models.c +++ b/src/models.c @@ -36,12 +36,7 @@ * **********************************************************************************************/ -// Default configuration flags (supported features) -//------------------------------------------------- -#define SUPPORT_FILEFORMAT_OBJ -#define SUPPORT_FILEFORMAT_MTL -#define SUPPORT_MESH_GENERATION -//------------------------------------------------- +#include "config.h" #include "raylib.h" diff --git a/src/rlgl.c b/src/rlgl.c index 118823db..68bd3670 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -54,11 +54,7 @@ * **********************************************************************************************/ -// Default configuration flags (supported features) -//------------------------------------------------- -#define SUPPORT_VR_SIMULATOR -#define SUPPORT_DISTORTION_SHADER -//------------------------------------------------- +#include "config.h" #include "rlgl.h" diff --git a/src/rlgl.h b/src/rlgl.h index 01278699..c071acac 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -24,7 +24,7 @@ * #define RLGL_STANDALONE * Use rlgl as standalone library (no raylib dependency) * -* #define SUPPORT_VR_SIMULATION / SUPPORT_STEREO_RENDERING +* #define SUPPORT_VR_SIMULATOR * Support VR simulation functionality (stereo rendering) * * #define SUPPORT_DISTORTION_SHADER @@ -496,4 +496,4 @@ void TraceLog(int msgType, const char *text, ...); // Show trace log messag } #endif -#endif // RLGL_H \ No newline at end of file +#endif // RLGL_H diff --git a/src/shapes.c b/src/shapes.c index 693463ff..a1bc7098 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -4,12 +4,6 @@ * * CONFIGURATION: * -* #define SUPPORT_QUADS_ONLY -* Draw shapes using only QUADS, vertex are accumulated in QUADS arrays (like textures) -* -* #define SUPPORT_TRIANGLES_ONLY -* Draw shapes using only TRIANGLES, vertex are accumulated in TRIANGLES arrays -* * #define USE_DEFAULT_FONT_TEXTURE * Draw rectangle shapes using font texture white character instead of default white texture * Allows drawing rectangles and text with a single draw call, very useful for GUI systems! @@ -36,7 +30,7 @@ * **********************************************************************************************/ -#define USE_DEFAULT_FONT_TEXTURE +#include "config.h" #include "raylib.h" diff --git a/src/text.c b/src/text.c index d053be30..1a9d386a 100644 --- a/src/text.c +++ b/src/text.c @@ -6,7 +6,7 @@ * * #define SUPPORT_FILEFORMAT_FNT * #define SUPPORT_FILEFORMAT_TTF -* Selected desired fileformats to be supported for loading. Some of those formats are +* Selected desired fileformats to be supported for loading. Some of those formats are * supported by default, to remove support, just comment unrequired #define in this module * * #define SUPPORT_DEFAULT_FONT @@ -36,12 +36,7 @@ * **********************************************************************************************/ -// Default supported features -//------------------------------------- -#define SUPPORT_DEFAULT_FONT -#define SUPPORT_FILEFORMAT_FNT -#define SUPPORT_FILEFORMAT_TTF -//------------------------------------- +#include "config.h" #include "raylib.h" diff --git a/src/textures.c b/src/textures.c index 8a562887..43453f73 100644 --- a/src/textures.c +++ b/src/textures.c @@ -52,17 +52,7 @@ * 3. This notice may not be removed or altered from any source distribution. * **********************************************************************************************/ - -// Default configuration flags (supported features) -//------------------------------------------------- -#define SUPPORT_FILEFORMAT_PNG -#define SUPPORT_FILEFORMAT_DDS -#define SUPPORT_FILEFORMAT_HDR -#define SUPPORT_FILEFORMAT_KTX -#define SUPPORT_FILEFORMAT_ASTC -#define SUPPORT_IMAGE_MANIPULATION -#define SUPPORT_IMAGE_GENERATION -//------------------------------------------------- +#include "config.h" #include "raylib.h" diff --git a/src/utils.c b/src/utils.c index e37b4ff7..9d9d8b55 100644 --- a/src/utils.c +++ b/src/utils.c @@ -41,7 +41,7 @@ * **********************************************************************************************/ -#define SUPPORT_TRACELOG // Output tracelog messages +#include "config.h" #include "raylib.h" // WARNING: Required for: LogType enum #include "utils.h" diff --git a/src/utils.h b/src/utils.h index f4a1a01a..ed75eb68 100644 --- a/src/utils.h +++ b/src/utils.h @@ -32,7 +32,9 @@ #include // Required for: AAssetManager #endif -#define SUPPORT_SAVE_PNG +#ifndef SUPPORT_SAVE_PNG +#define SUPPORT_SAVE_PNG 1 +#endif //---------------------------------------------------------------------------------- // Some basic Defines @@ -74,4 +76,4 @@ FILE *android_fopen(const char *fileName, const char *mode); // Replacement f } #endif -#endif // UTILS_H \ No newline at end of file +#endif // UTILS_H -- cgit v1.2.3