Updated for C++
This commit is contained in:
parent
caecb1c1eb
commit
cc2b3228d1
94
src/raylib.h
94
src/raylib.h
@ -236,66 +236,43 @@
|
|||||||
#define ANDROID_VOLUME_UP 24
|
#define ANDROID_VOLUME_UP 24
|
||||||
#define ANDROID_VOLUME_DOWN 25
|
#define ANDROID_VOLUME_DOWN 25
|
||||||
|
|
||||||
|
// NOTE: MSC C++ compiler does not support compound literals (C99 feature)
|
||||||
|
// Plain structures in C++ (without constructors) can be initialized from { } initializers.
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define CLITERAL
|
||||||
|
#else
|
||||||
|
#define CLITERAL (Color)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Some Basic Colors
|
// Some Basic Colors
|
||||||
// NOTE: Custom raylib color palette for amazing visuals on WHITE background
|
// NOTE: Custom raylib color palette for amazing visuals on WHITE background
|
||||||
#ifdef __cplusplus
|
#define LIGHTGRAY CLITERAL{ 200, 200, 200, 255 } // Light Gray
|
||||||
// NOTE: MSC C++ compiler does not support compound literals (C99 feature)
|
#define GRAY CLITERAL{ 130, 130, 130, 255 } // Gray
|
||||||
#define LIGHTGRAY Color(200, 200, 200, 255) // Light Gray
|
#define DARKGRAY CLITERAL{ 80, 80, 80, 255 } // Dark Gray
|
||||||
#define GRAY Color(130, 130, 130, 255) // Gray
|
#define YELLOW CLITERAL{ 253, 249, 0, 255 } // Yellow
|
||||||
#define DARKGRAY Color(80, 80, 80, 255) // Dark Gray
|
#define GOLD CLITERAL{ 255, 203, 0, 255 } // Gold
|
||||||
#define YELLOW Color(253, 249, 0, 255) // Yellow
|
#define ORANGE CLITERAL{ 255, 161, 0, 255 } // Orange
|
||||||
#define GOLD Color(255, 203, 0, 255) // Gold
|
#define PINK CLITERAL{ 255, 109, 194, 255 } // Pink
|
||||||
#define ORANGE Color(255, 161, 0, 255) // Orange
|
#define RED CLITERAL{ 230, 41, 55, 255 } // Red
|
||||||
#define PINK Color(255, 109, 194, 255) // Pink
|
#define MAROON CLITERAL{ 190, 33, 55, 255 } // Maroon
|
||||||
#define RED Color(230, 41, 55, 255) // Red
|
#define GREEN CLITERAL{ 0, 228, 48, 255 } // Green
|
||||||
#define MAROON Color(190, 33, 55, 255) // Maroon
|
#define LIME CLITERAL{ 0, 158, 47, 255 } // Lime
|
||||||
#define GREEN Color(0, 228, 48, 255) // Green
|
#define DARKGREEN CLITERAL{ 0, 117, 44, 255 } // Dark Green
|
||||||
#define LIME Color(0, 158, 47, 255) // Lime
|
#define SKYBLUE CLITERAL{ 102, 191, 255, 255 } // Sky Blue
|
||||||
#define DARKGREEN Color(0, 117, 44, 255) // Dark Green
|
#define BLUE CLITERAL{ 0, 121, 241, 255 } // Blue
|
||||||
#define SKYBLUE Color(102, 191, 255, 255) // Sky Blue
|
#define DARKBLUE CLITERAL{ 0, 82, 172, 255 } // Dark Blue
|
||||||
#define BLUE Color(0, 121, 241, 255) // Blue
|
#define PURPLE CLITERAL{ 200, 122, 255, 255 } // Purple
|
||||||
#define DARKBLUE Color(0, 82, 172, 255) // Dark Blue
|
#define VIOLET CLITERAL{ 135, 60, 190, 255 } // Violet
|
||||||
#define PURPLE Color(200, 122, 255, 255) // Purple
|
#define DARKPURPLE CLITERAL{ 112, 31, 126, 255 } // Dark Purple
|
||||||
#define VIOLET Color(135, 60, 190, 255) // Violet
|
#define BEIGE CLITERAL{ 211, 176, 131, 255 } // Beige
|
||||||
#define DARKPURPLE Color(112, 31, 126, 255) // Dark Purple
|
#define BROWN CLITERAL{ 127, 106, 79, 255 } // Brown
|
||||||
#define BEIGE Color(211, 176, 131, 255) // Beige
|
#define DARKBROWN CLITERAL{ 76, 63, 47, 255 } // Dark Brown
|
||||||
#define BROWN Color(127, 106, 79, 255) // Brown
|
|
||||||
#define DARKBROWN Color(76, 63, 47, 255) // Dark Brown
|
|
||||||
|
|
||||||
#define WHITE Color(255, 255, 255, 255) // White
|
#define WHITE CLITERAL{ 255, 255, 255, 255 } // White
|
||||||
#define BLACK Color(0, 0, 0, 255) // Black
|
#define BLACK CLITERAL{ 0, 0, 0, 255 } // Black
|
||||||
#define BLANK Color(0, 0, 0, 0) // Blank (Transparent)
|
#define BLANK CLITERAL{ 0, 0, 0, 0 } // Blank (Transparent)
|
||||||
#define MAGENTA Color(255, 0, 255, 255) // Magenta
|
#define MAGENTA CLITERAL{ 255, 0, 255, 255 } // Magenta
|
||||||
#define RAYWHITE Color(245, 245, 245, 255) // My own White (raylib logo)
|
#define RAYWHITE CLITERAL{ 245, 245, 245, 255 } // My own White (raylib logo)
|
||||||
#else
|
|
||||||
#define LIGHTGRAY (Color){ 200, 200, 200, 255 } // Light Gray
|
|
||||||
#define GRAY (Color){ 130, 130, 130, 255 } // Gray
|
|
||||||
#define DARKGRAY (Color){ 80, 80, 80, 255 } // Dark Gray
|
|
||||||
#define YELLOW (Color){ 253, 249, 0, 255 } // Yellow
|
|
||||||
#define GOLD (Color){ 255, 203, 0, 255 } // Gold
|
|
||||||
#define ORANGE (Color){ 255, 161, 0, 255 } // Orange
|
|
||||||
#define PINK (Color){ 255, 109, 194, 255 } // Pink
|
|
||||||
#define RED (Color){ 230, 41, 55, 255 } // Red
|
|
||||||
#define MAROON (Color){ 190, 33, 55, 255 } // Maroon
|
|
||||||
#define GREEN (Color){ 0, 228, 48, 255 } // Green
|
|
||||||
#define LIME (Color){ 0, 158, 47, 255 } // Lime
|
|
||||||
#define DARKGREEN (Color){ 0, 117, 44, 255 } // Dark Green
|
|
||||||
#define SKYBLUE (Color){ 102, 191, 255, 255 } // Sky Blue
|
|
||||||
#define BLUE (Color){ 0, 121, 241, 255 } // Blue
|
|
||||||
#define DARKBLUE (Color){ 0, 82, 172, 255 } // Dark Blue
|
|
||||||
#define PURPLE (Color){ 200, 122, 255, 255 } // Purple
|
|
||||||
#define VIOLET (Color){ 135, 60, 190, 255 } // Violet
|
|
||||||
#define DARKPURPLE (Color){ 112, 31, 126, 255 } // Dark Purple
|
|
||||||
#define BEIGE (Color){ 211, 176, 131, 255 } // Beige
|
|
||||||
#define BROWN (Color){ 127, 106, 79, 255 } // Brown
|
|
||||||
#define DARKBROWN (Color){ 76, 63, 47, 255 } // Dark Brown
|
|
||||||
|
|
||||||
#define WHITE (Color){ 255, 255, 255, 255 } // White
|
|
||||||
#define BLACK (Color){ 0, 0, 0, 255 } // Black
|
|
||||||
#define BLANK (Color){ 0, 0, 0, 0 } // Blank (Transparent)
|
|
||||||
#define MAGENTA (Color){ 255, 0, 255, 255 } // Magenta
|
|
||||||
#define RAYWHITE (Color){ 245, 245, 245, 255 } // My own White (raylib logo)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Types and Structures Definition
|
// Types and Structures Definition
|
||||||
@ -342,9 +319,6 @@ typedef struct Color {
|
|||||||
unsigned char g;
|
unsigned char g;
|
||||||
unsigned char b;
|
unsigned char b;
|
||||||
unsigned char a;
|
unsigned char a;
|
||||||
#ifdef __cplusplus
|
|
||||||
Color(unsigned char cr, unsigned char cg, unsigned char cb, unsigned char ca) : r(cr), g(cg), b(cb), a(ca) { }
|
|
||||||
#endif
|
|
||||||
} Color;
|
} Color;
|
||||||
|
|
||||||
// Rectangle type
|
// Rectangle type
|
||||||
|
Loading…
Reference in New Issue
Block a user