raylib-cpp
C++ object-oriented wrapper library for raylib.
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions
raylib Namespace Reference

All raylib-cpp classes and functions appear in the raylib namespace. More...

Namespaces

namespace  Keyboard
 Input-related functions: keyboard.
 
namespace  Mouse
 Input-related functions: mouse.
 
namespace  Touch
 Input-related functions: touch.
 

Classes

struct  Action
 Represents various input action types, such as buttons, axes (controller trigger, mouse wheel), vectors (mouse, thumb stick), and multi-button combinations. More...
 
class  AudioDevice
 Audio device management functions. More...
 
class  AudioStream
 AudioStream management functions. More...
 
class  AutomationEventList
 AutomationEventList management functions. More...
 
class  BoundingBox
 Bounding box type. More...
 
struct  BufferedInput
 InputManager which is responsible for a map of actions and updating their values. More...
 
struct  Button
 Represents various input button types, including keyboard keys, mouse buttons, and gamepad buttons. More...
 
class  Camera2D
 Camera2D type, defines a 2d camera. More...
 
class  Camera3D
 Camera type, defines a camera position/orientation in 3d space. More...
 
class  Color
 Color type, RGBA (32bit) More...
 
class  Degree
 Degree type (allows automatic worry free conversion between radians and degrees) More...
 
class  Font
 Font type, includes texture and charSet array data. More...
 
class  Gamepad
 Input-related functions: gamepads. More...
 
class  Image
 Image type, bpp always RGBA (32bit) More...
 
class  Material
 Material type (generic) More...
 
class  Matrix
 Matrix type (OpenGL style 4x4 - right handed, column major) More...
 
class  Mesh
 Vertex data defining a mesh. More...
 
class  MeshUnmanaged
 Vertex data defining a mesh, not managed by C++ RAII. More...
 
class  Model
 Model type. More...
 
class  ModelAnimation
 Model animation. More...
 
class  Music
 Music stream type (audio file streaming from memory) More...
 
class  Radian
 Radian type (allows automatic worry free conversion between radians and degrees) More...
 
class  Ray
 Ray type (useful for raycast) More...
 
class  RayCollision
 Raycast hit information. More...
 
class  RaylibException
 Exception used for most raylib-related exceptions. More...
 
class  Rectangle
 Rectangle type. More...
 
class  RenderTexture
 RenderTexture type, for texture rendering. More...
 
class  Shader
 Shader type (generic) More...
 
class  ShaderUnmanaged
 Shader type (generic), not managed by C++ RAII. More...
 
class  Sound
 Wave/Sound management functions. More...
 
class  Text
 Text Functions. More...
 
class  Texture
 Texture type. More...
 
class  TextureUnmanaged
 A Texture that is not managed by C++ RAII. More...
 
class  Vector2
 Vector2 type. More...
 
class  Vector3
 Vector3 type. More...
 
class  Vector4
 Vector4 type. More...
 
class  VrStereoConfig
 VR stereo config functions for VR simulator. More...
 
class  Wave
 Wave type, defines audio wave data. More...
 
class  Window
 Window and Graphics Device Functions. More...
 

Typedefs

using ButtonSet = std::set< Button >
 
using Camera = Camera3D
 
using Quaternion = Vector4
 
using RenderTexture2D = RenderTexture
 
using Texture2D = Texture
 
using Texture2DUnmanaged = TextureUnmanaged
 
using TextureCubemap = Texture
 
using TextureCubemapUnmanaged = TextureUnmanaged
 
using Transform = Matrix
 

Functions

static bool ChangeDirectory (const std::string_view dir)
 Change working directory, return true on success. More...
 
static bool DirectoryExists (const std::string_view dirPath)
 Check if directory path exists. More...
 
static void DrawText (const char *text, int posX, int posY, int fontSize, ::Color color)
 Draw text (using default font) More...
 
static void DrawText (const std::string_view text, int posX, int posY, int fontSize, ::Color color)
 Draw text (using default font) More...
 
static void DrawTextEx (const Font &font, char *text, Vector2 position, float fontSize, float spacing, ::Color tint)
 Draw text using font and additional parameters. More...
 
static void DrawTextEx (const Font &font, const std::string_view text, Vector2 position, float fontSize, float spacing, ::Color tint)
 Draw text using font and additional parameters. More...
 
static void DrawTextPro (const Font &font, const char *text, Vector2 position, Vector2 origin, Degree rotation, float fontSize, float spacing, ::Color tint)
 Draw text using Font and pro parameters (rotation) More...
 
static void DrawTextPro (const Font &font, const std::string_view text, Vector2 position, Vector2 origin, Degree rotation, float fontSize, float spacing, ::Color tint)
 Draw text using Font and pro parameters (rotation) More...
 
static bool ExportImage (const Image &image, const std::string_view fileName)
 Export image data to file. More...
 
static bool ExportImageAsCode (const Image &image, const std::string_view fileName)
 Export image as code file (.h) defining an array of bytes. More...
 
static bool FileExists (const std::string_view fileName)
 Check if file exists. More...
 
static std::string GetClipboardText ()
 Get clipboard text content. More...
 
static std::string GetDirectoryPath (const std::string_view filePath)
 Get full path for a given fileName with path. More...
 
static std::string GetFileExtension (const std::string_view fileName)
 Get pointer to extension for a filename string (including point: ".png") More...
 
static long GetFileModTime (const std::string_view fileName)
 Get file modification time (last write time) More...
 
static std::string GetFileName (const std::string_view filePath)
 Get pointer to filename for a path string. More...
 
static std::string GetFileNameWithoutExt (const std::string_view filePath)
 Get filename string without extension. More...
 
static std::string GetGamepadName (int gamepad)
 Get gamepad internal name id. More...
 
static std::string GetMonitorName (int monitor=0)
 Get the human-readable, UTF-8 encoded name of the primary monitor. More...
 
static std::string GetPrevDirectoryPath (const std::string_view dirPath)
 Get previous directory path for a given path. More...
 
static std::string GetWorkingDirectory ()
 Get current working directory. More...
 
static void InitWindow (int width, int height, const std::string_view title="raylib")
 Initialize window and OpenGL context. More...
 
static bool IsFileExtension (const std::string_view fileName, const std::string_view ext)
 Check file extension (including point: .png, .wav) More...
 
static std::vector< std::string > LoadDirectoryFiles (const std::string_view dirPath)
 Get filenames in a directory path. More...
 
static std::vector< std::string > LoadDroppedFiles ()
 Get dropped files names. More...
 
static std::string LoadFileText (const std::string_view fileName)
 Load text data from file (read) More...
 
static inline ::Font LoadFont (const std::string_view fileName)
 Load font from file (filename must include file extension) More...
 
static inline ::Font LoadFontEx (const std::string_view fileName, int fontSize, int *fontChars, int charsCount)
 Load font from file (filename must include file extension) More...
 
static inline ::Font LoadFontEx (const std::string_view fileName, int fontSize, std::span< int > fontChars)
 Load font from file (filename must include file extension) More...
 
static inline ::Image LoadImage (const std::string_view fileName)
 Load an image. More...
 
static inline ::Image LoadImageAnim (const std::string_view fileName, int *frames)
 Load animated image data. More...
 
static inline ::Image LoadImageAnim (const std::string_view fileName, std::span< int > frames)
 Load animated image data. More...
 
static inline ::Image LoadImageFromMemory (const std::string_view fileType, const unsigned char *fileData, int dataSize)
 Load image from memory buffer, fileType refers to extension like "png". More...
 
static inline ::Image LoadImageRaw (const std::string_view fileName, int width, int height, int format, int headerSize)
 Load an image from RAW file data. More...
 
static int MeasureText (const char *text, int fontSize)
 Measure string width for default font. More...
 
static int MeasureText (const std::string_view text, int fontSize)
 Measure string width for default font. More...
 
static void OpenURL (const std::string_view url)
 Open URL with default system browser (if available) More...
 
static bool SaveFileText (const std::string_view fileName, const std::string_view text)
 Save text data to file (write) More...
 
static void SetClipboardText (const std::string_view text)
 Set clipboard text content. More...
 
static void SetWindowTitle (const std::string_view title)
 Set title for window. More...
 
static void TakeScreenshot (const std::string_view fileName)
 Takes a screenshot of current screen (saved a .png) More...
 
static int TextFindIndex (const std::string_view text, const std::string_view find)
 Find first text occurrence within a string. More...
 
static std::string TextInsert (const std::string_view text, const std::string_view insert, int position)
 Insert text in a position. More...
 
static bool TextIsEqual (const char *text1, const char *text2)
 Check if two text string are equal. More...
 
static bool TextIsEqual (const std::string_view text1, const std::string_view text2)
 Check if two text string are equal. More...
 
static unsigned int TextLength (const char *text)
 Check if two text string are equal. More...
 
static unsigned int TextLength (const std::string_view text)
 Check if two text string are equal. More...
 
static std::string TextReplace (const std::string_view text, const std::string_view replace, const std::string_view by)
 Replace text string. More...
 
static std::vector< std::string > TextSplit (const std::string_view text, char delimiter)
 Split text into multiple strings. More...
 
static std::string TextSubtext (const std::string_view text, int position, int length)
 Get text length, checks for '\0' ending. More...
 
static int TextToInteger (const std::string_view text)
 Get integer value from text (negative values not supported) More...
 
static std::string TextToLower (const std::string_view text)
 Get lower case version of provided string. More...
 
static std::string TextToPascal (const std::string_view text)
 Get Pascal case notation version of provided string. More...
 
static std::string TextToUpper (const std::string_view text)
 Get upper case version of provided string. More...
 

Detailed Description

All raylib-cpp classes and functions appear in the raylib namespace.

Typedef Documentation

◆ ButtonSet

using raylib::ButtonSet = typedef std::set<Button>

Definition at line 132 of file BufferedRaylib.hpp.

◆ Camera

using raylib::Camera = typedef Camera3D

Definition at line 135 of file Camera3D.hpp.

◆ Quaternion

using raylib::Quaternion = typedef Vector4

Definition at line 135 of file Vector4.hpp.

◆ RenderTexture2D

Definition at line 120 of file RenderTexture.hpp.

◆ Texture2D

using raylib::Texture2D = typedef Texture

Definition at line 68 of file Texture.hpp.

◆ Texture2DUnmanaged

Definition at line 328 of file TextureUnmanaged.hpp.

◆ TextureCubemap

Definition at line 69 of file Texture.hpp.

◆ TextureCubemapUnmanaged

Definition at line 329 of file TextureUnmanaged.hpp.

◆ Transform

using raylib::Transform = typedef Matrix

Definition at line 519 of file Matrix.hpp.

Function Documentation

◆ ChangeDirectory()

static bool raylib::ChangeDirectory ( const std::string_view  dir)
inlinestatic

Change working directory, return true on success.

Definition at line 166 of file Functions.hpp.

◆ DirectoryExists()

static bool raylib::DirectoryExists ( const std::string_view  dirPath)
inlinestatic

Check if directory path exists.

Definition at line 100 of file Functions.hpp.

◆ DrawText() [1/2]

static void raylib::DrawText ( const char *  text,
int  posX,
int  posY,
int  fontSize,
::Color  color 
)
inlinestatic

Draw text (using default font)

Definition at line 253 of file Functions.hpp.

References DrawText().

Referenced by raylib::Text::Draw(), and DrawText().

◆ DrawText() [2/2]

static void raylib::DrawText ( const std::string_view  text,
int  posX,
int  posY,
int  fontSize,
::Color  color 
)
inlinestatic

Draw text (using default font)

Definition at line 260 of file Functions.hpp.

References DrawText().

◆ DrawTextEx() [1/2]

static void raylib::DrawTextEx ( const Font font,
char *  text,
Vector2  position,
float  fontSize,
float  spacing,
::Color  tint 
)
inlinestatic

Draw text using font and additional parameters.

Definition at line 268 of file Functions.hpp.

References DrawTextEx().

Referenced by raylib::Text::Draw(), raylib::Font::DrawText(), and DrawTextEx().

◆ DrawTextEx() [2/2]

static void raylib::DrawTextEx ( const Font font,
const std::string_view  text,
Vector2  position,
float  fontSize,
float  spacing,
::Color  tint 
)
inlinestatic

Draw text using font and additional parameters.

Definition at line 275 of file Functions.hpp.

References DrawTextEx().

◆ DrawTextPro() [1/2]

static void raylib::DrawTextPro ( const Font font,
const char *  text,
Vector2  position,
Vector2  origin,
Degree  rotation,
float  fontSize,
float  spacing,
::Color  tint 
)
inlinestatic

Draw text using Font and pro parameters (rotation)

Definition at line 283 of file Functions.hpp.

References DrawTextPro().

Referenced by raylib::Text::Draw(), and DrawTextPro().

◆ DrawTextPro() [2/2]

static void raylib::DrawTextPro ( const Font font,
const std::string_view  text,
Vector2  position,
Vector2  origin,
Degree  rotation,
float  fontSize,
float  spacing,
::Color  tint 
)
inlinestatic

Draw text using Font and pro parameters (rotation)

Definition at line 291 of file Functions.hpp.

References DrawTextPro().

◆ ExportImage()

static bool raylib::ExportImage ( const Image image,
const std::string_view  fileName 
)
inlinestatic

Export image data to file.

Definition at line 239 of file Functions.hpp.

Referenced by raylib::Image::Export().

◆ ExportImageAsCode()

static bool raylib::ExportImageAsCode ( const Image image,
const std::string_view  fileName 
)
inlinestatic

Export image as code file (.h) defining an array of bytes.

Definition at line 246 of file Functions.hpp.

Referenced by raylib::Image::ExportAsCode().

◆ FileExists()

static bool raylib::FileExists ( const std::string_view  fileName)
inlinestatic

Check if file exists.

Definition at line 93 of file Functions.hpp.

◆ GetClipboardText()

static std::string raylib::GetClipboardText ( )
inlinestatic

Get clipboard text content.

Definition at line 55 of file Functions.hpp.

◆ GetDirectoryPath()

static std::string raylib::GetDirectoryPath ( const std::string_view  filePath)
inlinestatic

Get full path for a given fileName with path.

Definition at line 135 of file Functions.hpp.

◆ GetFileExtension()

static std::string raylib::GetFileExtension ( const std::string_view  fileName)
inlinestatic

Get pointer to extension for a filename string (including point: ".png")

Definition at line 114 of file Functions.hpp.

◆ GetFileModTime()

static long raylib::GetFileModTime ( const std::string_view  fileName)
inlinestatic

Get file modification time (last write time)

Definition at line 186 of file Functions.hpp.

◆ GetFileName()

static std::string raylib::GetFileName ( const std::string_view  filePath)
inlinestatic

Get pointer to filename for a path string.

Definition at line 121 of file Functions.hpp.

◆ GetFileNameWithoutExt()

static std::string raylib::GetFileNameWithoutExt ( const std::string_view  filePath)
inlinestatic

Get filename string without extension.

Definition at line 128 of file Functions.hpp.

◆ GetGamepadName()

static std::string raylib::GetGamepadName ( int  gamepad)
inlinestatic

Get gamepad internal name id.

Definition at line 69 of file Functions.hpp.

◆ GetMonitorName()

static std::string raylib::GetMonitorName ( int  monitor = 0)
inlinestatic

Get the human-readable, UTF-8 encoded name of the primary monitor.

Definition at line 41 of file Functions.hpp.

◆ GetPrevDirectoryPath()

static std::string raylib::GetPrevDirectoryPath ( const std::string_view  dirPath)
inlinestatic

Get previous directory path for a given path.

Definition at line 142 of file Functions.hpp.

◆ GetWorkingDirectory()

static std::string raylib::GetWorkingDirectory ( )
inlinestatic

Get current working directory.

Definition at line 149 of file Functions.hpp.

◆ InitWindow()

static void raylib::InitWindow ( int  width,
int  height,
const std::string_view  title = "raylib" 
)
inlinestatic

Initialize window and OpenGL context.

Definition at line 27 of file Functions.hpp.

References InitWindow().

Referenced by raylib::Window::Init(), and InitWindow().

◆ IsFileExtension()

static bool raylib::IsFileExtension ( const std::string_view  fileName,
const std::string_view  ext 
)
inlinestatic

Check file extension (including point: .png, .wav)

Definition at line 107 of file Functions.hpp.

◆ LoadDirectoryFiles()

static std::vector< std::string > raylib::LoadDirectoryFiles ( const std::string_view  dirPath)
static

Get filenames in a directory path.

Definition at line 156 of file Functions.hpp.

References LoadDirectoryFiles().

Referenced by LoadDirectoryFiles().

◆ LoadDroppedFiles()

static std::vector< std::string > raylib::LoadDroppedFiles ( )
static

Get dropped files names.

Definition at line 173 of file Functions.hpp.

References LoadDroppedFiles().

Referenced by LoadDroppedFiles().

◆ LoadFileText()

static std::string raylib::LoadFileText ( const std::string_view  fileName)
static

Load text data from file (read)

Definition at line 76 of file Functions.hpp.

References LoadFileText().

Referenced by LoadFileText().

◆ LoadFont()

static inline ::Font raylib::LoadFont ( const std::string_view  fileName)
static

Load font from file (filename must include file extension)

Definition at line 299 of file Functions.hpp.

Referenced by raylib::Font::Load().

◆ LoadFontEx() [1/2]

static inline ::Font raylib::LoadFontEx ( const std::string_view  fileName,
int  fontSize,
int *  fontChars,
int  charsCount 
)
static

Load font from file (filename must include file extension)

Definition at line 306 of file Functions.hpp.

Referenced by raylib::Font::Load().

◆ LoadFontEx() [2/2]

static inline ::Font raylib::LoadFontEx ( const std::string_view  fileName,
int  fontSize,
std::span< int >  fontChars 
)
static

Load font from file (filename must include file extension)

Definition at line 313 of file Functions.hpp.

◆ LoadImage()

static inline ::Image raylib::LoadImage ( const std::string_view  fileName)
static

Load an image.

Definition at line 200 of file Functions.hpp.

Referenced by raylib::Image::Load().

◆ LoadImageAnim() [1/2]

static inline ::Image raylib::LoadImageAnim ( const std::string_view  fileName,
int *  frames 
)
static

Load animated image data.

Definition at line 216 of file Functions.hpp.

Referenced by raylib::Image::Load().

◆ LoadImageAnim() [2/2]

static inline ::Image raylib::LoadImageAnim ( const std::string_view  fileName,
std::span< int >  frames 
)
static

Load animated image data.

Definition at line 223 of file Functions.hpp.

◆ LoadImageFromMemory()

static inline ::Image raylib::LoadImageFromMemory ( const std::string_view  fileType,
const unsigned char *  fileData,
int  dataSize 
)
static

Load image from memory buffer, fileType refers to extension like "png".

Definition at line 230 of file Functions.hpp.

Referenced by raylib::Image::Load().

◆ LoadImageRaw()

static inline ::Image raylib::LoadImageRaw ( const std::string_view  fileName,
int  width,
int  height,
int  format,
int  headerSize 
)
static

Load an image from RAW file data.

Definition at line 207 of file Functions.hpp.

Referenced by raylib::Image::Load().

◆ MeasureText() [1/2]

static int raylib::MeasureText ( const char *  text,
int  fontSize 
)
inlinestatic

Measure string width for default font.

Definition at line 320 of file Functions.hpp.

◆ MeasureText() [2/2]

static int raylib::MeasureText ( const std::string_view  text,
int  fontSize 
)
inlinestatic

Measure string width for default font.

Definition at line 327 of file Functions.hpp.

◆ OpenURL()

static void raylib::OpenURL ( const std::string_view  url)
inlinestatic

Open URL with default system browser (if available)

Definition at line 193 of file Functions.hpp.

◆ SaveFileText()

static bool raylib::SaveFileText ( const std::string_view  fileName,
const std::string_view  text 
)
inlinestatic

Save text data to file (write)

Definition at line 86 of file Functions.hpp.

◆ SetClipboardText()

static void raylib::SetClipboardText ( const std::string_view  text)
inlinestatic

Set clipboard text content.

Definition at line 48 of file Functions.hpp.

References SetClipboardText().

Referenced by SetClipboardText().

◆ SetWindowTitle()

static void raylib::SetWindowTitle ( const std::string_view  title)
inlinestatic

Set title for window.

Definition at line 34 of file Functions.hpp.

References SetWindowTitle().

Referenced by raylib::Window::SetTitle(), and SetWindowTitle().

◆ TakeScreenshot()

static void raylib::TakeScreenshot ( const std::string_view  fileName)
inlinestatic

Takes a screenshot of current screen (saved a .png)

Definition at line 62 of file Functions.hpp.

References TakeScreenshot().

Referenced by TakeScreenshot().

◆ TextFindIndex()

static int raylib::TextFindIndex ( const std::string_view  text,
const std::string_view  find 
)
inlinestatic

Find first text occurrence within a string.

Definition at line 405 of file Functions.hpp.

◆ TextInsert()

static std::string raylib::TextInsert ( const std::string_view  text,
const std::string_view  insert,
int  position 
)
static

Insert text in a position.

Definition at line 383 of file Functions.hpp.

References TextInsert().

Referenced by TextInsert().

◆ TextIsEqual() [1/2]

static bool raylib::TextIsEqual ( const char *  text1,
const char *  text2 
)
inlinestatic

Check if two text string are equal.

Definition at line 334 of file Functions.hpp.

◆ TextIsEqual() [2/2]

static bool raylib::TextIsEqual ( const std::string_view  text1,
const std::string_view  text2 
)
inlinestatic

Check if two text string are equal.

Definition at line 341 of file Functions.hpp.

◆ TextLength() [1/2]

static unsigned int raylib::TextLength ( const char *  text)
inlinestatic

Check if two text string are equal.

Definition at line 348 of file Functions.hpp.

◆ TextLength() [2/2]

static unsigned int raylib::TextLength ( const std::string_view  text)
inlinestatic

Check if two text string are equal.

Definition at line 355 of file Functions.hpp.

◆ TextReplace()

static std::string raylib::TextReplace ( const std::string_view  text,
const std::string_view  replace,
const std::string_view  by 
)
static

Replace text string.

Definition at line 369 of file Functions.hpp.

References TextReplace().

Referenced by TextReplace().

◆ TextSplit()

static std::vector< std::string > raylib::TextSplit ( const std::string_view  text,
char  delimiter 
)
static

Split text into multiple strings.

Definition at line 396 of file Functions.hpp.

References TextSplit().

Referenced by TextSplit().

◆ TextSubtext()

static std::string raylib::TextSubtext ( const std::string_view  text,
int  position,
int  length 
)
inlinestatic

Get text length, checks for '\0' ending.

Definition at line 362 of file Functions.hpp.

◆ TextToInteger()

static int raylib::TextToInteger ( const std::string_view  text)
inlinestatic

Get integer value from text (negative values not supported)

Definition at line 433 of file Functions.hpp.

◆ TextToLower()

static std::string raylib::TextToLower ( const std::string_view  text)
inlinestatic

Get lower case version of provided string.

Definition at line 419 of file Functions.hpp.

◆ TextToPascal()

static std::string raylib::TextToPascal ( const std::string_view  text)
inlinestatic

Get Pascal case notation version of provided string.

Definition at line 426 of file Functions.hpp.

◆ TextToUpper()

static std::string raylib::TextToUpper ( const std::string_view  text)
inlinestatic

Get upper case version of provided string.

Definition at line 412 of file Functions.hpp.