 |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
25 #ifndef RAYLIB_CPP_INCLUDE_FUNCTIONS_HPP_
26 #define RAYLIB_CPP_INCLUDE_FUNCTIONS_HPP_
31 #include "./raylib.hpp"
37 #define RLCPPAPI static
45 RLCPPAPI
inline void InitWindow(
int width,
int height,
const std::string& title =
"raylib") {
60 return ::GetMonitorName(monitor);
74 return ::GetClipboardText();
89 std::string output(text);
90 ::UnloadFileText((
unsigned char*)text);
97 RLCPPAPI
inline bool SaveFileText(
const std::string& fileName,
const std::string& text) {
98 return ::SaveFileText(fileName.c_str(),
const_cast<char*
>(text.c_str()));
104 RLCPPAPI
inline bool FileExists(
const std::string& fileName) {
105 return ::FileExists(fileName.c_str());
112 return ::DirectoryExists(dirPath.c_str());
118 RLCPPAPI
inline bool IsFileExtension(
const std::string& fileName,
const std::string& ext) {
119 return ::IsFileExtension(fileName.c_str(), ext.c_str());
126 return ::GetFileExtension(fileName.c_str());
132 RLCPPAPI
inline std::string
GetFileName(
const std::string& filePath) {
133 return ::GetFileName(filePath.c_str());
140 return ::GetFileNameWithoutExt(filePath.c_str());
147 return ::GetDirectoryPath(filePath.c_str());
154 return ::GetPrevDirectoryPath(dirPath.c_str());
161 return ::GetWorkingDirectory();
170 std::vector<std::string> output(files, files + count);
171 ::ClearDirectoryFiles();
179 return ::ChangeDirectory(dir.c_str());
188 std::vector<std::string> output(files, files + count);
189 ::ClearDroppedFiles();
197 return ::GetFileModTime(fileName.c_str());
203 RLCPPAPI
inline void OpenURL(
const std::string& url) {
204 return ::OpenURL(url.c_str());
208 return ::IsGamepadName(gamepad, name.c_str());
216 RLCPPAPI inline ::Image
LoadImage(
const std::string& fileName) {
217 return ::LoadImage(fileName.c_str());
221 int width,
int height,
222 int format,
int headerSize) {
223 return ::LoadImageRaw(fileName.c_str(), width, height, format, headerSize);
226 RLCPPAPI inline ::Image
LoadImageAnim(
const std::string& fileName,
int *frames) {
227 return ::LoadImageAnim(fileName.c_str(), frames);
231 const unsigned char *fileData,
233 return ::LoadImageFromMemory(fileType.c_str(), fileData, dataSize);
237 return ::ExportImage(image, fileName.c_str());
241 return ::ExportImageAsCode(image, fileName.c_str());
246 #endif // RAYLIB_CPP_INCLUDE_FUNCTIONS_HPP_
Provides all the classes associated with raylib-cpp.
static inline ::Image LoadImage(const std::string &fileName)
static std::string GetFileName(const std::string &filePath)
Get pointer to filename for a path string.
static void UpdateCamera(const ::Camera &camera)
static inline ::Image LoadImageRaw(const std::string &fileName, int width, int height, int format, int headerSize)
static std::string GetPrevDirectoryPath(const std::string &dirPath)
Get previous directory path for a given path.
static inline ::Image LoadImageFromMemory(const std::string &fileType, const unsigned char *fileData, int dataSize)
static void SetWindowTitle(const std::string &title)
Set title for window.
static bool IsGamepadName(int gamepad, const std::string &name)
static std::string GetMonitorName(int monitor=0)
Get the human-readable, UTF-8 encoded name of the primary monitor.
static inline ::Image LoadImageAnim(const std::string &fileName, int *frames)
static long GetFileModTime(const std::string &fileName)
Get file modification time (last write time)
static void TakeScreenshot(const std::string &fileName)
Takes a screenshot of current screen (saved a .png)
static std::vector< std::string > GetDroppedFiles()
Get dropped files names.
static void InitWindow(int width, int height, const std::string &title="raylib")
Initialize window and OpenGL context.
static bool ExportImageAsCode(const Image &image, const std::string &fileName)
static bool DirectoryExists(const std::string &dirPath)
Check if directory path exists.
static std::string GetFileNameWithoutExt(const std::string &filePath)
Get filename string without extension.
static std::string GetDirectoryPath(const std::string &filePath)
Get full path for a given fileName with path.
static bool IsFileExtension(const std::string &fileName, const std::string &ext)
Check file extension (including point: .png, .wav)
static bool FileExists(const std::string &fileName)
Check if file exists.
static std::vector< std::string > GetDirectoryFiles(const std::string &dirPath)
Get filenames in a directory path.
static bool ExportImage(const Image &image, const std::string &fileName)
static bool ChangeDirectory(const std::string &dir)
Change working directory, return true on success.
static void SetClipboardText(const std::string &text)
Set clipboard text content.
static std::string GetFileExtension(const std::string &fileName)
Get pointer to extension for a filename string (including point: ".png")
static bool SaveFileText(const std::string &fileName, const std::string &text)
Save text data to file (write)
static std::string LoadFileText(const std::string &fileName)
Load text data from file (read)
static void OpenURL(const std::string &url)
Open URL with default system browser (if available)
static std::string GetWorkingDirectory()
Get current working directory.
static std::string GetClipboardText()
Get clipboard text content.