ok ok i made a ton of progress on theming
This commit is contained in:
parent
970c955be8
commit
2783e40e29
8 changed files with 185 additions and 91 deletions
|
|
@ -1,7 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
#this change avoid the warning that appear when we include raylib using Cmake fatch content
|
||||
project(raylib)
|
||||
|
||||
# Avoid excessive expansion of variables in conditionals. In particular, if
|
||||
# "PLATFORM" is "DRM" then:
|
||||
#
|
||||
|
|
|
|||
2
build.sh
2
build.sh
|
|
@ -8,7 +8,7 @@ cp src/rlgl.h include/
|
|||
cp src/rcamera.h include/
|
||||
|
||||
cd linux-64
|
||||
cmake -DPLATFORM=Desktop ..
|
||||
cmake -DPLATFORM=Desktop ..
|
||||
cd raylib
|
||||
make RAYLIB_LIBTYPE=STATIC -j16 CFLAGS="-O3"
|
||||
cd ../..
|
||||
|
|
|
|||
|
|
@ -224,34 +224,68 @@ typedef struct Color {
|
|||
unsigned char b; // Color blue value
|
||||
unsigned char a; // Color alpha value
|
||||
} Color;
|
||||
#ifdef __cplusplus
|
||||
namespace rl {
|
||||
inline const Color LIGHTGRAY = (Color){ 200, 200, 200, 255 } ;// Light Gray
|
||||
inline const Color GRAY = (Color){ 130, 130, 130, 255 } ;// Gray
|
||||
inline const Color DARKGRAY = (Color){ 80, 80, 80, 255 } ;// Dark Gray
|
||||
inline const Color YELLOW = (Color){ 253, 249, 0, 255 } ;// Yellow
|
||||
inline const Color GOLD = (Color){ 255, 203, 0, 255 } ;// Gold
|
||||
inline const Color ORANGE = (Color){ 255, 161, 0, 255 } ;// Orange
|
||||
inline const Color PINK = (Color){ 255, 109, 194, 255 } ;// Pink
|
||||
inline const Color RED = (Color){ 230, 41, 55, 255 } ;// Red
|
||||
inline const Color MAROON = (Color){ 190, 33, 55, 255 } ;// Maroon
|
||||
inline const Color GREEN = (Color){ 0, 228, 48, 255 } ;// Green
|
||||
inline const Color LIME = (Color){ 0, 158, 47, 255 } ;// Lime
|
||||
inline const Color DARKGREEN = (Color){ 0, 117, 44, 255 } ;// Dark Green
|
||||
inline const Color SKYBLUE = (Color){ 102, 191, 255, 255 } ;// Sky Blue
|
||||
inline const Color BLUE = (Color){ 0, 121, 241, 255 } ;// Blue
|
||||
inline const Color DARKBLUE = (Color){ 0, 82, 172, 255 } ;// Dark Blue
|
||||
inline const Color PURPLE = (Color){ 200, 122, 255, 255 } ;// Purple
|
||||
inline const Color VIOLET = (Color){ 135, 60, 190, 255 } ;// Violet
|
||||
inline const Color DARKPURPLE= (Color){ 112, 31, 126, 255 } ;// Dark Purple
|
||||
inline const Color BEIGE = (Color){ 211, 176, 131, 255 } ;// Beige
|
||||
inline const Color BROWN = (Color){ 127, 106, 79, 255 } ;// Brown
|
||||
inline const Color DARKBROWN = (Color){ 76, 63, 47, 255 } ;// Dark Brown
|
||||
inline const Color WHITE = (Color){ 255, 255, 255, 255 } ;// White
|
||||
inline const Color BLACK = (Color){ 0, 0, 0, 255 } ;// Black
|
||||
inline const Color BLANK = (Color){ 0, 0, 0, 0 } ;// Blank (Transparent)
|
||||
inline const Color MAGENTA = (Color){ 255, 0, 255, 255 } ;// Magenta
|
||||
inline const Color RAYWHITE = (Color){ 245, 245, 245, 255 } ;// My own White (raylib logo)
|
||||
inline const Color LIGHTGRAY = (Color){ 200, 200, 200, 255 } ;// Light Gray
|
||||
inline const Color GRAY = (Color){ 130, 130, 130, 255 } ;// Gray
|
||||
inline const Color DARKGRAY = (Color){ 80, 80, 80, 255 } ;// Dark Gray
|
||||
inline const Color YELLOW = (Color){ 253, 249, 0, 255 } ;// Yellow
|
||||
inline const Color GOLD = (Color){ 255, 203, 0, 255 } ;// Gold
|
||||
inline const Color ORANGE = (Color){ 255, 161, 0, 255 } ;// Orange
|
||||
inline const Color PINK = (Color){ 255, 109, 194, 255 } ;// Pink
|
||||
inline const Color RED = (Color){ 230, 41, 55, 255 } ;// Red
|
||||
inline const Color MAROON = (Color){ 190, 33, 55, 255 } ;// Maroon
|
||||
inline const Color GREEN = (Color){ 0, 228, 48, 255 } ;// Green
|
||||
inline const Color LIME = (Color){ 0, 158, 47, 255 } ;// Lime
|
||||
inline const Color DARKGREEN = (Color){ 0, 117, 44, 255 } ;// Dark Green
|
||||
inline const Color SKYBLUE = (Color){ 102, 191, 255, 255 } ;// Sky Blue
|
||||
inline const Color BLUE = (Color){ 0, 121, 241, 255 } ;// Blue
|
||||
inline const Color DARKBLUE = (Color){ 0, 82, 172, 255 } ;// Dark Blue
|
||||
inline const Color PURPLE = (Color){ 200, 122, 255, 255 } ;// Purple
|
||||
inline const Color VIOLET = (Color){ 135, 60, 190, 255 } ;// Violet
|
||||
inline const Color DARKPURPLE= (Color){ 112, 31, 126, 255 } ;// Dark Purple
|
||||
inline const Color BEIGE = (Color){ 211, 176, 131, 255 } ;// Beige
|
||||
inline const Color BROWN = (Color){ 127, 106, 79, 255 } ;// Brown
|
||||
inline const Color DARKBROWN = (Color){ 76, 63, 47, 255 } ;// Dark Brown
|
||||
inline const Color WHITE = (Color){ 255, 255, 255, 255 } ;// White
|
||||
inline const Color BLACK = (Color){ 0, 0, 0, 255 } ;// Black
|
||||
inline const Color BLANK = (Color){ 0, 0, 0, 0 } ;// Blank (Transparent)
|
||||
inline const Color MAGENTA = (Color){ 255, 0, 255, 255 } ;// Magenta
|
||||
inline const Color RAYWHITE = (Color){ 245, 245, 245, 255 } ;// My own White (raylib logo)
|
||||
}
|
||||
#else
|
||||
struct raycolor {
|
||||
const Color LIGHTGRAY ;// Light Gray
|
||||
const Color GRAY ;// Gray
|
||||
const Color DARKGRAY ;// Dark Gray
|
||||
const Color YELLOW ;// Yellow
|
||||
const Color GOLD ;// Gold
|
||||
const Color ORANGE ;// Orange
|
||||
const Color PINK ;// Pink
|
||||
const Color RED ;// Red
|
||||
const Color MAROON ;// Maroon
|
||||
const Color GREEN ;// Green
|
||||
const Color LIME ;// Lime
|
||||
const Color DARKGREEN ;// Dark Green
|
||||
const Color SKYBLUE ;// Sky Blue
|
||||
const Color BLUE ;// Blue
|
||||
const Color DARKBLUE ;// Dark Blue
|
||||
const Color PURPLE ;// Purple
|
||||
const Color VIOLET ;// Violet
|
||||
const Color DARKPURPLE;// Dark Purple
|
||||
const Color BEIGE ;// Beige
|
||||
const Color BROWN ;// Brown
|
||||
const Color DARKBROWN ;// Dark Brown
|
||||
const Color WHITE ;// White
|
||||
const Color BLACK ;// Black
|
||||
const Color BLANK ;// Blank (Transparent)
|
||||
const Color MAGENTA ;// Magenta
|
||||
const Color RAYWHITE ;// My own White (raylib logo)
|
||||
};
|
||||
extern struct raycolor rl;
|
||||
#endif
|
||||
|
||||
|
||||
// Rectangle, 4 components
|
||||
typedef struct Rectangle {
|
||||
float x; // Rectangle top-left corner position x
|
||||
|
|
|
|||
87
src/raylib.h
87
src/raylib.h
|
|
@ -224,37 +224,68 @@ typedef struct Color {
|
|||
unsigned char b; // Color blue value
|
||||
unsigned char a; // Color alpha value
|
||||
} Color;
|
||||
#ifndef RAYCOLOR
|
||||
#define RAYCOLOR
|
||||
#ifdef __cplusplus
|
||||
namespace rl {
|
||||
const Color LIGHTGRAY = (Color){ 200, 200, 200, 255 } ;// Light Gray
|
||||
const Color GRAY = (Color){ 130, 130, 130, 255 } ;// Gray
|
||||
const Color DARKGRAY = (Color){ 80, 80, 80, 255 } ;// Dark Gray
|
||||
const Color YELLOW = (Color){ 253, 249, 0, 255 } ;// Yellow
|
||||
const Color GOLD = (Color){ 255, 203, 0, 255 } ;// Gold
|
||||
const Color ORANGE = (Color){ 255, 161, 0, 255 } ;// Orange
|
||||
const Color PINK = (Color){ 255, 109, 194, 255 } ;// Pink
|
||||
const Color RED = (Color){ 230, 41, 55, 255 } ;// Red
|
||||
const Color MAROON = (Color){ 190, 33, 55, 255 } ;// Maroon
|
||||
const Color GREEN = (Color){ 0, 228, 48, 255 } ;// Green
|
||||
const Color LIME = (Color){ 0, 158, 47, 255 } ;// Lime
|
||||
const Color DARKGREEN = (Color){ 0, 117, 44, 255 } ;// Dark Green
|
||||
const Color SKYBLUE = (Color){ 102, 191, 255, 255 } ;// Sky Blue
|
||||
const Color BLUE = (Color){ 0, 121, 241, 255 } ;// Blue
|
||||
const Color DARKBLUE = (Color){ 0, 82, 172, 255 } ;// Dark Blue
|
||||
const Color PURPLE = (Color){ 200, 122, 255, 255 } ;// Purple
|
||||
const Color VIOLET = (Color){ 135, 60, 190, 255 } ;// Violet
|
||||
const Color DARKPURPLE= (Color){ 112, 31, 126, 255 } ;// Dark Purple
|
||||
const Color BEIGE = (Color){ 211, 176, 131, 255 } ;// Beige
|
||||
const Color BROWN = (Color){ 127, 106, 79, 255 } ;// Brown
|
||||
const Color DARKBROWN = (Color){ 76, 63, 47, 255 } ;// Dark Brown
|
||||
const Color WHITE = (Color){ 255, 255, 255, 255 } ;// White
|
||||
const Color BLACK = (Color){ 0, 0, 0, 255 } ;// Black
|
||||
const Color BLANK = (Color){ 0, 0, 0, 0 } ;// Blank (Transparent)
|
||||
const Color MAGENTA = (Color){ 255, 0, 255, 255 } ;// Magenta
|
||||
const Color RAYWHITE = (Color){ 245, 245, 245, 255 } ;// My own White (raylib logo)
|
||||
inline const Color LIGHTGRAY = (Color){ 200, 200, 200, 255 } ;// Light Gray
|
||||
inline const Color GRAY = (Color){ 130, 130, 130, 255 } ;// Gray
|
||||
inline const Color DARKGRAY = (Color){ 80, 80, 80, 255 } ;// Dark Gray
|
||||
inline const Color YELLOW = (Color){ 253, 249, 0, 255 } ;// Yellow
|
||||
inline const Color GOLD = (Color){ 255, 203, 0, 255 } ;// Gold
|
||||
inline const Color ORANGE = (Color){ 255, 161, 0, 255 } ;// Orange
|
||||
inline const Color PINK = (Color){ 255, 109, 194, 255 } ;// Pink
|
||||
inline const Color RED = (Color){ 230, 41, 55, 255 } ;// Red
|
||||
inline const Color MAROON = (Color){ 190, 33, 55, 255 } ;// Maroon
|
||||
inline const Color GREEN = (Color){ 0, 228, 48, 255 } ;// Green
|
||||
inline const Color LIME = (Color){ 0, 158, 47, 255 } ;// Lime
|
||||
inline const Color DARKGREEN = (Color){ 0, 117, 44, 255 } ;// Dark Green
|
||||
inline const Color SKYBLUE = (Color){ 102, 191, 255, 255 } ;// Sky Blue
|
||||
inline const Color BLUE = (Color){ 0, 121, 241, 255 } ;// Blue
|
||||
inline const Color DARKBLUE = (Color){ 0, 82, 172, 255 } ;// Dark Blue
|
||||
inline const Color PURPLE = (Color){ 200, 122, 255, 255 } ;// Purple
|
||||
inline const Color VIOLET = (Color){ 135, 60, 190, 255 } ;// Violet
|
||||
inline const Color DARKPURPLE= (Color){ 112, 31, 126, 255 } ;// Dark Purple
|
||||
inline const Color BEIGE = (Color){ 211, 176, 131, 255 } ;// Beige
|
||||
inline const Color BROWN = (Color){ 127, 106, 79, 255 } ;// Brown
|
||||
inline const Color DARKBROWN = (Color){ 76, 63, 47, 255 } ;// Dark Brown
|
||||
inline const Color WHITE = (Color){ 255, 255, 255, 255 } ;// White
|
||||
inline const Color BLACK = (Color){ 0, 0, 0, 255 } ;// Black
|
||||
inline const Color BLANK = (Color){ 0, 0, 0, 0 } ;// Blank (Transparent)
|
||||
inline const Color MAGENTA = (Color){ 255, 0, 255, 255 } ;// Magenta
|
||||
inline const Color RAYWHITE = (Color){ 245, 245, 245, 255 } ;// My own White (raylib logo)
|
||||
}
|
||||
#else
|
||||
struct raycolor {
|
||||
const Color LIGHTGRAY ;// Light Gray
|
||||
const Color GRAY ;// Gray
|
||||
const Color DARKGRAY ;// Dark Gray
|
||||
const Color YELLOW ;// Yellow
|
||||
const Color GOLD ;// Gold
|
||||
const Color ORANGE ;// Orange
|
||||
const Color PINK ;// Pink
|
||||
const Color RED ;// Red
|
||||
const Color MAROON ;// Maroon
|
||||
const Color GREEN ;// Green
|
||||
const Color LIME ;// Lime
|
||||
const Color DARKGREEN ;// Dark Green
|
||||
const Color SKYBLUE ;// Sky Blue
|
||||
const Color BLUE ;// Blue
|
||||
const Color DARKBLUE ;// Dark Blue
|
||||
const Color PURPLE ;// Purple
|
||||
const Color VIOLET ;// Violet
|
||||
const Color DARKPURPLE;// Dark Purple
|
||||
const Color BEIGE ;// Beige
|
||||
const Color BROWN ;// Brown
|
||||
const Color DARKBROWN ;// Dark Brown
|
||||
const Color WHITE ;// White
|
||||
const Color BLACK ;// Black
|
||||
const Color BLANK ;// Blank (Transparent)
|
||||
const Color MAGENTA ;// Magenta
|
||||
const Color RAYWHITE ;// My own White (raylib logo)
|
||||
};
|
||||
extern struct raycolor rl;
|
||||
#endif
|
||||
|
||||
|
||||
// Rectangle, 4 components
|
||||
typedef struct Rectangle {
|
||||
float x; // Rectangle top-left corner position x
|
||||
|
|
|
|||
30
src/rcore.c
30
src/rcore.c
|
|
@ -104,6 +104,36 @@
|
|||
|
||||
#include "raylib.h" // Declares module functions
|
||||
|
||||
struct raycolor rl = {
|
||||
.LIGHTGRAY = (Color){ 200, 200, 200, 255 }, // Light Gray
|
||||
.GRAY = (Color){ 130, 130, 130, 255 }, // Gray
|
||||
.DARKGRAY = (Color){ 80, 80, 80, 255 }, // Dark Gray
|
||||
.YELLOW = (Color){ 253, 249, 0, 255 }, // Yellow
|
||||
.GOLD = (Color){ 255, 203, 0, 255 }, // Gold
|
||||
.ORANGE = (Color){ 255, 161, 0, 255 }, // Orange
|
||||
.PINK = (Color){ 255, 109, 194, 255 }, // Pink
|
||||
.RED = (Color){ 230, 41, 55, 255 }, // Red
|
||||
.MAROON = (Color){ 190, 33, 55, 255 }, // Maroon
|
||||
.GREEN = (Color){ 0, 228, 48, 255 }, // Green
|
||||
.LIME = (Color){ 0, 158, 47, 255 }, // Lime
|
||||
.DARKGREEN = (Color){ 0, 117, 44, 255 }, // Dark Green
|
||||
.SKYBLUE = (Color){ 102, 191, 255, 255 }, // Sky Blue
|
||||
.BLUE = (Color){ 0, 121, 241, 255 }, // Blue
|
||||
.DARKBLUE = (Color){ 0, 82, 172, 255 }, // Dark Blue
|
||||
.PURPLE = (Color){ 200, 122, 255, 255 }, // Purple
|
||||
.VIOLET = (Color){ 135, 60, 190, 255 }, // Violet
|
||||
.DARKPURPLE= (Color){ 112, 31, 126, 255 }, // Dark Purple
|
||||
.BEIGE = (Color){ 211, 176, 131, 255 }, // Beige
|
||||
.BROWN = (Color){ 127, 106, 79, 255 }, // Brown
|
||||
.DARKBROWN = (Color){ 76, 63, 47, 255 }, // Dark Brown
|
||||
.WHITE = (Color){ 255, 255, 255, 255 }, // White
|
||||
.BLACK = (Color){ 0, 0, 0, 255 }, // Black
|
||||
.BLANK = (Color){ 0, 0, 0, 0 }, // Blank (Transparent)
|
||||
.MAGENTA = (Color){ 255, 0, 255, 255 }, // Magenta
|
||||
.RAYWHITE = (Color){ 245, 245, 245, 255 } // My own White (raylib logo)
|
||||
};
|
||||
|
||||
|
||||
// Check if config flags have been externally provided on compilation line
|
||||
#if !defined(EXTERNAL_CONFIG_FLAGS)
|
||||
#include "config.h" // Defines module configuration flags
|
||||
|
|
|
|||
|
|
@ -1342,7 +1342,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
|||
{
|
||||
// Default vertex attribute: color
|
||||
// WARNING: Default value provided to shader if location available
|
||||
float value[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; // WHITE
|
||||
float value[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; // rl.WHITE
|
||||
rlSetVertexAttributeDefault(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR, value, SHADER_ATTRIB_VEC4, 4);
|
||||
rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR);
|
||||
}
|
||||
|
|
@ -2164,7 +2164,7 @@ static void ProcessMaterialsOBJ(Material *materials, tinyobj_material_t *mats, i
|
|||
materials[m].maps[MATERIAL_MAP_SPECULAR].value = 0.0f;
|
||||
|
||||
if (mats[m].bump_texname != NULL) materials[m].maps[MATERIAL_MAP_NORMAL].texture = LoadTexture(mats[m].bump_texname); //char *bump_texname; // map_bump, bump
|
||||
materials[m].maps[MATERIAL_MAP_NORMAL].color = WHITE;
|
||||
materials[m].maps[MATERIAL_MAP_NORMAL].color = rl.WHITE;
|
||||
materials[m].maps[MATERIAL_MAP_NORMAL].value = mats[m].shininess;
|
||||
|
||||
materials[m].maps[MATERIAL_MAP_EMISSION].color = (Color){ (unsigned char)(mats[m].emission[0]*255.0f), (unsigned char)(mats[m].emission[1]*255.0f), (unsigned char)(mats[m].emission[2]*255.0f), 255 }; //float emission[3];
|
||||
|
|
@ -2218,8 +2218,8 @@ Material LoadMaterialDefault(void)
|
|||
//material.maps[MATERIAL_MAP_NORMAL].texture; // NOTE: By default, not set
|
||||
//material.maps[MATERIAL_MAP_SPECULAR].texture; // NOTE: By default, not set
|
||||
|
||||
material.maps[MATERIAL_MAP_DIFFUSE].color = WHITE; // Diffuse color
|
||||
material.maps[MATERIAL_MAP_SPECULAR].color = WHITE; // Specular color
|
||||
material.maps[MATERIAL_MAP_DIFFUSE].color = rl.WHITE; // Diffuse color
|
||||
material.maps[MATERIAL_MAP_SPECULAR].color = rl.WHITE; // Specular color
|
||||
|
||||
return material;
|
||||
}
|
||||
|
|
@ -3308,14 +3308,14 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
|
|||
Vector3 v7 = { w*(x - 0.5f), 0, h*(z + 0.5f) };
|
||||
Vector3 v8 = { w*(x + 0.5f), 0, h*(z + 0.5f) };
|
||||
|
||||
// We check pixel color to be WHITE -> draw full cube
|
||||
if (COLOR_EQUAL(pixels[z*cubicmap.width + x], WHITE))
|
||||
// We check pixel color to be rl.WHITE -> draw full cube
|
||||
if (COLOR_EQUAL(pixels[z*cubicmap.width + x], rl.WHITE))
|
||||
{
|
||||
// Define triangles and checking collateral cubes
|
||||
//------------------------------------------------
|
||||
|
||||
// Define top triangles (2 tris, 6 vertex --> v1-v2-v3, v1-v3-v4)
|
||||
// WARNING: Not required for a WHITE cubes, created to allow seeing the map from outside
|
||||
// WARNING: Not required for a rl.WHITE cubes, created to allow seeing the map from outside
|
||||
mapVertices[vCounter] = v1;
|
||||
mapVertices[vCounter + 1] = v2;
|
||||
mapVertices[vCounter + 2] = v3;
|
||||
|
|
@ -3366,7 +3366,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
|
|||
tcCounter += 6;
|
||||
|
||||
// Checking cube on bottom of current cube
|
||||
if (((z < cubicmap.height - 1) && COLOR_EQUAL(pixels[(z + 1)*cubicmap.width + x], BLACK)) || (z == cubicmap.height - 1))
|
||||
if (((z < cubicmap.height - 1) && COLOR_EQUAL(pixels[(z + 1)*cubicmap.width + x], rl.BLACK)) || (z == cubicmap.height - 1))
|
||||
{
|
||||
// Define front triangles (2 tris, 6 vertex) --> v2 v7 v3, v3 v7 v8
|
||||
// NOTE: Collateral occluded faces are not generated
|
||||
|
|
@ -3396,7 +3396,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
|
|||
}
|
||||
|
||||
// Checking cube on top of current cube
|
||||
if (((z > 0) && COLOR_EQUAL(pixels[(z - 1)*cubicmap.width + x], BLACK)) || (z == 0))
|
||||
if (((z > 0) && COLOR_EQUAL(pixels[(z - 1)*cubicmap.width + x], rl.BLACK)) || (z == 0))
|
||||
{
|
||||
// Define back triangles (2 tris, 6 vertex) --> v1 v5 v6, v1 v4 v5
|
||||
// NOTE: Collateral occluded faces are not generated
|
||||
|
|
@ -3426,7 +3426,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
|
|||
}
|
||||
|
||||
// Checking cube on right of current cube
|
||||
if (((x < cubicmap.width - 1) && COLOR_EQUAL(pixels[z*cubicmap.width + (x + 1)], BLACK)) || (x == cubicmap.width - 1))
|
||||
if (((x < cubicmap.width - 1) && COLOR_EQUAL(pixels[z*cubicmap.width + (x + 1)], rl.BLACK)) || (x == cubicmap.width - 1))
|
||||
{
|
||||
// Define right triangles (2 tris, 6 vertex) --> v3 v8 v4, v4 v8 v5
|
||||
// NOTE: Collateral occluded faces are not generated
|
||||
|
|
@ -3456,7 +3456,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
|
|||
}
|
||||
|
||||
// Checking cube on left of current cube
|
||||
if (((x > 0) && COLOR_EQUAL(pixels[z*cubicmap.width + (x - 1)], BLACK)) || (x == 0))
|
||||
if (((x > 0) && COLOR_EQUAL(pixels[z*cubicmap.width + (x - 1)], rl.BLACK)) || (x == 0))
|
||||
{
|
||||
// Define left triangles (2 tris, 6 vertex) --> v1 v7 v2, v1 v6 v7
|
||||
// NOTE: Collateral occluded faces are not generated
|
||||
|
|
@ -3485,8 +3485,8 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
|
|||
tcCounter += 6;
|
||||
}
|
||||
}
|
||||
// We check pixel color to be BLACK, we will only draw floor and roof
|
||||
else if (COLOR_EQUAL(pixels[z*cubicmap.width + x], BLACK))
|
||||
// We check pixel color to be rl.BLACK, we will only draw floor and roof
|
||||
else if (COLOR_EQUAL(pixels[z*cubicmap.width + x], rl.BLACK))
|
||||
{
|
||||
// Define top triangles (2 tris, 6 vertex --> v1-v2-v3, v1-v3-v4)
|
||||
mapVertices[vCounter] = v1;
|
||||
|
|
@ -3818,7 +3818,7 @@ void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rota
|
|||
{
|
||||
Color color = model.materials[model.meshMaterial[i]].maps[MATERIAL_MAP_DIFFUSE].color;
|
||||
|
||||
Color colorTint = WHITE;
|
||||
Color colorTint = rl.WHITE;
|
||||
colorTint.r = (unsigned char)(((int)color.r*(int)tint.r)/255);
|
||||
colorTint.g = (unsigned char)(((int)color.g*(int)tint.g)/255);
|
||||
colorTint.b = (unsigned char)(((int)color.b*(int)tint.b)/255);
|
||||
|
|
@ -6912,7 +6912,7 @@ static Model LoadM3D(const char *fileName)
|
|||
} break;
|
||||
case m3dp_Ps:
|
||||
{
|
||||
model.materials[i + 1].maps[MATERIAL_MAP_NORMAL].color = WHITE;
|
||||
model.materials[i + 1].maps[MATERIAL_MAP_NORMAL].color = rl.WHITE;
|
||||
model.materials[i + 1].maps[MATERIAL_MAP_NORMAL].value = prop->value.fnum;
|
||||
} break;
|
||||
default:
|
||||
|
|
|
|||
16
src/rtext.c
16
src/rtext.c
|
|
@ -379,7 +379,7 @@ Font LoadFont(const char *fileName)
|
|||
#endif
|
||||
{
|
||||
Image image = LoadImage(fileName);
|
||||
if (image.data != NULL) font = LoadFontFromImage(image, MAGENTA, FONT_TTF_DEFAULT_FIRST_CHAR);
|
||||
if (image.data != NULL) font = LoadFontFromImage(image, rl.MAGENTA, FONT_TTF_DEFAULT_FIRST_CHAR);
|
||||
else font = GetFontDefault();
|
||||
UnloadImage(image);
|
||||
}
|
||||
|
|
@ -497,7 +497,7 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
|
|||
|
||||
// NOTE: We need to remove key color borders from image to avoid weird
|
||||
// artifacts on texture scaling when using TEXTURE_FILTER_BILINEAR or TEXTURE_FILTER_TRILINEAR
|
||||
for (int i = 0; i < image.height*image.width; i++) if (COLOR_EQUAL(pixels[i], key)) pixels[i] = BLANK;
|
||||
for (int i = 0; i < image.height*image.width; i++) if (COLOR_EQUAL(pixels[i], key)) pixels[i] = rl.BLANK;
|
||||
|
||||
// Create a new image with the processed color data (key color replaced by BLANK)
|
||||
Image fontClear = {
|
||||
|
|
@ -1169,11 +1169,11 @@ bool ExportFontAsCode(Font font, const char *fileName)
|
|||
// NOTE: Uses default font
|
||||
void DrawFPS(int posX, int posY)
|
||||
{
|
||||
Color color = LIME; // Good FPS
|
||||
Color color = rl.LIME; // Good FPS
|
||||
int fps = GetFPS();
|
||||
|
||||
if ((fps < 30) && (fps >= 15)) color = ORANGE; // Warning FPS
|
||||
else if (fps < 15) color = RED; // Low FPS
|
||||
if ((fps < 30) && (fps >= 15)) color = rl.ORANGE; // Warning FPS
|
||||
else if (fps < 15) color = rl.RED; // Low FPS
|
||||
|
||||
DrawText(TextFormat("%2i FPS", fps), posX, posY, 20, color);
|
||||
}
|
||||
|
|
@ -2464,13 +2464,13 @@ static Font LoadBMFont(const char *fileName)
|
|||
if (pageCount > 1)
|
||||
{
|
||||
// Resize font atlas to draw additional images
|
||||
ImageResizeCanvas(&fullFont, imWidth, imHeight*pageCount, 0, 0, BLACK);
|
||||
ImageResizeCanvas(&fullFont, imWidth, imHeight*pageCount, 0, 0, rl.BLACK);
|
||||
|
||||
for (int i = 1; i < pageCount; i++)
|
||||
{
|
||||
Rectangle srcRec = { 0.0f, 0.0f, (float)imWidth, (float)imHeight };
|
||||
Rectangle destRec = { 0.0f, (float)imHeight*(float)i, (float)imWidth, (float)imHeight };
|
||||
ImageDraw(&fullFont, imFonts[i], srcRec, destRec, WHITE);
|
||||
ImageDraw(&fullFont, imFonts[i], srcRec, destRec, rl.WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2518,7 +2518,7 @@ static Font LoadBMFont(const char *fileName)
|
|||
}
|
||||
else
|
||||
{
|
||||
font.glyphs[i].image = GenImageColor((int)font.recs[i].width, (int)font.recs[i].height, BLACK);
|
||||
font.glyphs[i].image = GenImageColor((int)font.recs[i].width, (int)font.recs[i].height, rl.BLACK);
|
||||
TRACELOG(LOG_WARNING, "FONT: [%s] Some characters data not correctly provided", fileName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -989,8 +989,8 @@ Image GenImageWhiteNoise(int width, int height, float factor)
|
|||
|
||||
for (int i = 0; i < width*height; i++)
|
||||
{
|
||||
if (GetRandomValue(0, 99) < (int)(factor*100.0f)) pixels[i] = WHITE;
|
||||
else pixels[i] = BLACK;
|
||||
if (GetRandomValue(0, 99) < (int)(factor*100.0f)) pixels[i] = rl.WHITE;
|
||||
else pixels[i] = rl.BLACK;
|
||||
}
|
||||
|
||||
Image image = {
|
||||
|
|
@ -1474,7 +1474,7 @@ Image ImageText(const char *text, int fontSize, Color color)
|
|||
int spacing = fontSize/defaultFontSize;
|
||||
imText = ImageTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing, color); // WARNING: Module required: rtext
|
||||
#else
|
||||
imText = GenImageColor(200, 60, BLACK); // Generating placeholder black image rectangle
|
||||
imText = GenImageColor(200, 60, rl.BLACK); // Generating placeholder black image rectangle
|
||||
TRACELOG(LOG_WARNING, "IMAGE: ImageTextEx() requires module: rtext");
|
||||
#endif
|
||||
return imText;
|
||||
|
|
@ -1497,7 +1497,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
|
|||
Vector2 textSize = MeasureTextEx(font, text, fontSize, spacing);
|
||||
|
||||
// Create image to store text
|
||||
imText = GenImageColor((int)imSize.x, (int)imSize.y, BLANK);
|
||||
imText = GenImageColor((int)imSize.x, (int)imSize.y, rl.BLANK);
|
||||
|
||||
for (int i = 0; i < textLength;)
|
||||
{
|
||||
|
|
@ -1540,7 +1540,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
|
|||
else ImageResize(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor));
|
||||
}
|
||||
#else
|
||||
imText = GenImageColor(200, 60, BLACK); // Generating placeholder black image rectangle
|
||||
imText = GenImageColor(200, 60, rl.BLACK); // Generating placeholder black image rectangle
|
||||
TRACELOG(LOG_WARNING, "IMAGE: ImageTextEx() requires module: rtext");
|
||||
#endif
|
||||
return imText;
|
||||
|
|
@ -2486,8 +2486,8 @@ void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
|
|||
// NOTE: We will store the dithered data as unsigned short (16bpp)
|
||||
image->data = (unsigned short *)RL_MALLOC(image->width*image->height*sizeof(unsigned short));
|
||||
|
||||
Color oldPixel = WHITE;
|
||||
Color newPixel = WHITE;
|
||||
Color oldPixel = rl.WHITE;
|
||||
Color newPixel = rl.WHITE;
|
||||
|
||||
int rError = 0;
|
||||
int gError = 0;
|
||||
|
|
@ -3114,7 +3114,7 @@ Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorCount)
|
|||
{
|
||||
palette = (Color *)RL_MALLOC(maxPaletteSize*sizeof(Color));
|
||||
|
||||
for (int i = 0; i < maxPaletteSize; i++) palette[i] = BLANK; // Set all colors to BLANK
|
||||
for (int i = 0; i < maxPaletteSize; i++) palette[i] = rl.BLANK; // Set all colors to BLANK
|
||||
|
||||
for (int i = 0; i < image.width*image.height; i++)
|
||||
{
|
||||
|
|
@ -4121,7 +4121,7 @@ void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position,
|
|||
Rectangle srcRec = { 0.0f, 0.0f, (float)imText.width, (float)imText.height };
|
||||
Rectangle dstRec = { position.x, position.y, (float)imText.width, (float)imText.height };
|
||||
|
||||
ImageDraw(dst, imText, srcRec, dstRec, WHITE);
|
||||
ImageDraw(dst, imText, srcRec, dstRec, rl.WHITE);
|
||||
|
||||
UnloadImage(imText);
|
||||
}
|
||||
|
|
@ -4237,7 +4237,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
|
|||
|
||||
// Convert image data to 6 faces in a vertical column, that's the optimum layout for loading
|
||||
// NOTE: Image formatting does not work with compressed textures
|
||||
faces = GenImageColor(size, size*6, MAGENTA);
|
||||
faces = GenImageColor(size, size*6, rl.MAGENTA);
|
||||
ImageFormat(&faces, image.format);
|
||||
|
||||
Image mipmapped = ImageCopy(image);
|
||||
|
|
@ -4249,7 +4249,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
|
|||
}
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 6; i++) ImageDraw(&faces, mipmapped, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE);
|
||||
for (int i = 0; i < 6; i++) ImageDraw(&faces, mipmapped, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, rl.WHITE);
|
||||
|
||||
UnloadImage(mipmapped);
|
||||
}
|
||||
|
|
@ -5115,7 +5115,7 @@ Color ColorAlpha(Color color, float alpha)
|
|||
// Get src alpha-blended into dst color with tint
|
||||
Color ColorAlphaBlend(Color dst, Color src, Color tint)
|
||||
{
|
||||
Color out = WHITE;
|
||||
Color out = rl.WHITE;
|
||||
|
||||
// Apply color tint to source color
|
||||
src.r = (unsigned char)(((unsigned int)src.r*((unsigned int)tint.r+1)) >> 8);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue