Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions modules/raylib.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,33 @@ module;
#define RAYMATH_IMPLEMENTATION
#include "../include/raylib-cpp.hpp"

#undef LIGHTGRAY
#undef GRAY
#undef DARKGRAY
#undef YELLOW
#undef GOLD
#undef ORANGE
#undef PINK
#undef RED
#undef MAROON
#undef GREEN
#undef LIME
#undef DARKGREEN
#undef SKYBLUE
#undef BLUE
#undef DARKBLUE
#undef PURPLE
#undef VIOLET
#undef DARKPURPLE
#undef BEIGE
#undef BROWN
#undef DARKBROWN
#undef WHITE
#undef BLACK
#undef BLANK
#undef MAGENTA
#undef RAYWHITE
Comment on lines +13 to +38
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will Undef-ing these break implementations that use RAYWHITE and others? We want to add C++ wrappers, while still being able to use the original raylib codes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not as they were undef-ed after the inclusion of the file, so all the implementations will still have access to those macros. That being said we have to undef the macros so that they don't overwrite the constexpr ::Colors.


export module raylib;

/**
Expand Down Expand Up @@ -60,6 +87,29 @@ export namespace raylib {
using raylib::Wave;
using raylib::Window;

// Enums
using ::ConfigFlags;
using ::TraceLogLevel;
using ::KeyboardKey;
using ::MouseButton;
using ::MouseCursor;
using ::GamepadButton;
using ::GamepadAxis;
using ::MaterialMapIndex;
using ::ShaderLocationIndex;
using ::ShaderUniformDataType;
using ::ShaderAttributeDataType;
using ::PixelFormat;
using ::TextureFilter;
using ::TextureWrap;
using ::CubemapLayout;
using ::FontType;
using ::BlendMode;
using ::Gesture;
using ::CameraMode;
using ::CameraProjection;
using ::NPatchLayout;

// From Functions.hpp
using raylib::InitWindow;
using raylib::SetWindowTitle;
Expand Down Expand Up @@ -108,6 +158,39 @@ export namespace raylib {
using raylib::TextToPascal;
using raylib::TextToInteger;

/**
* @namespace raylib::Colors
* @brief Re-exports all Color macros as inline constexpr
*/
namespace Colors {
inline constexpr ::Color LIGHTGRAY = CLITERAL(::Color){ 200, 200, 200, 255 };
inline constexpr ::Color GRAY = CLITERAL(::Color){ 130, 130, 130, 255 };
inline constexpr ::Color DARKGRAY = CLITERAL(::Color){ 80, 80, 80, 255 };
inline constexpr ::Color YELLOW = CLITERAL(::Color){ 253, 249, 0, 255 };
inline constexpr ::Color GOLD = CLITERAL(::Color){ 255, 203, 0, 255 };
inline constexpr ::Color ORANGE = CLITERAL(::Color){ 255, 161, 0, 255 };
inline constexpr ::Color PINK = CLITERAL(::Color){ 255, 109, 194, 255 };
inline constexpr ::Color RED = CLITERAL(::Color){ 230, 41, 55, 255 };
inline constexpr ::Color MAROON = CLITERAL(::Color){ 190, 33, 55, 255 };
inline constexpr ::Color GREEN = CLITERAL(::Color){ 0, 228, 48, 255 };
inline constexpr ::Color LIME = CLITERAL(::Color){ 0, 158, 47, 255 };
inline constexpr ::Color DARKGREEN = CLITERAL(::Color){ 0, 117, 44, 255 };
inline constexpr ::Color SKYBLUE = CLITERAL(::Color){ 102, 191, 255, 255 };
inline constexpr ::Color BLUE = CLITERAL(::Color){ 0, 121, 241, 255 };
inline constexpr ::Color DARKBLUE = CLITERAL(::Color){ 0, 82, 172, 255 };
inline constexpr ::Color PURPLE = CLITERAL(::Color){ 200, 122, 255, 255 };
inline constexpr ::Color VIOLET = CLITERAL(::Color){ 135, 60, 190, 255 };
inline constexpr ::Color DARKPURPLE = CLITERAL(::Color){ 112, 31, 126, 255 };
inline constexpr ::Color BEIGE = CLITERAL(::Color){ 211, 176, 131, 255 };
inline constexpr ::Color BROWN = CLITERAL(::Color){ 127, 106, 79, 255 };
inline constexpr ::Color DARKBROWN = CLITERAL(::Color){ 76, 63, 47, 255 };
inline constexpr ::Color WHITE = CLITERAL(::Color){ 255, 255, 255, 255 };
inline constexpr ::Color BLACK = CLITERAL(::Color){ 0, 0, 0, 255 };
inline constexpr ::Color BLANK = CLITERAL(::Color){ 0, 0, 0, 0 };
inline constexpr ::Color MAGENTA = CLITERAL(::Color){ 255, 0, 255, 255 };
inline constexpr ::Color RAYWHITE = CLITERAL(::Color){ 245, 245, 245, 255 };
}

/**
* @namespace raylib::Keyboard
* @brief Input-related functions: keyboard
Expand Down