RobLoach / raylib-cpp

C++ Object Oriented Wrapper for raylib
https://robloach.github.io/raylib-cpp/
zlib License
669 stars 87 forks source link

Simplify raylib-cpp #199

Closed TokyoSU closed 2 years ago

TokyoSU commented 2 years ago

I think writing raylib:: for each think is pretty anoying, so ive done a workaround to simplify it:

// add more when a new release appear !

using RWindow = raylib::Window;
using RVector2 = raylib::Vector2;
using RVector3 = raylib::Vector3;
using RCamera = raylib::Camera;
using RCamera2D = raylib::Camera2D;
using RCamera3D = raylib::Camera3D;
using RColor = raylib::Color;
using RTexture = raylib::Texture;
using RRenderTexture = raylib::RenderTexture;
using RRenderTexture2D = raylib::RenderTexture2D;
using RShader = raylib::Shader;
using RModel = raylib::Model;
using RModelAnimation = raylib::ModelAnimation;

this will maintain the code clean, maybe doing a simple .hpp or .h to include it after raylib-cpp.hpp by default could be great, else i will do with this one :x

RobLoach commented 2 years ago

That seems like a great workaround. Do you think we should have a RAYLIB_CPP_SHORTHAND define or something to ease inclusion? Or a raylib-cpp-shorthand.hpp or something?

TokyoSU commented 2 years ago

A simple define will do the work, a new hpp will increase the file count. Just need to include it after raylib-cpp.hpp after the namespace

RobLoach commented 2 years ago

I think we could simply skips the define, and include the alias in each file right after the class definition... Maybe? Would you be willing the submit the PR?

TokyoSU commented 2 years ago

ive done this work on the import from my project not directly from the git. but its something simple, it will be done fast, okay no problem :)

TokyoSU commented 2 years ago

Pull request send :)

RobLoach commented 2 years ago

Nicely done! Happy to have this in :+1: