From a5edc5b098ca04b7d41f91428be87aef60aee50d Mon Sep 17 00:00:00 2001 From: Tenshi Date: Sun, 1 Oct 2023 14:09:52 +0200 Subject: [PATCH 1/5] DOCUMENTATION: Add raylib wrapper documentation MINOR --- docs/SUMMARY.md | 4 + docs/developer-guide/client/README.md | 21 ++ docs/developer-guide/client/audio/README.md | 124 +++++++ docs/developer-guide/client/events/README.md | 83 +++++ .../developer-guide/client/geometry/README.md | 65 ++++ docs/developer-guide/client/graphic/README.md | 308 ++++++++++++++++++ 6 files changed, 605 insertions(+) create mode 100644 docs/developer-guide/client/audio/README.md create mode 100644 docs/developer-guide/client/events/README.md create mode 100644 docs/developer-guide/client/geometry/README.md create mode 100644 docs/developer-guide/client/graphic/README.md diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 13c26c2f..f07b60c1 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -37,6 +37,10 @@ - [Server](developer-guide/server/README.md) - [Client](developer-guide/client/README.md) + - [Audio](developer-guide/client/audio/README.md) + - [Events](developer-guide/client/events/README.md) + - [Geometry](developer-guide/client/geometry/README.md) + - [Graphic](developer-guide/client/graphic/README.md) ----------- diff --git a/docs/developer-guide/client/README.md b/docs/developer-guide/client/README.md index e69de29b..f778fd79 100644 --- a/docs/developer-guide/client/README.md +++ b/docs/developer-guide/client/README.md @@ -0,0 +1,21 @@ +# C++ Client Documentation + +## Table of Contents +- [Introduction](#introduction) +- [Raylib Library](#raylib-library) + +## Introduction +The C++ client is a simple game client that uses the Raylib library to handle graphics and audio. The client is designed to be simple and easy to use, but it is also very flexible and can be used to create more complex games. + +## Raylib Library +We use the Raylib library to handle our graphics and audio. Raylib is a simple and easy-to-use library that provides a wide range of features. The Raylib library is written in C, but we have wrapped it in C++ classes to make it easier to use. + +Explore the following sections to understand and utilize different aspects of the Raylib library: + +- [**Audio**](audio/index.html): Learn how to add sounds, music, and other audio effects to your game. + +- [**Geometry**](inputs/index.html): Learn about the different data structures and how to use them. + +- [**Events**](events/index.html): Detect and respond to application events like mouse clicks and keyboard inputs. + +- [**Graphics**](graphics/index.html): Learn about advanced graphic rendering, music, animations... diff --git a/docs/developer-guide/client/audio/README.md b/docs/developer-guide/client/audio/README.md new file mode 100644 index 00000000..974e5269 --- /dev/null +++ b/docs/developer-guide/client/audio/README.md @@ -0,0 +1,124 @@ +# Using Audio in our game client + +In your C++ client application, you can manage audio using the Raylib library. This guide explains how to work with sounds and music using our Raylib wrapper classes. + +## Sound Class + +### Constructors + +```cpp +Raylib::Sound(const std::string& fileName, float volume = 0.5f); +``` +Create a sound object from the specified audio file. + +### Methods + +```cpp +void unload(); +void play() const; +void stop() const; +void pause() const; +void resume() const; +bool isPlaying() const; +void setVolume(float volume) const; +void setPitch(float pitch) const; +void setPan(float pan) const; +bool NeedToPlay() const; +void setNeedToPlay(bool needToPlay); +std::string getPath() const; +``` + +### Example usage + +```cpp +Raylib::Sound mySound("path/to/soundfile.wav"); +mySound.play(); +mySound.setVolume(0.8f); +``` + +## Music Class + +### Constructors + +```cpp +Raylib::Music(const std::string& fileName, float volume = 0.5f); +``` + +Create a music object from the specified audio file. + +### Methods + +```cpp +void unload(); +bool isReady() const; +void play() const; +bool isPlaying() const; +void update() const; +void stop() const; +void pause() const; +void resume() const; +void setVolume(float volume) const; +void setPitch(float pitch) const; +void setPan(float pan) const; +float getTimeLength() const; +float getTimePlayed() const; +bool NeedToPlay() const; +void setNeedToPlay(bool needToPlay); +std::string getPath() const; +``` + +### Example usage + +```cpp +Raylib::Music myMusic("path/to/musicfile.ogg"); +myMusic.play(); +myMusic.setVolume(0.6f); +``` + +## Audio Device Management + +### Functions + +```cpp +void initAudioDevice(); +void closeAudioDevice(); +bool isAudioDeviceReady(); +void setMasterVolume(float volume); +``` + +## Example usage + +You need to initialize the audio device before using any audio functions. You can do this by calling the initAudioDevice() function. You can then use the other functions to manage the audio device. If you want to player music, every frame you need to call the UpdateMusicStream() function. + +```cpp +int main() { + Raylib::Music music("path/to/musicfile.ogg"); + + initAudioDevice(); + // game loop + while (!WindowShouldClose()) { + // stuff + //for every music + UpdateMusicStream(music); + } + closeAudioDevice(); +} +``` + +## Audio File Formats + +Raylib supports the following audio file formats: + +- WAV +- OGG +- MP3 +- XM +- QOA +- MOD +- FLAC + +## Volume, pitch, and pan + +- The pitch base level is 1.0f (normal pitch). +- The volume base level is 1.0f (maximum volume). +- The pan base level is 0.5f (center). diff --git a/docs/developer-guide/client/events/README.md b/docs/developer-guide/client/events/README.md new file mode 100644 index 00000000..cf6f9526 --- /dev/null +++ b/docs/developer-guide/client/events/README.md @@ -0,0 +1,83 @@ +# Input Handling + +In your game client, we use and enum to represent keyboard and mouse keys. The enum is defined in `inputs.hpp` and is called `KeyboardKey` and `MouseButton`. The enum values are the same as the ones defined in `raylib.h`. + +## Input-related functions: keyboard + +- `bool isKeyPressed(KeyboardKey key);` + Check if a key has been pressed once. + +- `bool isKeyDown(KeyboardKey key);` + Check if a key is being pressed. + +- `bool isKeyReleased(KeyboardKey key);` + Check if a key has been released once. + +- `bool isKeyUp(KeyboardKey key);` + Check if a key is NOT being pressed. + +- `void setExitKey(KeyboardKey key);` + Set a key to exit the application. + +- `int getKeyPressed();` + Get the key pressed (keycode). + +- `int getCharPressed();` + Get the last character pressed (unicode). + +## Input-related functions: mouse + +- `bool isMouseButtonPressed(MouseButton button);` + Check if a mouse button has been pressed once. + +- `bool isMouseButtonDown(MouseButton button);` + Check if a mouse button is being pressed. + +- `bool isMouseButtonReleased(MouseButton button);` + Check if a mouse button has been released once. + +- `bool isMouseButtonUp(MouseButton button);` + Check if a mouse button is NOT being pressed. + +- `int getMouseX();` + Get the X position of the mouse cursor. + +- `int getMouseY();` + Get the Y position of the mouse cursor. + +- `Vector2 getMousePosition();` + Get the current position of the mouse cursor. + +- `Vector2 getMouseDelta();` + Get the mouse delta movement. + +- `void setMousePosition(int x, int y);` + Set the position of the mouse cursor. + +- `void setMouseOffset(int offsetX, int offsetY);` + Set an offset for the mouse position. + +- `void setMouseScale(float scaleX, float scaleY);` + Set the scaling factor for the mouse position. + +- `float getMouseWheelMove();` + Get the mouse wheel movement. + +- `Vector2 getMouseWheelMoveV();` + Get the mouse wheel movement as a vector. + +- `void setMouseCursor(int cursor);` + Set the mouse cursor style. + +## Example + +```cpp +if (Raylib::isKeyDown(Raylib::KeyboardKey::KB_RIGHT)) +{ + // Move right +} +else if (Raylib::isKeyDown(Raylib::KeyboardKey::KB_LEFT)) +{ + // Move left +} +``` diff --git a/docs/developer-guide/client/geometry/README.md b/docs/developer-guide/client/geometry/README.md new file mode 100644 index 00000000..7d80b99f --- /dev/null +++ b/docs/developer-guide/client/geometry/README.md @@ -0,0 +1,65 @@ +# Geometry and Color guide + +## Vector2 Structure + +Represents a 2D vector. + +- `Vector2(float x, float y);` + Constructor to create a 2D vector with specified `x` and `y` values. + +## Vector3 Structure + +Represents a 3D vector. + +- `Vector3(float x, float y, float z);` + Constructor to create a 3D vector with specified `x`, `y`, and `z` values. + +## Vector4 Structure + +Represents a 4D vector. + +- `Vector4(float x, float y, float z, float w);` + Constructor to create a 4D vector with specified `x`, `y`, `z`, and `w` values. + +## Rectangle Structure + +Represents a rectangle. + +- `Rectangle(float x, float y, float width, float height);` + Constructor to create a rectangle with specified `x`, `y`, `width`, and `height` values. + +## Color Structure + +Represents a color. + +- `Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a);` + Constructor to create a color with specified `r` (red), `g` (green), `b` (blue), and `a` (alpha) values. + +### Color Constants + +- `Raylib::DarkGray` +- `Raylib::Yellow` +- `Raylib::Gold` +- `Raylib::Orange` +- `Raylib::Pink` +- `Raylib::Red` +- `Raylib::Maroon` +- `Raylib::Green` +- `Raylib::Lime` +- `Raylib::DarkGreen` +- `Raylib::SkyBlue` +- `Raylib::Blue` +- `Raylib::DarkBlue` +- `Raylib::Purple` +- `Raylib::Violet` +- `Raylib::DarkPurple` +- `Raylib::Beige` +- `Raylib::Brown` +- `Raylib::DarkBrown` +- `Raylib::White` +- `Raylib::Black` +- `Raylib::Blank` +- `Raylib::Magenta` +- `Raylib::RayWhite` + +These constants represent predefined colors for convenience in your graphical applications. diff --git a/docs/developer-guide/client/graphic/README.md b/docs/developer-guide/client/graphic/README.md new file mode 100644 index 00000000..5bce3a8e --- /dev/null +++ b/docs/developer-guide/client/graphic/README.md @@ -0,0 +1,308 @@ +# Using Graphics in our game client + +This guide explains how to work in your game client with images, sprites, text, ... using our Raylib wrapper classes. + +## Sprite Class + +### Constructors + +```cpp +Raylib::Sprite(const std::string &fileName, float width, float height); +Raylib::Sprite(Image image, float width, float height); +``` + +Create a sprite object from the specified file and set its width and height or create a sprite from an image object with the given width and height. The width and height are in percentage of the screen. + +### Methods + +```cpp +unsigned int getId() const; +float getWidth() const; +float getHeight() const; +int getTextureWidth() const; +int getTextureHeight() const; +int getMipmaps() const; +int getFormat() const; +void unloadSprite(); +``` + +### Example usage + +```cpp +Raylib::Sprite mySprite("path/to/spritefile.png", 100.0f, 150.0f); +float spriteWidth = mySprite.getWidth(); +std::cout << "Sprite width: " << spriteWidth << std::endl; +mySprite.unloadSprite(); +``` + +## Text Class + +### Constructors + +```cpp +Raylib::Text( + std::string text, + Raylib::Vector2 position = {0, 0}, + float fontSize = 5.0f, + Raylib::Color color = Raylib::BLACK); +``` + +Create a text object with the given text, position, font size, and color. + +### Methods + +```cpp +void draw(); +void drawEx(float spacing); +void drawPro(Raylib::Vector2 origin, float rotation, float spacing); + +float x() const; +float y() const; +float getFontSize() const; +void setFontSize(float fontSize); +Raylib::Vector2 getPosition() const; +void setPixelPosition(Raylib::Vector2 position); +void setCurrentFontSize(float fontSize); +``` + +getPosition is in percentage of the screen size. For each draw, we recommand to compute and set the position in pixel with setPixelPosition to have a responsive text. + +### Example usage + +```cpp +Raylib::Text myText("Hello, World!", {100, 200}, 20.0f, Raylib::BLUE); +myText.setPixelPosition({300, 400}); +myText.draw(); +``` + +## Image Class + +### Constructors + +```cpp +Raylib::Image(const std::string& fileName); +Raylib::Image(int width, int height, Raylib::Color color); +``` +Create an image object from the specified file or create a blank image with the given width, height, and color. + +### Methods + +```cpp +bool isImageReady() const; +void unloadImage(); +int getWidth() const; +int getHeight() const; +int getMipmaps() const; +int getFormat() const; +void* getData() const; +``` + +### Example usage + +```cpp +Raylib::Image myImage("path/to/imagefile.png"); +int width = myImage.getWidth(); +std::cout << "Image width: " << width << std::endl; +myImage.unloadImage(); +``` + +## Shapes and drawing functions + +```cpp +void drawPixel(int posX, int posY, Raylib::Color color); +void drawCircle(int centerX, int centerY, float radius, Raylib::Color color); +void drawRectangle(int posX, int posY, int width, int height, Raylib::Color color); +``` + +### Example usage + +```cpp +Raylib::drawPixel(100, 100, Raylib::RED); +Raylib::drawCircle(200, 200, 50, Raylib::GREEN); +Raylib::drawRectangle(300, 300, 80, 120, Raylib::BLUE); +``` + +## Window-related functions + +- `void initWindow(int width, int height, const std::string &title);` + Initialize the game window with the specified width, height, and title. + +- `bool windowShouldClose();` + Check if the window should close (user pressed close button or escape key). + +- `void closeWindow();` + Close the game window. + +- `bool isWindowReady();` + Check if the window has been initialized successfully. + +- `bool isWindowFullscreen();` + Check if the window is in fullscreen mode. + +- `bool isWindowHidden();` + Check if the window is currently hidden. + +- `bool isWindowMinimized();` + Check if the window is currently minimized. + +- `bool isWindowMaximized();` + Check if the window is currently maximized. + +- `bool isWindowFocused();` + Check if the window is currently focused. + +- `void setConfigFlags(ConfigFlags flags);` + Set configuration flags for the window. + +- `bool isWindowResized();` + Check if the window has been resized. + +- `bool isWindowState(ConfigFlags flag);` + Check if a specific window state flag is set. + +- `void setWindowState(ConfigFlags flag);` + Set a specific window state flag. + +- `void clearWindowState(ConfigFlags flags);` + Clear specific window state flags. + +- `void toggleFullscreen();` + Toggle fullscreen mode. + +- `void maximizeWindow();` + Maximize the window. + +- `void minimizeWindow();` + Minimize the window. + +- `void setWindowTitle(const std::string &title);` + Set the title of the window. + +- `int getScreenWidth();` + Get the current screen width. + +- `int getScreenHeight();` + Get the current screen height. + +- `int getRenderWidth();` + Get the current rendering width + +- `int getRenderHeight();` + Get the current rendering height + +- `int getMonitorWidth(int monitor);` + Get the width of the specified monitor. + +- `int getMonitorHeight(int monitor);` + Get the height of the specified monitor. + +- `int getMonitorRefreshRate(int monitor);` + Get the refresh rate of the specified monitor. + +- `int getCurrentMonitor();` + Get the index of the current monitor. + +- `void setClipboardText(const std::string &text);` + Set the text to be copied to the clipboard. + +- `std::string getClipboardText();` + Get the text currently copied to the clipboard. + +- `void setWindowIcon(Image image);` + Set the window icon. + +## Cursor-related functions + +- `void showCursor();` + Show the cursor. + +- `void hideCursor();` + Hide the cursor. + +- `bool isCursorHidden();` + Check if the cursor is currently hidden. + +- `void enableCursor();` + Enable cursor (unlock it). + +- `void disableCursor();` + Disable cursor (lock it). + +- `bool isCursorOnScreen();` + Check if the cursor is within the game window. + +## Drawing-related functions + +- `void clearBackground(Raylib::Color color);` + Clear the background with a specified color. + +- `void beginDrawing();` + Begin drawing. + +- `void endDrawing();` + End drawing and swap buffers. + +## Timing-related functions + +- `void setTargetFPS(int fps);` + Set the target frames-per-second. + +- `int getFPS();` + Get the current frames-per-second. + +- `float getFrameTime();` + Get the time in seconds for a frame. + +- `double getTime();` + Get the current time in seconds. + +## Misc. functions + +- `void takeScreenshot(const std::string &fileName);` + Take a screenshot and save it to a file with the specified name. + +## Shapes-related functions + +- `void drawPixel(int posX, int posY, Raylib::Color color);` + Draw a pixel at the specified position with the given color. + +- `void drawCircle(int centerX, int centerY, float radius, Raylib::Color color);` + Draw a circle with the specified center, radius, and color. + +- `void drawRectangle(int posX, int posY, int width, int height, Raylib::Color color);` + Draw a rectangle at the specified position with the given width, height, and color. + +## Color/pixel related functions + +- `Raylib::Color fade(Raylib::Color color, float alpha);` + Fade a color by a specified alpha value. + +- `int colorToInt(Raylib::Color color);` + Convert a Color to a 32-bit integer. + +- `Vector4 colorNormalize(Raylib::Color color);` + Normalize a Color struct to a Vector4. + +- `Raylib::Color colorFromNormalized(Vector4 normalized);` + Create a Color from a normalized Vector4. + +- `Raylib::Color getColor(unsigned int hexValue);` + Create a Color from a hex value. + +## Enum ConfigFlags + +You can use the following flags to configure the window: + +- `FLAG_FULLSCREEN_MODE`: Set fullscreen mode. +- `FLAG_WINDOW_RESIZABLE`: Allow the window to be resized. +- `FLAG_WINDOW_UNDECORATED`: Disable window decoration (frame and buttons). +- `FLAG_WINDOW_TRANSPARENT`: Allow the window to be transparent. +- `FLAG_WINDOW_HIDDEN`: Hide the window. +- `FLAG_WINDOW_MINIMIZED`: Minimize the window. +- `FLAG_WINDOW_MAXIMIZED`: Maximize the window. +- `FLAG_WINDOW_UNFOCUSED`: Disable window focus. +- `FLAG_WINDOW_TOPMOST`: Set the window to be always on top. +- `FLAG_WINDOW_HIGHDPI`: Enable high-DPI mode. +- `FLAG_WINDOW_ALWAYS_RUN`: Allow the window to run in the background. +- `FLAG_MSAA_4X_HINT`: Enable 4x MSAA. +- `FLAG_VSYNC_HINT`: Enable V-Sync. From 7b1aa0da2efe991f9b496b097457e80647e0dd16 Mon Sep 17 00:00:00 2001 From: tenshi Date: Mon, 2 Oct 2023 11:45:31 +0200 Subject: [PATCH 2/5] DOCUMENTATION: Fix merge request PATCH --- docs/developer-guide/client/README.md | 10 - docs/developer-guide/client/audio/README.md | 121 ------- .../client/audio/audio-file-formats.md | 11 + .../client/audio/audio-settings.md | 5 + .../client/audio/device-management.md | 29 ++ docs/developer-guide/client/audio/music.md | 38 +++ docs/developer-guide/client/audio/sounds.md | 33 ++ docs/developer-guide/client/events/README.md | 80 ----- .../developer-guide/client/events/keyboard.md | 22 ++ docs/developer-guide/client/events/mouse.md | 56 ++++ .../developer-guide/client/geometry/README.md | 64 ---- docs/developer-guide/client/geometry/color.md | 6 + .../client/geometry/constant.md | 26 ++ .../client/geometry/rectangle.md | 6 + .../client/geometry/vector2.md | 6 + .../client/geometry/vector3.md | 6 + .../client/geometry/vector4.md | 6 + docs/developer-guide/client/graphic/README.md | 305 ------------------ .../client/graphic/colors-pixels.md | 16 + .../client/graphic/configFlag.md | 23 ++ docs/developer-guide/client/graphic/cursor.md | 19 ++ .../developer-guide/client/graphic/drawing.md | 10 + .../client/graphic/frameRate.md | 13 + docs/developer-guide/client/graphic/image.md | 30 ++ docs/developer-guide/client/graphic/misc.md | 4 + docs/developer-guide/client/graphic/shapes.md | 18 ++ docs/developer-guide/client/graphic/sprite.md | 32 ++ docs/developer-guide/client/graphic/text.md | 39 +++ docs/developer-guide/client/graphic/window.md | 88 +++++ 29 files changed, 542 insertions(+), 580 deletions(-) create mode 100644 docs/developer-guide/client/audio/audio-file-formats.md create mode 100644 docs/developer-guide/client/audio/audio-settings.md create mode 100644 docs/developer-guide/client/audio/device-management.md create mode 100644 docs/developer-guide/client/audio/music.md create mode 100644 docs/developer-guide/client/audio/sounds.md create mode 100644 docs/developer-guide/client/events/keyboard.md create mode 100644 docs/developer-guide/client/events/mouse.md create mode 100644 docs/developer-guide/client/geometry/color.md create mode 100644 docs/developer-guide/client/geometry/constant.md create mode 100644 docs/developer-guide/client/geometry/rectangle.md create mode 100644 docs/developer-guide/client/geometry/vector2.md create mode 100644 docs/developer-guide/client/geometry/vector3.md create mode 100644 docs/developer-guide/client/geometry/vector4.md create mode 100644 docs/developer-guide/client/graphic/colors-pixels.md create mode 100644 docs/developer-guide/client/graphic/configFlag.md create mode 100644 docs/developer-guide/client/graphic/cursor.md create mode 100644 docs/developer-guide/client/graphic/drawing.md create mode 100644 docs/developer-guide/client/graphic/frameRate.md create mode 100644 docs/developer-guide/client/graphic/image.md create mode 100644 docs/developer-guide/client/graphic/misc.md create mode 100644 docs/developer-guide/client/graphic/shapes.md create mode 100644 docs/developer-guide/client/graphic/sprite.md create mode 100644 docs/developer-guide/client/graphic/text.md create mode 100644 docs/developer-guide/client/graphic/window.md diff --git a/docs/developer-guide/client/README.md b/docs/developer-guide/client/README.md index f778fd79..8a8e3e28 100644 --- a/docs/developer-guide/client/README.md +++ b/docs/developer-guide/client/README.md @@ -9,13 +9,3 @@ The C++ client is a simple game client that uses the Raylib library to handle gr ## Raylib Library We use the Raylib library to handle our graphics and audio. Raylib is a simple and easy-to-use library that provides a wide range of features. The Raylib library is written in C, but we have wrapped it in C++ classes to make it easier to use. - -Explore the following sections to understand and utilize different aspects of the Raylib library: - -- [**Audio**](audio/index.html): Learn how to add sounds, music, and other audio effects to your game. - -- [**Geometry**](inputs/index.html): Learn about the different data structures and how to use them. - -- [**Events**](events/index.html): Detect and respond to application events like mouse clicks and keyboard inputs. - -- [**Graphics**](graphics/index.html): Learn about advanced graphic rendering, music, animations... diff --git a/docs/developer-guide/client/audio/README.md b/docs/developer-guide/client/audio/README.md index 974e5269..4a0415c7 100644 --- a/docs/developer-guide/client/audio/README.md +++ b/docs/developer-guide/client/audio/README.md @@ -1,124 +1,3 @@ # Using Audio in our game client In your C++ client application, you can manage audio using the Raylib library. This guide explains how to work with sounds and music using our Raylib wrapper classes. - -## Sound Class - -### Constructors - -```cpp -Raylib::Sound(const std::string& fileName, float volume = 0.5f); -``` -Create a sound object from the specified audio file. - -### Methods - -```cpp -void unload(); -void play() const; -void stop() const; -void pause() const; -void resume() const; -bool isPlaying() const; -void setVolume(float volume) const; -void setPitch(float pitch) const; -void setPan(float pan) const; -bool NeedToPlay() const; -void setNeedToPlay(bool needToPlay); -std::string getPath() const; -``` - -### Example usage - -```cpp -Raylib::Sound mySound("path/to/soundfile.wav"); -mySound.play(); -mySound.setVolume(0.8f); -``` - -## Music Class - -### Constructors - -```cpp -Raylib::Music(const std::string& fileName, float volume = 0.5f); -``` - -Create a music object from the specified audio file. - -### Methods - -```cpp -void unload(); -bool isReady() const; -void play() const; -bool isPlaying() const; -void update() const; -void stop() const; -void pause() const; -void resume() const; -void setVolume(float volume) const; -void setPitch(float pitch) const; -void setPan(float pan) const; -float getTimeLength() const; -float getTimePlayed() const; -bool NeedToPlay() const; -void setNeedToPlay(bool needToPlay); -std::string getPath() const; -``` - -### Example usage - -```cpp -Raylib::Music myMusic("path/to/musicfile.ogg"); -myMusic.play(); -myMusic.setVolume(0.6f); -``` - -## Audio Device Management - -### Functions - -```cpp -void initAudioDevice(); -void closeAudioDevice(); -bool isAudioDeviceReady(); -void setMasterVolume(float volume); -``` - -## Example usage - -You need to initialize the audio device before using any audio functions. You can do this by calling the initAudioDevice() function. You can then use the other functions to manage the audio device. If you want to player music, every frame you need to call the UpdateMusicStream() function. - -```cpp -int main() { - Raylib::Music music("path/to/musicfile.ogg"); - - initAudioDevice(); - // game loop - while (!WindowShouldClose()) { - // stuff - //for every music - UpdateMusicStream(music); - } - closeAudioDevice(); -} -``` - -## Audio File Formats - -Raylib supports the following audio file formats: - -- WAV -- OGG -- MP3 -- XM -- QOA -- MOD -- FLAC - -## Volume, pitch, and pan - -- The pitch base level is 1.0f (normal pitch). -- The volume base level is 1.0f (maximum volume). -- The pan base level is 0.5f (center). diff --git a/docs/developer-guide/client/audio/audio-file-formats.md b/docs/developer-guide/client/audio/audio-file-formats.md new file mode 100644 index 00000000..25cf75b5 --- /dev/null +++ b/docs/developer-guide/client/audio/audio-file-formats.md @@ -0,0 +1,11 @@ +## Audio File Formats + +Raylib supports the following audio file formats: + +- WAV +- OGG +- MP3 +- XM +- QOA +- MOD +- FLAC diff --git a/docs/developer-guide/client/audio/audio-settings.md b/docs/developer-guide/client/audio/audio-settings.md new file mode 100644 index 00000000..2f6e50e5 --- /dev/null +++ b/docs/developer-guide/client/audio/audio-settings.md @@ -0,0 +1,5 @@ +## Volume, pitch, and pan + +- The pitch base level is 1.0f (normal pitch). +- The volume base level is 1.0f (maximum volume). +- The pan base level is 0.5f (center). diff --git a/docs/developer-guide/client/audio/device-management.md b/docs/developer-guide/client/audio/device-management.md new file mode 100644 index 00000000..b69f2234 --- /dev/null +++ b/docs/developer-guide/client/audio/device-management.md @@ -0,0 +1,29 @@ +## Audio Device Management + +### Functions + +```cpp +void initAudioDevice(); +void closeAudioDevice(); +bool isAudioDeviceReady(); +void setMasterVolume(float volume); +``` + +## Example usage + +You need to initialize the audio device before using any audio functions. You can do this by calling the initAudioDevice() function. You can then use the other functions to manage the audio device. If you want to player music, every frame you need to call the UpdateMusicStream() function. + +```cpp +int main() { + Raylib::Music music("path/to/musicfile.ogg"); + + initAudioDevice(); + // game loop + while (!WindowShouldClose()) { + // stuff + //for every music + UpdateMusicStream(music); + } + closeAudioDevice(); +} +``` diff --git a/docs/developer-guide/client/audio/music.md b/docs/developer-guide/client/audio/music.md new file mode 100644 index 00000000..23442106 --- /dev/null +++ b/docs/developer-guide/client/audio/music.md @@ -0,0 +1,38 @@ +## Music Class + +### Constructors + +```cpp +Raylib::Music(const std::string& fileName, float volume = 0.5f); +``` + +Create a music object from the specified audio file. + +### Methods + +```cpp +void unload(); +bool isReady() const; +void play() const; +bool isPlaying() const; +void update() const; +void stop() const; +void pause() const; +void resume() const; +void setVolume(float volume) const; +void setPitch(float pitch) const; +void setPan(float pan) const; +float getTimeLength() const; +float getTimePlayed() const; +bool NeedToPlay() const; +void setNeedToPlay(bool needToPlay); +std::string getPath() const; +``` + +### Example usage + +```cpp +Raylib::Music myMusic("path/to/musicfile.ogg"); +myMusic.play(); +myMusic.setVolume(0.6f); +``` diff --git a/docs/developer-guide/client/audio/sounds.md b/docs/developer-guide/client/audio/sounds.md new file mode 100644 index 00000000..22925547 --- /dev/null +++ b/docs/developer-guide/client/audio/sounds.md @@ -0,0 +1,33 @@ +## Sound Class + +### Constructors + +```cpp +Raylib::Sound(const std::string& fileName, float volume = 0.5f); +``` +Create a sound object from the specified audio file. + +### Methods + +```cpp +void Raylib::Sound::unload(); +void Raylib::Sound::play() const; +void Raylib::Sound::stop() const; +void Raylib::Sound::pause() const; +void Raylib::Sound::resume() const; +bool Raylib::Sound::isPlaying() const; +void Raylib::Sound::setVolume(float volume) const; +void Raylib::Sound::setPitch(float pitch) const; +void Raylib::Sound::setPan(float pan) const; +bool Raylib::Sound::NeedToPlay() const; +void Raylib::Sound::setNeedToPlay(bool needToPlay); +std::string Raylib::Sound::getPath() const; +``` + +### Example usage + +```cpp +Raylib::Sound mySound("path/to/soundfile.wav"); +mySound.play(); +mySound.setVolume(0.8f); +``` diff --git a/docs/developer-guide/client/events/README.md b/docs/developer-guide/client/events/README.md index cf6f9526..2f954901 100644 --- a/docs/developer-guide/client/events/README.md +++ b/docs/developer-guide/client/events/README.md @@ -1,83 +1,3 @@ # Input Handling In your game client, we use and enum to represent keyboard and mouse keys. The enum is defined in `inputs.hpp` and is called `KeyboardKey` and `MouseButton`. The enum values are the same as the ones defined in `raylib.h`. - -## Input-related functions: keyboard - -- `bool isKeyPressed(KeyboardKey key);` - Check if a key has been pressed once. - -- `bool isKeyDown(KeyboardKey key);` - Check if a key is being pressed. - -- `bool isKeyReleased(KeyboardKey key);` - Check if a key has been released once. - -- `bool isKeyUp(KeyboardKey key);` - Check if a key is NOT being pressed. - -- `void setExitKey(KeyboardKey key);` - Set a key to exit the application. - -- `int getKeyPressed();` - Get the key pressed (keycode). - -- `int getCharPressed();` - Get the last character pressed (unicode). - -## Input-related functions: mouse - -- `bool isMouseButtonPressed(MouseButton button);` - Check if a mouse button has been pressed once. - -- `bool isMouseButtonDown(MouseButton button);` - Check if a mouse button is being pressed. - -- `bool isMouseButtonReleased(MouseButton button);` - Check if a mouse button has been released once. - -- `bool isMouseButtonUp(MouseButton button);` - Check if a mouse button is NOT being pressed. - -- `int getMouseX();` - Get the X position of the mouse cursor. - -- `int getMouseY();` - Get the Y position of the mouse cursor. - -- `Vector2 getMousePosition();` - Get the current position of the mouse cursor. - -- `Vector2 getMouseDelta();` - Get the mouse delta movement. - -- `void setMousePosition(int x, int y);` - Set the position of the mouse cursor. - -- `void setMouseOffset(int offsetX, int offsetY);` - Set an offset for the mouse position. - -- `void setMouseScale(float scaleX, float scaleY);` - Set the scaling factor for the mouse position. - -- `float getMouseWheelMove();` - Get the mouse wheel movement. - -- `Vector2 getMouseWheelMoveV();` - Get the mouse wheel movement as a vector. - -- `void setMouseCursor(int cursor);` - Set the mouse cursor style. - -## Example - -```cpp -if (Raylib::isKeyDown(Raylib::KeyboardKey::KB_RIGHT)) -{ - // Move right -} -else if (Raylib::isKeyDown(Raylib::KeyboardKey::KB_LEFT)) -{ - // Move left -} -``` diff --git a/docs/developer-guide/client/events/keyboard.md b/docs/developer-guide/client/events/keyboard.md new file mode 100644 index 00000000..eb2f5412 --- /dev/null +++ b/docs/developer-guide/client/events/keyboard.md @@ -0,0 +1,22 @@ +## Input-related functions: keyboard + +- `bool Raylib::isKeyPressed(KeyboardKey key);` + Check if a key has been pressed once. + +- `bool Raylib::isKeyDown(KeyboardKey key);` + Check if a key is being pressed. + +- `bool Raylib::isKeyReleased(KeyboardKey key);` + Check if a key has been released once. + +- `bool Raylib::isKeyUp(KeyboardKey key);` + Check if a key is NOT being pressed. + +- `void Raylib::setExitKey(KeyboardKey key);` + Set a key to exit the application. + +- `int Raylib::getKeyPressed();` + Get the key pressed (keycode). + +- `int Raylib::getCharPressed();` + Get the last character pressed (unicode). diff --git a/docs/developer-guide/client/events/mouse.md b/docs/developer-guide/client/events/mouse.md new file mode 100644 index 00000000..aea0880b --- /dev/null +++ b/docs/developer-guide/client/events/mouse.md @@ -0,0 +1,56 @@ +## Input-related functions: mouse + +- `bool Raylib::isMouseButtonPressed(MouseButton button);` + Check if a mouse button has been pressed once. + +- `bool Raylib::isMouseButtonDown(MouseButton button);` + Check if a mouse button is being pressed. + +- `bool Raylib::isMouseButtonReleased(MouseButton button);` + Check if a mouse button has been released once. + +- `bool Raylib::isMouseButtonUp(MouseButton button);` + Check if a mouse button is NOT being pressed. + +- `int Raylib::getMouseX();` + Get the X position of the mouse cursor. + +- `int Raylib::getMouseY();` + Get the Y position of the mouse cursor. + +- `Vector2 Raylib::getMousePosition();` + Get the current position of the mouse cursor. + +- `Vector2 Raylib::getMouseDelta();` + Get the mouse delta movement. + +- `void Raylib::setMousePosition(int x, int y);` + Set the position of the mouse cursor. + +- `void Raylib::setMouseOffset(int offsetX, int offsetY);` + Set an offset for the mouse position. + +- `void Raylib::setMouseScale(float scaleX, float scaleY);` + Set the scaling factor for the mouse position. + +- `float Raylib::getMouseWheelMove();` + Get the mouse wheel movement. + +- `Vector2 Raylib::getMouseWheelMoveV();` + Get the mouse wheel movement as a vector. + +- `void Raylib::setMouseCursor(int cursor);` + Set the mouse cursor style. + +## Example + +```cpp +if (Raylib::isKeyDown(Raylib::KeyboardKey::KB_RIGHT)) +{ + // Move right +} +else if (Raylib::isKeyDown(Raylib::KeyboardKey::KB_LEFT)) +{ + // Move left +} +``` diff --git a/docs/developer-guide/client/geometry/README.md b/docs/developer-guide/client/geometry/README.md index 7d80b99f..acd81423 100644 --- a/docs/developer-guide/client/geometry/README.md +++ b/docs/developer-guide/client/geometry/README.md @@ -1,65 +1 @@ # Geometry and Color guide - -## Vector2 Structure - -Represents a 2D vector. - -- `Vector2(float x, float y);` - Constructor to create a 2D vector with specified `x` and `y` values. - -## Vector3 Structure - -Represents a 3D vector. - -- `Vector3(float x, float y, float z);` - Constructor to create a 3D vector with specified `x`, `y`, and `z` values. - -## Vector4 Structure - -Represents a 4D vector. - -- `Vector4(float x, float y, float z, float w);` - Constructor to create a 4D vector with specified `x`, `y`, `z`, and `w` values. - -## Rectangle Structure - -Represents a rectangle. - -- `Rectangle(float x, float y, float width, float height);` - Constructor to create a rectangle with specified `x`, `y`, `width`, and `height` values. - -## Color Structure - -Represents a color. - -- `Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a);` - Constructor to create a color with specified `r` (red), `g` (green), `b` (blue), and `a` (alpha) values. - -### Color Constants - -- `Raylib::DarkGray` -- `Raylib::Yellow` -- `Raylib::Gold` -- `Raylib::Orange` -- `Raylib::Pink` -- `Raylib::Red` -- `Raylib::Maroon` -- `Raylib::Green` -- `Raylib::Lime` -- `Raylib::DarkGreen` -- `Raylib::SkyBlue` -- `Raylib::Blue` -- `Raylib::DarkBlue` -- `Raylib::Purple` -- `Raylib::Violet` -- `Raylib::DarkPurple` -- `Raylib::Beige` -- `Raylib::Brown` -- `Raylib::DarkBrown` -- `Raylib::White` -- `Raylib::Black` -- `Raylib::Blank` -- `Raylib::Magenta` -- `Raylib::RayWhite` - -These constants represent predefined colors for convenience in your graphical applications. diff --git a/docs/developer-guide/client/geometry/color.md b/docs/developer-guide/client/geometry/color.md new file mode 100644 index 00000000..f9b9e4f1 --- /dev/null +++ b/docs/developer-guide/client/geometry/color.md @@ -0,0 +1,6 @@ +## Color Structure + +Represents a color. + +- `Raylib::Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a);` + Constructor to create a color with specified `r` (red), `g` (green), `b` (blue), and `a` (alpha) values. diff --git a/docs/developer-guide/client/geometry/constant.md b/docs/developer-guide/client/geometry/constant.md new file mode 100644 index 00000000..f84e4ef5 --- /dev/null +++ b/docs/developer-guide/client/geometry/constant.md @@ -0,0 +1,26 @@ +### Color Constants + +- `Raylib::DarkGray` +- `Raylib::Yellow` +- `Raylib::Gold` +- `Raylib::Orange` +- `Raylib::Pink` +- `Raylib::Red` +- `Raylib::Maroon` +- `Raylib::Green` +- `Raylib::Lime` +- `Raylib::DarkGreen` +- `Raylib::SkyBlue` +- `Raylib::Blue` +- `Raylib::DarkBlue` +- `Raylib::Purple` +- `Raylib::Violet` +- `Raylib::DarkPurple` +- `Raylib::Beige` +- `Raylib::Brown` +- `Raylib::DarkBrown` +- `Raylib::White` +- `Raylib::Black` +- `Raylib::Blank` +- `Raylib::Magenta` +- `Raylib::RayWhite` diff --git a/docs/developer-guide/client/geometry/rectangle.md b/docs/developer-guide/client/geometry/rectangle.md new file mode 100644 index 00000000..7e89604f --- /dev/null +++ b/docs/developer-guide/client/geometry/rectangle.md @@ -0,0 +1,6 @@ +## Rectangle Structure + +Represents a rectangle. + +- `Raylib::Rectangle(float x, float y, float width, float height);` + Constructor to create a rectangle with specified `x`, `y`, `width`, and `height` values. diff --git a/docs/developer-guide/client/geometry/vector2.md b/docs/developer-guide/client/geometry/vector2.md new file mode 100644 index 00000000..069d193d --- /dev/null +++ b/docs/developer-guide/client/geometry/vector2.md @@ -0,0 +1,6 @@ +## Vector2 Structure + +Represents a 2D vector. + +- `Raylib::Vector2(float x, float y);` + Constructor to create a 2D vector with specified `x` and `y` values. \ No newline at end of file diff --git a/docs/developer-guide/client/geometry/vector3.md b/docs/developer-guide/client/geometry/vector3.md new file mode 100644 index 00000000..3f2586ee --- /dev/null +++ b/docs/developer-guide/client/geometry/vector3.md @@ -0,0 +1,6 @@ +## Vector3 Structure + +Represents a 3D vector. + +- `Raylib::Vector3(float x, float y, float z);` + Constructor to create a 3D vector with specified `x`, `y`, and `z` values. diff --git a/docs/developer-guide/client/geometry/vector4.md b/docs/developer-guide/client/geometry/vector4.md new file mode 100644 index 00000000..1f5f0622 --- /dev/null +++ b/docs/developer-guide/client/geometry/vector4.md @@ -0,0 +1,6 @@ +## Vector4 Structure + +Represents a 4D vector. + +- `Raylib::Vector4(float x, float y, float z, float w);` + Constructor to create a 4D vector with specified `x`, `y`, `z`, and `w` values. diff --git a/docs/developer-guide/client/graphic/README.md b/docs/developer-guide/client/graphic/README.md index 5bce3a8e..aa17186b 100644 --- a/docs/developer-guide/client/graphic/README.md +++ b/docs/developer-guide/client/graphic/README.md @@ -1,308 +1,3 @@ # Using Graphics in our game client This guide explains how to work in your game client with images, sprites, text, ... using our Raylib wrapper classes. - -## Sprite Class - -### Constructors - -```cpp -Raylib::Sprite(const std::string &fileName, float width, float height); -Raylib::Sprite(Image image, float width, float height); -``` - -Create a sprite object from the specified file and set its width and height or create a sprite from an image object with the given width and height. The width and height are in percentage of the screen. - -### Methods - -```cpp -unsigned int getId() const; -float getWidth() const; -float getHeight() const; -int getTextureWidth() const; -int getTextureHeight() const; -int getMipmaps() const; -int getFormat() const; -void unloadSprite(); -``` - -### Example usage - -```cpp -Raylib::Sprite mySprite("path/to/spritefile.png", 100.0f, 150.0f); -float spriteWidth = mySprite.getWidth(); -std::cout << "Sprite width: " << spriteWidth << std::endl; -mySprite.unloadSprite(); -``` - -## Text Class - -### Constructors - -```cpp -Raylib::Text( - std::string text, - Raylib::Vector2 position = {0, 0}, - float fontSize = 5.0f, - Raylib::Color color = Raylib::BLACK); -``` - -Create a text object with the given text, position, font size, and color. - -### Methods - -```cpp -void draw(); -void drawEx(float spacing); -void drawPro(Raylib::Vector2 origin, float rotation, float spacing); - -float x() const; -float y() const; -float getFontSize() const; -void setFontSize(float fontSize); -Raylib::Vector2 getPosition() const; -void setPixelPosition(Raylib::Vector2 position); -void setCurrentFontSize(float fontSize); -``` - -getPosition is in percentage of the screen size. For each draw, we recommand to compute and set the position in pixel with setPixelPosition to have a responsive text. - -### Example usage - -```cpp -Raylib::Text myText("Hello, World!", {100, 200}, 20.0f, Raylib::BLUE); -myText.setPixelPosition({300, 400}); -myText.draw(); -``` - -## Image Class - -### Constructors - -```cpp -Raylib::Image(const std::string& fileName); -Raylib::Image(int width, int height, Raylib::Color color); -``` -Create an image object from the specified file or create a blank image with the given width, height, and color. - -### Methods - -```cpp -bool isImageReady() const; -void unloadImage(); -int getWidth() const; -int getHeight() const; -int getMipmaps() const; -int getFormat() const; -void* getData() const; -``` - -### Example usage - -```cpp -Raylib::Image myImage("path/to/imagefile.png"); -int width = myImage.getWidth(); -std::cout << "Image width: " << width << std::endl; -myImage.unloadImage(); -``` - -## Shapes and drawing functions - -```cpp -void drawPixel(int posX, int posY, Raylib::Color color); -void drawCircle(int centerX, int centerY, float radius, Raylib::Color color); -void drawRectangle(int posX, int posY, int width, int height, Raylib::Color color); -``` - -### Example usage - -```cpp -Raylib::drawPixel(100, 100, Raylib::RED); -Raylib::drawCircle(200, 200, 50, Raylib::GREEN); -Raylib::drawRectangle(300, 300, 80, 120, Raylib::BLUE); -``` - -## Window-related functions - -- `void initWindow(int width, int height, const std::string &title);` - Initialize the game window with the specified width, height, and title. - -- `bool windowShouldClose();` - Check if the window should close (user pressed close button or escape key). - -- `void closeWindow();` - Close the game window. - -- `bool isWindowReady();` - Check if the window has been initialized successfully. - -- `bool isWindowFullscreen();` - Check if the window is in fullscreen mode. - -- `bool isWindowHidden();` - Check if the window is currently hidden. - -- `bool isWindowMinimized();` - Check if the window is currently minimized. - -- `bool isWindowMaximized();` - Check if the window is currently maximized. - -- `bool isWindowFocused();` - Check if the window is currently focused. - -- `void setConfigFlags(ConfigFlags flags);` - Set configuration flags for the window. - -- `bool isWindowResized();` - Check if the window has been resized. - -- `bool isWindowState(ConfigFlags flag);` - Check if a specific window state flag is set. - -- `void setWindowState(ConfigFlags flag);` - Set a specific window state flag. - -- `void clearWindowState(ConfigFlags flags);` - Clear specific window state flags. - -- `void toggleFullscreen();` - Toggle fullscreen mode. - -- `void maximizeWindow();` - Maximize the window. - -- `void minimizeWindow();` - Minimize the window. - -- `void setWindowTitle(const std::string &title);` - Set the title of the window. - -- `int getScreenWidth();` - Get the current screen width. - -- `int getScreenHeight();` - Get the current screen height. - -- `int getRenderWidth();` - Get the current rendering width - -- `int getRenderHeight();` - Get the current rendering height - -- `int getMonitorWidth(int monitor);` - Get the width of the specified monitor. - -- `int getMonitorHeight(int monitor);` - Get the height of the specified monitor. - -- `int getMonitorRefreshRate(int monitor);` - Get the refresh rate of the specified monitor. - -- `int getCurrentMonitor();` - Get the index of the current monitor. - -- `void setClipboardText(const std::string &text);` - Set the text to be copied to the clipboard. - -- `std::string getClipboardText();` - Get the text currently copied to the clipboard. - -- `void setWindowIcon(Image image);` - Set the window icon. - -## Cursor-related functions - -- `void showCursor();` - Show the cursor. - -- `void hideCursor();` - Hide the cursor. - -- `bool isCursorHidden();` - Check if the cursor is currently hidden. - -- `void enableCursor();` - Enable cursor (unlock it). - -- `void disableCursor();` - Disable cursor (lock it). - -- `bool isCursorOnScreen();` - Check if the cursor is within the game window. - -## Drawing-related functions - -- `void clearBackground(Raylib::Color color);` - Clear the background with a specified color. - -- `void beginDrawing();` - Begin drawing. - -- `void endDrawing();` - End drawing and swap buffers. - -## Timing-related functions - -- `void setTargetFPS(int fps);` - Set the target frames-per-second. - -- `int getFPS();` - Get the current frames-per-second. - -- `float getFrameTime();` - Get the time in seconds for a frame. - -- `double getTime();` - Get the current time in seconds. - -## Misc. functions - -- `void takeScreenshot(const std::string &fileName);` - Take a screenshot and save it to a file with the specified name. - -## Shapes-related functions - -- `void drawPixel(int posX, int posY, Raylib::Color color);` - Draw a pixel at the specified position with the given color. - -- `void drawCircle(int centerX, int centerY, float radius, Raylib::Color color);` - Draw a circle with the specified center, radius, and color. - -- `void drawRectangle(int posX, int posY, int width, int height, Raylib::Color color);` - Draw a rectangle at the specified position with the given width, height, and color. - -## Color/pixel related functions - -- `Raylib::Color fade(Raylib::Color color, float alpha);` - Fade a color by a specified alpha value. - -- `int colorToInt(Raylib::Color color);` - Convert a Color to a 32-bit integer. - -- `Vector4 colorNormalize(Raylib::Color color);` - Normalize a Color struct to a Vector4. - -- `Raylib::Color colorFromNormalized(Vector4 normalized);` - Create a Color from a normalized Vector4. - -- `Raylib::Color getColor(unsigned int hexValue);` - Create a Color from a hex value. - -## Enum ConfigFlags - -You can use the following flags to configure the window: - -- `FLAG_FULLSCREEN_MODE`: Set fullscreen mode. -- `FLAG_WINDOW_RESIZABLE`: Allow the window to be resized. -- `FLAG_WINDOW_UNDECORATED`: Disable window decoration (frame and buttons). -- `FLAG_WINDOW_TRANSPARENT`: Allow the window to be transparent. -- `FLAG_WINDOW_HIDDEN`: Hide the window. -- `FLAG_WINDOW_MINIMIZED`: Minimize the window. -- `FLAG_WINDOW_MAXIMIZED`: Maximize the window. -- `FLAG_WINDOW_UNFOCUSED`: Disable window focus. -- `FLAG_WINDOW_TOPMOST`: Set the window to be always on top. -- `FLAG_WINDOW_HIGHDPI`: Enable high-DPI mode. -- `FLAG_WINDOW_ALWAYS_RUN`: Allow the window to run in the background. -- `FLAG_MSAA_4X_HINT`: Enable 4x MSAA. -- `FLAG_VSYNC_HINT`: Enable V-Sync. diff --git a/docs/developer-guide/client/graphic/colors-pixels.md b/docs/developer-guide/client/graphic/colors-pixels.md new file mode 100644 index 00000000..30d8d823 --- /dev/null +++ b/docs/developer-guide/client/graphic/colors-pixels.md @@ -0,0 +1,16 @@ +## Colors/pixels related functions + +- `Raylib::Color Raylib::fade(Raylib::Color color, float alpha);` + Fade a color by a specified alpha value. + +- `int Raylib::colorToInt(Raylib::Color color);` + Convert a Color to a 32-bit integer. + +- `Vector4 Raylib::colorNormalize(Raylib::Color color);` + Normalize a Color struct to a Vector4. + +- `Raylib::Color Raylib::colorFromNormalized(Vector4 normalized);` + Create a Color from a normalized Vector4. + +- `Raylib::Color Raylib::getColor(unsigned int hexValue);` + Create a Color from a hex value. diff --git a/docs/developer-guide/client/graphic/configFlag.md b/docs/developer-guide/client/graphic/configFlag.md new file mode 100644 index 00000000..5a9cb7a3 --- /dev/null +++ b/docs/developer-guide/client/graphic/configFlag.md @@ -0,0 +1,23 @@ +## Enum ConfigFlags + +You can use the following flags to configure the window: + +- `Raylib::ConfigFlags::ConfigFlags::FLAG_FULLSCREEN_MODE`: Set fullscreen mode. +- `Raylib::ConfigFlags::FLAG_WINDOW_RESIZABLE`: Allow the window to be resized. +- `Raylib::ConfigFlags::FLAG_WINDOW_UNDECORATED`: Disable window decoration (frame and buttons). +- `Raylib::ConfigFlags::FLAG_WINDOW_TRANSPARENT`: Allow the window to be transparent. +- `Raylib::ConfigFlags::FLAG_WINDOW_HIDDEN`: Hide the window. +- `Raylib::ConfigFlags::FLAG_WINDOW_MINIMIZED`: Minimize the window. +- `Raylib::ConfigFlags::FLAG_WINDOW_MAXIMIZED`: Maximize the window. +- `Raylib::ConfigFlags::FLAG_WINDOW_UNFOCUSED`: Disable window focus. +- `Raylib::ConfigFlags::FLAG_WINDOW_TOPMOST`: Set the window to be always on top. +- `Raylib::ConfigFlags::FLAG_WINDOW_HIGHDPI`: Enable high-DPI mode. +- `Raylib::ConfigFlags::FLAG_WINDOW_ALWAYS_RUN`: Allow the window to run in the background. +- `Raylib::ConfigFlags::FLAG_MSAA_4X_HINT`: Enable 4x MSAA. +- `Raylib::ConfigFlags::FLAG_VSYNC_HINT`: Enable V-Sync. + +## Example + +```cpp +Raylib::setWindowState(Raylib::ConfigFlags::WINDOW_RESIZABLE); +``` diff --git a/docs/developer-guide/client/graphic/cursor.md b/docs/developer-guide/client/graphic/cursor.md new file mode 100644 index 00000000..12799dd2 --- /dev/null +++ b/docs/developer-guide/client/graphic/cursor.md @@ -0,0 +1,19 @@ +## Cursor-related functions + +- `void Raylib::showCursor();` + Show the cursor. + +- `void Raylib::hideCursor();` + Hide the cursor. + +- `bool Raylib::isCursorHidden();` + Check if the cursor is currently hidden. + +- `void Raylib::enableCursor();` + Enable cursor (unlock it). + +- `void Raylib::disableCursor();` + Disable cursor (lock it). + +- `bool Raylib::isCursorOnScreen();` + Check if the cursor is within the game window. diff --git a/docs/developer-guide/client/graphic/drawing.md b/docs/developer-guide/client/graphic/drawing.md new file mode 100644 index 00000000..04c67631 --- /dev/null +++ b/docs/developer-guide/client/graphic/drawing.md @@ -0,0 +1,10 @@ +## Drawing-related functions + +- `void Raylib::clearBackground(Raylib::Color color);` + Clear the background with a specified color. + +- `void Raylib::beginDrawing();` + Begin drawing. + +- `void Raylib::endDrawing();` + End drawing and swap buffers. diff --git a/docs/developer-guide/client/graphic/frameRate.md b/docs/developer-guide/client/graphic/frameRate.md new file mode 100644 index 00000000..c0227142 --- /dev/null +++ b/docs/developer-guide/client/graphic/frameRate.md @@ -0,0 +1,13 @@ +## Timing-related functions + +- `void Raylib::setTargetFPS(int fps);` + Set the target frames-per-second. + +- `int Raylib::getFPS();` + Get the current frames-per-second. + +- `float Raylib::getFrameTime();` + Get the time in seconds for a frame. + +- `double Raylib::getTime();` + Get the current time in seconds. diff --git a/docs/developer-guide/client/graphic/image.md b/docs/developer-guide/client/graphic/image.md new file mode 100644 index 00000000..0ce51908 --- /dev/null +++ b/docs/developer-guide/client/graphic/image.md @@ -0,0 +1,30 @@ +## Image Class + +### Constructors + +```cpp +Raylib::Image(const std::string& fileName); +Raylib::Image(int width, int height, Raylib::Color color); +``` +Create an image object from the specified file or create a blank image with the given width, height, and color. + +### Methods + +```cpp +bool Raylib::Image::isImageReady() const; +void Raylib::Image::unloadImage(); +int Raylib::Image::getWidth() const; +int Raylib::Image::getHeight() const; +int Raylib::Image::getMipmaps() const; +int Raylib::Image::getFormat() const; +void* Raylib::Image::getData() const; +``` + +### Example usage + +```cpp +Raylib::Image myImage("path/to/imagefile.png"); +int width = myImage.getWidth(); +std::cout << "Image width: " << width << std::endl; +myImage.unloadImage(); +``` diff --git a/docs/developer-guide/client/graphic/misc.md b/docs/developer-guide/client/graphic/misc.md new file mode 100644 index 00000000..0702ff41 --- /dev/null +++ b/docs/developer-guide/client/graphic/misc.md @@ -0,0 +1,4 @@ +## Misc. functions + +- `void Raylib::takeScreenshot(const std::string &fileName);` + Take a screenshot and save it to a file with the specified name. diff --git a/docs/developer-guide/client/graphic/shapes.md b/docs/developer-guide/client/graphic/shapes.md new file mode 100644 index 00000000..56d48358 --- /dev/null +++ b/docs/developer-guide/client/graphic/shapes.md @@ -0,0 +1,18 @@ +## Shapes-related functions + +- `void Raylib::drawPixel(int posX, int posY, Raylib::Color color);` + Draw a pixel at the specified position with the given color. + +- `void Raylib::drawCircle(int centerX, int centerY, float radius, Raylib::Color color);` + Draw a circle with the specified center, radius, and color. + +- `void Raylib::drawRectangle(int posX, int posY, int width, int height, Raylib::Color color);` + Draw a rectangle at the specified position with the given width, height, and color. + +### Example usage + +```cpp +Raylib::drawPixel(100, 100, Raylib::RED); +Raylib::drawCircle(200, 200, 50, Raylib::GREEN); +Raylib::drawRectangle(300, 300, 80, 120, Raylib::BLUE); +``` diff --git a/docs/developer-guide/client/graphic/sprite.md b/docs/developer-guide/client/graphic/sprite.md new file mode 100644 index 00000000..3f78965e --- /dev/null +++ b/docs/developer-guide/client/graphic/sprite.md @@ -0,0 +1,32 @@ +## Sprite Class + +### Constructors + +```cpp +Raylib::Sprite(const std::string &fileName, float width, float height); +Raylib::Sprite(Image image, float width, float height); +``` + +Create a sprite object from the specified file and set its width and height or create a sprite from an image object with the given width and height. The width and height are in percentage of the screen. + +### Methods + +```cpp +unsigned int Raylib::Sprite::getId() const; +float Raylib::Sprite::getWidth() const; +float Raylib::Sprite::getHeight() const; +int Raylib::Sprite::getTextureWidth() const; +int Raylib::Sprite::getTextureHeight() const; +int Raylib::Sprite::getMipmaps() const; +int Raylib::Sprite::getFormat() const; +void Raylib::Sprite::unloadSprite(); +``` + +### Example usage + +```cpp +Raylib::Sprite mySprite("path/to/spritefile.png", 100.0f, 150.0f); +float spriteWidth = mySprite.getWidth(); +std::cout << "Sprite width: " << spriteWidth << std::endl; +mySprite.unloadSprite(); +``` diff --git a/docs/developer-guide/client/graphic/text.md b/docs/developer-guide/client/graphic/text.md new file mode 100644 index 00000000..01f87da2 --- /dev/null +++ b/docs/developer-guide/client/graphic/text.md @@ -0,0 +1,39 @@ +## Text Class + +### Constructors + +```cpp +Raylib::Text( + std::string text, + Raylib::Vector2 position = {0, 0}, + float fontSize = 5.0f, + Raylib::Color color = Raylib::BLACK); +``` + +Create a text object with the given text, position, font size, and color. + +### Methods + +```cpp +void Raylib::Textdraw(); +void Raylib::TextdrawEx(float spacing); +void Raylib::TextdrawPro(Raylib::Vector2 origin, float rotation, float spacing); + +float Raylib::Text::x() const; +float Raylib::Text::y() const; +float Raylib::Text::getFontSize() const; +void Raylib::Text::setFontSize(float fontSize); +Raylib::Vector2 Raylib::Text::getPosition() const; +void Raylib::Text::setPixelPosition(Raylib::Vector2 position); +void Raylib::Text::setCurrentFontSize(float fontSize); +``` + +getPosition is in percentage of the screen size. For each draw, we recommand to compute and set the position in pixel with setPixelPosition to have a responsive text. + +### Example usage + +```cpp +Raylib::Text myText("Hello, World!", {100, 200}, 20.0f, Raylib::BLUE); +myText.setPixelPosition({300, 400}); +myText.draw(); +``` diff --git a/docs/developer-guide/client/graphic/window.md b/docs/developer-guide/client/graphic/window.md new file mode 100644 index 00000000..730ae022 --- /dev/null +++ b/docs/developer-guide/client/graphic/window.md @@ -0,0 +1,88 @@ +## Window-related functions + +- `void Raylib::initWindow(int width, int height, const std::string &title);` + Initialize the game window with the specified width, height, and title. + +- `bool Raylib::windowShouldClose();` + Check if the window should close (user pressed close button or escape key). + +- `void Raylib::closeWindow();` + Close the game window. + +- `bool Raylib::isWindowReady();` + Check if the window has been initialized successfully. + +- `bool Raylib::isWindowFullscreen();` + Check if the window is in fullscreen mode. + +- `bool Raylib::isWindowHidden();` + Check if the window is currently hidden. + +- `bool Raylib::isWindowMinimized();` + Check if the window is currently minimized. + +- `bool Raylib::isWindowMaximized();` + Check if the window is currently maximized. + +- `bool Raylib::isWindowFocused();` + Check if the window is currently focused. + +- `void Raylib::setConfigFlags(ConfigFlags flags);` + Set configuration flags for the window. + +- `bool Raylib::isWindowResized();` + Check if the window has been resized. + +- `bool Raylib::isWindowState(ConfigFlags flag);` + Check if a specific window state flag is set. + +- `void Raylib::setWindowState(ConfigFlags flag);` + Set a specific window state flag. + +- `void Raylib::clearWindowState(ConfigFlags flags);` + Clear specific window state flags. + +- `void Raylib::toggleFullscreen();` + Toggle fullscreen mode. + +- `void Raylib::maximizeWindow();` + Maximize the window. + +- `void Raylib::minimizeWindow();` + Minimize the window. + +- `void Raylib::setWindowTitle(const std::string &title);` + Set the title of the window. + +- `int Raylib::getScreenWidth();` + Get the current screen width. + +- `int Raylib::getScreenHeight();` + Get the current screen height. + +- `int Raylib::getRenderWidth();` + Get the current rendering width + +- `int Raylib::getRenderHeight();` + Get the current rendering height + +- `int Raylib::getMonitorWidth(int monitor);` + Get the width of the specified monitor. + +- `int Raylib::getMonitorHeight(int monitor);` + Get the height of the specified monitor. + +- `int Raylib::getMonitorRefreshRate(int monitor);` + Get the refresh rate of the specified monitor. + +- `int Raylib::getCurrentMonitor();` + Get the index of the current monitor. + +- `void Raylib::setClipboardText(const std::string &text);` + Set the text to be copied to the clipboard. + +- `std::string Raylib::getClipboardText();` + Get the text currently copied to the clipboard. + +- `void Raylib::setWindowIcon(Image image);` + Set the window icon. From 44020fe50f9af739368564008fd482fdb49fa06d Mon Sep 17 00:00:00 2001 From: tenshi Date: Mon, 2 Oct 2023 15:19:23 +0200 Subject: [PATCH 3/5] DOCUMENTATION: Fix merge request PATCH --- docs/SUMMARY.md | 26 +++++++++++++++ docs/developer-guide/client/audio/README.md | 32 ++++++++++++++++++- .../{audio-settings.md => audioSettings.md} | 0 .../client/audio/device-management.md | 29 ----------------- .../{audio-file-formats.md => fileFormats.md} | 0 docs/developer-guide/client/audio/music.md | 32 +++++++++---------- .../developer-guide/client/geometry/README.md | 1 + docs/developer-guide/client/graphic/README.md | 1 + .../{colors-pixels.md => colorsPixels.md} | 0 .../graphic/{configFlag.md => configFlags.md} | 0 10 files changed, 75 insertions(+), 46 deletions(-) rename docs/developer-guide/client/audio/{audio-settings.md => audioSettings.md} (100%) delete mode 100644 docs/developer-guide/client/audio/device-management.md rename docs/developer-guide/client/audio/{audio-file-formats.md => fileFormats.md} (100%) rename docs/developer-guide/client/graphic/{colors-pixels.md => colorsPixels.md} (100%) rename docs/developer-guide/client/graphic/{configFlag.md => configFlags.md} (100%) diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index f07b60c1..6c60bc1a 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -38,9 +38,35 @@ - [Client](developer-guide/client/README.md) - [Audio](developer-guide/client/audio/README.md) + - [Audio settings](developer-guide/client/audio/audioSettings.md) + - [Audio file formats](developer-guide/client/audio/fileFormats.md) + - [Music](developer-guide/client/audio/music.md) + - [Sounds](developer-guide/client/audio/sounds.md) + - [Events](developer-guide/client/events/README.md) + - [keyboard](developer-guide/client/events/keyboard.md) + - [Mouse](developer-guide/client/events/mouse.md) + - [Geometry](developer-guide/client/geometry/README.md) + - [Color](developer-guide/client/geometry/color.md) + - [Constant](developer-guide/client/geometry/constant.md) + - [Rectangle](developer-guide/client/geometry/rectangle.md) + - [Vector2](developer-guide/client/geometry/vector2.md) + - [Vector3](developer-guide/client/geometry/vector3.md) + - [Vector4](developer-guide/client/geometry/vector4.md) + - [Graphic](developer-guide/client/graphic/README.md) + - [Colors pixels](developer-guide/client/graphic/colorsPixels.md) + - [Config flags](developer-guide/client/graphic/configFlags.md) + - [Cursor](developer-guide/client/graphic/cursor.md) + - [Drawing](developer-guide/client/graphic/drawing.md) + - [Frame rate](developer-guide/client/graphic/frameRate.md) + - [Image](developer-guide/client/graphic/image.md) + - [Misc](developer-guide/client/graphic/misc.md) + - [Shapes](developer-guide/client/graphic/shapes.md) + - [Sprite](developer-guide/client/graphic/sprite.md) + - [Text](developer-guide/client/graphic/text.md) + - [Window](developer-guide/client/graphic/window.md) ----------- diff --git a/docs/developer-guide/client/audio/README.md b/docs/developer-guide/client/audio/README.md index 4a0415c7..e4971680 100644 --- a/docs/developer-guide/client/audio/README.md +++ b/docs/developer-guide/client/audio/README.md @@ -1,3 +1,33 @@ # Using Audio in our game client -In your C++ client application, you can manage audio using the Raylib library. This guide explains how to work with sounds and music using our Raylib wrapper classes. +In your C++ client application, you can manage audio using the Raylib library. This guide explains how to work with sounds and music using our Raylib wrapper classes. Before looking at the other pages, we advise you to look at the rest of this page. Initialize the audio correctly is essential to use it in our client. + +## Audio Device Management + +### Functions + +```cpp +void Raylib::initAudioDevice(); +void Raylib::closeAudioDevice(); +bool Raylib::isAudioDeviceReady(); +void Raylib::setMasterVolume(float volume); +``` + +## Example usage + +You need to initialize the audio device before using any audio functions. You can do this by calling the initAudioDevice() function. You can then use the other functions to manage the audio device. If you want to player music, every frame you need to call the UpdateMusicStream() function. + +```cpp +int main() { + Raylib::Music music("path/to/musicfile.ogg"); + + Raylib::initAudioDevice(); + // game loop + while (!Raylib::WindowShouldClose()) { + // stuff + //for every music + Raylib::UpdateMusicStream(music); + } + Raylib::closeAudioDevice(); +} +``` diff --git a/docs/developer-guide/client/audio/audio-settings.md b/docs/developer-guide/client/audio/audioSettings.md similarity index 100% rename from docs/developer-guide/client/audio/audio-settings.md rename to docs/developer-guide/client/audio/audioSettings.md diff --git a/docs/developer-guide/client/audio/device-management.md b/docs/developer-guide/client/audio/device-management.md deleted file mode 100644 index b69f2234..00000000 --- a/docs/developer-guide/client/audio/device-management.md +++ /dev/null @@ -1,29 +0,0 @@ -## Audio Device Management - -### Functions - -```cpp -void initAudioDevice(); -void closeAudioDevice(); -bool isAudioDeviceReady(); -void setMasterVolume(float volume); -``` - -## Example usage - -You need to initialize the audio device before using any audio functions. You can do this by calling the initAudioDevice() function. You can then use the other functions to manage the audio device. If you want to player music, every frame you need to call the UpdateMusicStream() function. - -```cpp -int main() { - Raylib::Music music("path/to/musicfile.ogg"); - - initAudioDevice(); - // game loop - while (!WindowShouldClose()) { - // stuff - //for every music - UpdateMusicStream(music); - } - closeAudioDevice(); -} -``` diff --git a/docs/developer-guide/client/audio/audio-file-formats.md b/docs/developer-guide/client/audio/fileFormats.md similarity index 100% rename from docs/developer-guide/client/audio/audio-file-formats.md rename to docs/developer-guide/client/audio/fileFormats.md diff --git a/docs/developer-guide/client/audio/music.md b/docs/developer-guide/client/audio/music.md index 23442106..2c145e96 100644 --- a/docs/developer-guide/client/audio/music.md +++ b/docs/developer-guide/client/audio/music.md @@ -11,22 +11,22 @@ Create a music object from the specified audio file. ### Methods ```cpp -void unload(); -bool isReady() const; -void play() const; -bool isPlaying() const; -void update() const; -void stop() const; -void pause() const; -void resume() const; -void setVolume(float volume) const; -void setPitch(float pitch) const; -void setPan(float pan) const; -float getTimeLength() const; -float getTimePlayed() const; -bool NeedToPlay() const; -void setNeedToPlay(bool needToPlay); -std::string getPath() const; +void Raylib::Music::unload(); +bool Raylib::Music::isReady() const; +void Raylib::Music::play() const; +bool Raylib::Music::isPlaying() const; +void Raylib::Music::update() const; +void Raylib::Music::stop() const; +void Raylib::Music::pause() const; +void Raylib::Music::resume() const; +void Raylib::Music::setVolume(float volume) const; +void Raylib::Music::setPitch(float pitch) const; +void Raylib::Music::setPan(float pan) const; +float Raylib::Music::getTimeLength() const; +float Raylib::Music::getTimePlayed() const; +bool Raylib::Music::NeedToPlay() const; +void Raylib::Music::setNeedToPlay(bool needToPlay); +std::string Raylib::Music::getPath() const; ``` ### Example usage diff --git a/docs/developer-guide/client/geometry/README.md b/docs/developer-guide/client/geometry/README.md index acd81423..491b313e 100644 --- a/docs/developer-guide/client/geometry/README.md +++ b/docs/developer-guide/client/geometry/README.md @@ -1 +1,2 @@ # Geometry and Color guide + diff --git a/docs/developer-guide/client/graphic/README.md b/docs/developer-guide/client/graphic/README.md index aa17186b..e12fad00 100644 --- a/docs/developer-guide/client/graphic/README.md +++ b/docs/developer-guide/client/graphic/README.md @@ -1,3 +1,4 @@ # Using Graphics in our game client This guide explains how to work in your game client with images, sprites, text, ... using our Raylib wrapper classes. +Please refer to the other pages for more information. diff --git a/docs/developer-guide/client/graphic/colors-pixels.md b/docs/developer-guide/client/graphic/colorsPixels.md similarity index 100% rename from docs/developer-guide/client/graphic/colors-pixels.md rename to docs/developer-guide/client/graphic/colorsPixels.md diff --git a/docs/developer-guide/client/graphic/configFlag.md b/docs/developer-guide/client/graphic/configFlags.md similarity index 100% rename from docs/developer-guide/client/graphic/configFlag.md rename to docs/developer-guide/client/graphic/configFlags.md From f99115ed660c07255a059dcf68fbf97dec495dcf Mon Sep 17 00:00:00 2001 From: tenshi Date: Mon, 2 Oct 2023 15:21:28 +0200 Subject: [PATCH 4/5] DOCUMENTATION: Remove chapter index PATCH --- docs/SUMMARY.md | 6 +++--- docs/developer-guide/client/events/README.md | 3 --- docs/developer-guide/client/geometry/README.md | 2 -- docs/developer-guide/client/graphic/README.md | 4 ---- 4 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 docs/developer-guide/client/events/README.md delete mode 100644 docs/developer-guide/client/geometry/README.md delete mode 100644 docs/developer-guide/client/graphic/README.md diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 6c60bc1a..2c3ec608 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -43,11 +43,11 @@ - [Music](developer-guide/client/audio/music.md) - [Sounds](developer-guide/client/audio/sounds.md) - - [Events](developer-guide/client/events/README.md) + - [Events]() - [keyboard](developer-guide/client/events/keyboard.md) - [Mouse](developer-guide/client/events/mouse.md) - - [Geometry](developer-guide/client/geometry/README.md) + - [Geometry]() - [Color](developer-guide/client/geometry/color.md) - [Constant](developer-guide/client/geometry/constant.md) - [Rectangle](developer-guide/client/geometry/rectangle.md) @@ -55,7 +55,7 @@ - [Vector3](developer-guide/client/geometry/vector3.md) - [Vector4](developer-guide/client/geometry/vector4.md) - - [Graphic](developer-guide/client/graphic/README.md) + - [Graphic]() - [Colors pixels](developer-guide/client/graphic/colorsPixels.md) - [Config flags](developer-guide/client/graphic/configFlags.md) - [Cursor](developer-guide/client/graphic/cursor.md) diff --git a/docs/developer-guide/client/events/README.md b/docs/developer-guide/client/events/README.md deleted file mode 100644 index 2f954901..00000000 --- a/docs/developer-guide/client/events/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Input Handling - -In your game client, we use and enum to represent keyboard and mouse keys. The enum is defined in `inputs.hpp` and is called `KeyboardKey` and `MouseButton`. The enum values are the same as the ones defined in `raylib.h`. diff --git a/docs/developer-guide/client/geometry/README.md b/docs/developer-guide/client/geometry/README.md deleted file mode 100644 index 491b313e..00000000 --- a/docs/developer-guide/client/geometry/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# Geometry and Color guide - diff --git a/docs/developer-guide/client/graphic/README.md b/docs/developer-guide/client/graphic/README.md deleted file mode 100644 index e12fad00..00000000 --- a/docs/developer-guide/client/graphic/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Using Graphics in our game client - -This guide explains how to work in your game client with images, sprites, text, ... using our Raylib wrapper classes. -Please refer to the other pages for more information. From db7471c13e9043d26cfc9be4d4a2ac9a5e326235 Mon Sep 17 00:00:00 2001 From: Tenshi Date: Mon, 2 Oct 2023 18:30:32 +0200 Subject: [PATCH 5/5] DOCUMENTATION: Fix merge request PATCH --- docs/SUMMARY.md | 1 - .../developer-guide/client/events/keyboard.md | 10 +++---- docs/developer-guide/client/events/mouse.md | 8 +++--- docs/developer-guide/client/geometry/color.md | 27 +++++++++++++++++++ .../client/geometry/constant.md | 26 ------------------ .../client/geometry/vector2.md | 2 +- .../client/graphic/colorsPixels.md | 2 +- .../client/graphic/configFlags.md | 1 + 8 files changed, 39 insertions(+), 38 deletions(-) delete mode 100644 docs/developer-guide/client/geometry/constant.md diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 2c3ec608..971e3405 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -49,7 +49,6 @@ - [Geometry]() - [Color](developer-guide/client/geometry/color.md) - - [Constant](developer-guide/client/geometry/constant.md) - [Rectangle](developer-guide/client/geometry/rectangle.md) - [Vector2](developer-guide/client/geometry/vector2.md) - [Vector3](developer-guide/client/geometry/vector3.md) diff --git a/docs/developer-guide/client/events/keyboard.md b/docs/developer-guide/client/events/keyboard.md index eb2f5412..8ef125ab 100644 --- a/docs/developer-guide/client/events/keyboard.md +++ b/docs/developer-guide/client/events/keyboard.md @@ -1,18 +1,18 @@ ## Input-related functions: keyboard -- `bool Raylib::isKeyPressed(KeyboardKey key);` +- `bool Raylib::isKeyPressed(Raylib::KeyboardKey key);` Check if a key has been pressed once. -- `bool Raylib::isKeyDown(KeyboardKey key);` +- `bool Raylib::isKeyDown(Raylib::KeyboardKey key);` Check if a key is being pressed. -- `bool Raylib::isKeyReleased(KeyboardKey key);` +- `bool Raylib::isKeyReleased(Raylib::KeyboardKey key);` Check if a key has been released once. -- `bool Raylib::isKeyUp(KeyboardKey key);` +- `bool Raylib::isKeyUp(Raylib::KeyboardKey key);` Check if a key is NOT being pressed. -- `void Raylib::setExitKey(KeyboardKey key);` +- `void Raylib::setExitKey(Raylib::KeyboardKey key);` Set a key to exit the application. - `int Raylib::getKeyPressed();` diff --git a/docs/developer-guide/client/events/mouse.md b/docs/developer-guide/client/events/mouse.md index aea0880b..cfc69b0b 100644 --- a/docs/developer-guide/client/events/mouse.md +++ b/docs/developer-guide/client/events/mouse.md @@ -1,15 +1,15 @@ ## Input-related functions: mouse -- `bool Raylib::isMouseButtonPressed(MouseButton button);` +- `bool Raylib::isMouseButtonPressed(Raylib::MouseButton button);` Check if a mouse button has been pressed once. -- `bool Raylib::isMouseButtonDown(MouseButton button);` +- `bool Raylib::isMouseButtonDown(Raylib::MouseButton button);` Check if a mouse button is being pressed. -- `bool Raylib::isMouseButtonReleased(MouseButton button);` +- `bool Raylib::isMouseButtonReleased(Raylib::MouseButton button);` Check if a mouse button has been released once. -- `bool Raylib::isMouseButtonUp(MouseButton button);` +- `bool Raylib::isMouseButtonUp(Raylib::MouseButton button);` Check if a mouse button is NOT being pressed. - `int Raylib::getMouseX();` diff --git a/docs/developer-guide/client/geometry/color.md b/docs/developer-guide/client/geometry/color.md index f9b9e4f1..9a56e98a 100644 --- a/docs/developer-guide/client/geometry/color.md +++ b/docs/developer-guide/client/geometry/color.md @@ -4,3 +4,30 @@ Represents a color. - `Raylib::Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a);` Constructor to create a color with specified `r` (red), `g` (green), `b` (blue), and `a` (alpha) values. + +### Color Constants + +- `Raylib::DarkGray` +- `Raylib::Yellow` +- `Raylib::Gold` +- `Raylib::Orange` +- `Raylib::Pink` +- `Raylib::Red` +- `Raylib::Maroon` +- `Raylib::Green` +- `Raylib::Lime` +- `Raylib::DarkGreen` +- `Raylib::SkyBlue` +- `Raylib::Blue` +- `Raylib::DarkBlue` +- `Raylib::Purple` +- `Raylib::Violet` +- `Raylib::DarkPurple` +- `Raylib::Beige` +- `Raylib::Brown` +- `Raylib::DarkBrown` +- `Raylib::White` +- `Raylib::Black` +- `Raylib::Blank` +- `Raylib::Magenta` +- `Raylib::RayWhite` diff --git a/docs/developer-guide/client/geometry/constant.md b/docs/developer-guide/client/geometry/constant.md deleted file mode 100644 index f84e4ef5..00000000 --- a/docs/developer-guide/client/geometry/constant.md +++ /dev/null @@ -1,26 +0,0 @@ -### Color Constants - -- `Raylib::DarkGray` -- `Raylib::Yellow` -- `Raylib::Gold` -- `Raylib::Orange` -- `Raylib::Pink` -- `Raylib::Red` -- `Raylib::Maroon` -- `Raylib::Green` -- `Raylib::Lime` -- `Raylib::DarkGreen` -- `Raylib::SkyBlue` -- `Raylib::Blue` -- `Raylib::DarkBlue` -- `Raylib::Purple` -- `Raylib::Violet` -- `Raylib::DarkPurple` -- `Raylib::Beige` -- `Raylib::Brown` -- `Raylib::DarkBrown` -- `Raylib::White` -- `Raylib::Black` -- `Raylib::Blank` -- `Raylib::Magenta` -- `Raylib::RayWhite` diff --git a/docs/developer-guide/client/geometry/vector2.md b/docs/developer-guide/client/geometry/vector2.md index 069d193d..78460ab7 100644 --- a/docs/developer-guide/client/geometry/vector2.md +++ b/docs/developer-guide/client/geometry/vector2.md @@ -3,4 +3,4 @@ Represents a 2D vector. - `Raylib::Vector2(float x, float y);` - Constructor to create a 2D vector with specified `x` and `y` values. \ No newline at end of file + Constructor to create a 2D vector with specified `x` and `y` values. diff --git a/docs/developer-guide/client/graphic/colorsPixels.md b/docs/developer-guide/client/graphic/colorsPixels.md index 30d8d823..14ec8dd9 100644 --- a/docs/developer-guide/client/graphic/colorsPixels.md +++ b/docs/developer-guide/client/graphic/colorsPixels.md @@ -9,7 +9,7 @@ - `Vector4 Raylib::colorNormalize(Raylib::Color color);` Normalize a Color struct to a Vector4. -- `Raylib::Color Raylib::colorFromNormalized(Vector4 normalized);` +- `Raylib::Color Raylib::colorFromNormalized(Raylib::Vector4 normalized);` Create a Color from a normalized Vector4. - `Raylib::Color Raylib::getColor(unsigned int hexValue);` diff --git a/docs/developer-guide/client/graphic/configFlags.md b/docs/developer-guide/client/graphic/configFlags.md index 5a9cb7a3..8db9d6ea 100644 --- a/docs/developer-guide/client/graphic/configFlags.md +++ b/docs/developer-guide/client/graphic/configFlags.md @@ -20,4 +20,5 @@ You can use the following flags to configure the window: ```cpp Raylib::setWindowState(Raylib::ConfigFlags::WINDOW_RESIZABLE); +Raylib::setWindowState(Raylib::ConfigFlags::WINDOW_RESIZABLE | Raylib::ConfigFlags::FLAG_VSYNC_HINT); ```