 |
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"
38 inline void InitWindow(
int width,
int height,
const std::string& title) {
53 return ::GetMonitorName(monitor);
67 return ::GetClipboardText();
82 std::string output(text);
83 ::UnloadFileText((
unsigned char*)text);
90 inline bool SaveFileText(
const std::string& fileName,
const std::string& text) {
91 return ::SaveFileText(fileName.c_str(),
const_cast<char*
>(text.c_str()));
98 return ::FileExists(fileName.c_str());
105 return ::DirectoryExists(dirPath.c_str());
112 return ::IsFileExtension(fileName.c_str(), ext.c_str());
119 return ::GetFileExtension(fileName.c_str());
126 return ::GetFileName(filePath.c_str());
133 return ::GetFileNameWithoutExt(filePath.c_str());
140 return ::GetDirectoryPath(filePath.c_str());
147 return ::GetPrevDirectoryPath(dirPath.c_str());
154 return ::GetWorkingDirectory();
163 std::vector<std::string> output(files, files + count);
164 ::ClearDirectoryFiles();
172 return ::ChangeDirectory(dir.c_str());
181 std::vector<std::string> output(files, files + count);
182 ::ClearDroppedFiles();
190 return ::GetFileModTime(fileName.c_str());
197 return ::OpenURL(url.c_str());
201 return ::IsGamepadName(gamepad, name.c_str());
210 return ::LoadImage(fileName.c_str());
214 int width,
int height,
215 int format,
int headerSize) {
216 return ::LoadImageRaw(fileName.c_str(), width, height, format, headerSize);
220 return ::LoadImageAnim(fileName.c_str(), frames);
224 const unsigned char *fileData,
226 return ::LoadImageFromMemory(fileType.c_str(), fileData, dataSize);
230 return ::ExportImage(image, fileName.c_str());
234 return ::ExportImageAsCode(image, fileName.c_str());
239 #endif // RAYLIB_CPP_INCLUDE_FUNCTIONS_HPP_
bool ExportImageAsCode(const Image &image, const std::string &fileName)
Provides all the classes associated with raylib-cpp.
void InitWindow(int width, int height, const std::string &title)
Initialize window and OpenGL context.
std::vector< std::string > GetDirectoryFiles(const std::string &dirPath)
Get filenames in a directory path.
bool ChangeDirectory(const std::string &dir)
Change working directory, return true on success.
bool DirectoryExists(const std::string &dirPath)
Check if directory path exists.
std::string GetClipboardText()
Get clipboard text content.
bool FileExists(const std::string &fileName)
Check if file exists.
std::vector< std::string > GetDroppedFiles()
Get dropped files names.
std::string GetMonitorName(int monitor)
Get the human-readable, UTF-8 encoded name of the primary monitor.
long GetFileModTime(const std::string &fileName)
Get file modification time (last write time)
void SetWindowTitle(const std::string &title)
Set title for window.
inline ::Image LoadImageFromMemory(const std::string &fileType, const unsigned char *fileData, int dataSize)
std::string GetFileNameWithoutExt(const std::string &filePath)
Get filename string without extension.
void OpenURL(const std::string &url)
Open URL with default system browser (if available)
std::string LoadFileText(const std::string &fileName)
Load text data from file (read)
std::string GetFileExtension(const std::string &fileName)
Get pointer to extension for a filename string (including point: ".png")
std::string GetPrevDirectoryPath(const std::string &dirPath)
Get previous directory path for a given path.
std::string GetWorkingDirectory()
Get current working directory.
bool IsFileExtension(const std::string &fileName, const std::string &ext)
Check file extension (including point: .png, .wav)
inline ::Image LoadImageRaw(const std::string &fileName, int width, int height, int format, int headerSize)
bool ExportImage(const Image &image, const std::string &fileName)
std::string GetFileName(const std::string &filePath)
Get pointer to filename for a path string.
void TakeScreenshot(const std::string &fileName)
Takes a screenshot of current screen (saved a .png)
std::string GetDirectoryPath(const std::string &filePath)
Get full path for a given fileName with path.
inline ::Image LoadImage(const std::string &fileName)
bool IsGamepadName(int gamepad, const std::string &name)
bool SaveFileText(const std::string &fileName, const std::string &text)
Save text data to file (write)
void UpdateCamera(const ::Camera &camera)
void SetClipboardText(const std::string &text)
Set clipboard text content.
inline ::Image LoadImageAnim(const std::string &fileName, int *frames)