Explicit define of functions prototypes
No-parameters functions use the prototype style FunctionName(void);
This commit is contained in:
parent
d2b98fbb5c
commit
c56ef738ed
22
src/audio.c
22
src/audio.c
@ -90,15 +90,15 @@ static Wave LoadOGG(char *fileName);
|
|||||||
static void UnloadWave(Wave wave);
|
static void UnloadWave(Wave wave);
|
||||||
|
|
||||||
static bool BufferMusicStream(ALuint buffer); // Fill music buffers with data
|
static bool BufferMusicStream(ALuint buffer); // Fill music buffers with data
|
||||||
static void EmptyMusicStream(); // Empty music buffers
|
static void EmptyMusicStream(void); // Empty music buffers
|
||||||
extern void UpdateMusicStream(); // Updates buffers (refill) for music streaming
|
extern void UpdateMusicStream(void); // Updates buffers (refill) for music streaming
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Definition - Audio Device initialization and Closing
|
// Module Functions Definition - Audio Device initialization and Closing
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Initialize audio device and context
|
// Initialize audio device and context
|
||||||
void InitAudioDevice()
|
void InitAudioDevice(void)
|
||||||
{
|
{
|
||||||
// Open and initialize a device with default settings
|
// Open and initialize a device with default settings
|
||||||
ALCdevice *device = alcOpenDevice(NULL);
|
ALCdevice *device = alcOpenDevice(NULL);
|
||||||
@ -125,7 +125,7 @@ void InitAudioDevice()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close the audio device for the current context, and destroys the context
|
// Close the audio device for the current context, and destroys the context
|
||||||
void CloseAudioDevice()
|
void CloseAudioDevice(void)
|
||||||
{
|
{
|
||||||
StopMusicStream(); // Stop music streaming and close current stream
|
StopMusicStream(); // Stop music streaming and close current stream
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ void PlayMusicStream(char *fileName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stop music playing (close stream)
|
// Stop music playing (close stream)
|
||||||
void StopMusicStream()
|
void StopMusicStream(void)
|
||||||
{
|
{
|
||||||
if (musicEnabled)
|
if (musicEnabled)
|
||||||
{
|
{
|
||||||
@ -504,14 +504,14 @@ void StopMusicStream()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pause music playing
|
// Pause music playing
|
||||||
void PauseMusicStream()
|
void PauseMusicStream(void)
|
||||||
{
|
{
|
||||||
// TODO: Record music is paused or check if music available!
|
// TODO: Record music is paused or check if music available!
|
||||||
alSourcePause(currentMusic.source);
|
alSourcePause(currentMusic.source);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if music is playing
|
// Check if music is playing
|
||||||
bool MusicIsPlaying()
|
bool MusicIsPlaying(void)
|
||||||
{
|
{
|
||||||
ALenum state;
|
ALenum state;
|
||||||
|
|
||||||
@ -527,7 +527,7 @@ void SetMusicVolume(float volume)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get current music time length (in seconds)
|
// Get current music time length (in seconds)
|
||||||
float GetMusicTimeLength()
|
float GetMusicTimeLength(void)
|
||||||
{
|
{
|
||||||
float totalSeconds = stb_vorbis_stream_length_in_seconds(currentMusic.stream);
|
float totalSeconds = stb_vorbis_stream_length_in_seconds(currentMusic.stream);
|
||||||
|
|
||||||
@ -535,7 +535,7 @@ float GetMusicTimeLength()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get current music time played (in seconds)
|
// Get current music time played (in seconds)
|
||||||
float GetMusicTimePlayed()
|
float GetMusicTimePlayed(void)
|
||||||
{
|
{
|
||||||
int totalSamples = stb_vorbis_stream_length_in_samples(currentMusic.stream) * currentMusic.channels;
|
int totalSamples = stb_vorbis_stream_length_in_samples(currentMusic.stream) * currentMusic.channels;
|
||||||
|
|
||||||
@ -589,7 +589,7 @@ static bool BufferMusicStream(ALuint buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Empty music buffers
|
// Empty music buffers
|
||||||
static void EmptyMusicStream()
|
static void EmptyMusicStream(void)
|
||||||
{
|
{
|
||||||
ALuint buffer = 0;
|
ALuint buffer = 0;
|
||||||
int queued = 0;
|
int queued = 0;
|
||||||
@ -605,7 +605,7 @@ static void EmptyMusicStream()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update (re-fill) music buffers if data already processed
|
// Update (re-fill) music buffers if data already processed
|
||||||
extern void UpdateMusicStream()
|
extern void UpdateMusicStream(void)
|
||||||
{
|
{
|
||||||
ALuint buffer = 0;
|
ALuint buffer = 0;
|
||||||
ALint processed = 0;
|
ALint processed = 0;
|
||||||
|
38
src/core.c
38
src/core.c
@ -91,10 +91,10 @@ static bool showLogo = false;
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Other Modules Functions Declaration (required by core)
|
// Other Modules Functions Declaration (required by core)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
extern void LoadDefaultFont(); // [Module: text] Loads default font on InitWindow()
|
extern void LoadDefaultFont(void); // [Module: text] Loads default font on InitWindow()
|
||||||
extern void UnloadDefaultFont(); // [Module: text] Unloads default font from GPU memory
|
extern void UnloadDefaultFont(void); // [Module: text] Unloads default font from GPU memory
|
||||||
|
|
||||||
extern void UpdateMusicStream(); // [Module: audio] Updates buffers for music streaming
|
extern void UpdateMusicStream(void); // [Module: audio] Updates buffers for music streaming
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Declaration
|
// Module specific Functions Declaration
|
||||||
@ -104,8 +104,8 @@ static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, i
|
|||||||
static void ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); // GLFW3 Srolling Callback, runs on mouse wheel
|
static void ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); // GLFW3 Srolling Callback, runs on mouse wheel
|
||||||
static void CursorEnterCallback(GLFWwindow* window, int enter); // GLFW3 Cursor Enter Callback, cursor enters client area
|
static void CursorEnterCallback(GLFWwindow* window, int enter); // GLFW3 Cursor Enter Callback, cursor enters client area
|
||||||
static void WindowSizeCallback(GLFWwindow* window, int width, int height); // GLFW3 WindowSize Callback, runs when window is resized
|
static void WindowSizeCallback(GLFWwindow* window, int width, int height); // GLFW3 WindowSize Callback, runs when window is resized
|
||||||
static void TakeScreenshot(); // Takes a screenshot and saves it in the same folder as executable
|
static void TakeScreenshot(void); // Takes a screenshot and saves it in the same folder as executable
|
||||||
static void LogoAnimation(); // Plays raylib logo appearing animation
|
static void LogoAnimation(void); // Plays raylib logo appearing animation
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Definition - Window and OpenGL Context Functions
|
// Module Functions Definition - Window and OpenGL Context Functions
|
||||||
@ -190,7 +190,7 @@ void InitWindowEx(int width, int height, const char* title, bool resizable, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close Window and Terminate Context
|
// Close Window and Terminate Context
|
||||||
void CloseWindow()
|
void CloseWindow(void)
|
||||||
{
|
{
|
||||||
UnloadDefaultFont();
|
UnloadDefaultFont();
|
||||||
|
|
||||||
@ -223,13 +223,13 @@ void SetExitKey(int key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Detect if KEY_ESCAPE pressed or Close icon pressed
|
// Detect if KEY_ESCAPE pressed or Close icon pressed
|
||||||
bool WindowShouldClose()
|
bool WindowShouldClose(void)
|
||||||
{
|
{
|
||||||
return (glfwWindowShouldClose(window));
|
return (glfwWindowShouldClose(window));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fullscreen toggle (by default F11)
|
// Fullscreen toggle (by default F11)
|
||||||
void ToggleFullscreen()
|
void ToggleFullscreen(void)
|
||||||
{
|
{
|
||||||
if (glfwGetKey(window, GLFW_KEY_F11))
|
if (glfwGetKey(window, GLFW_KEY_F11))
|
||||||
{
|
{
|
||||||
@ -283,7 +283,7 @@ void ClearBackground(Color color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup drawing canvas to start drawing
|
// Setup drawing canvas to start drawing
|
||||||
void BeginDrawing()
|
void BeginDrawing(void)
|
||||||
{
|
{
|
||||||
currentTime = glfwGetTime(); // glfwGetTime() returns a 'double' containing the number of elapsed seconds since glfwInit() was called
|
currentTime = glfwGetTime(); // glfwGetTime() returns a 'double' containing the number of elapsed seconds since glfwInit() was called
|
||||||
updateTime = currentTime - previousTime;
|
updateTime = currentTime - previousTime;
|
||||||
@ -300,7 +300,7 @@ void BeginDrawing()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// End canvas drawing and Swap Buffers (Double Buffering)
|
// End canvas drawing and Swap Buffers (Double Buffering)
|
||||||
void EndDrawing()
|
void EndDrawing(void)
|
||||||
{
|
{
|
||||||
if (customCursor && cursorOnScreen) DrawTexture(cursor, GetMouseX(), GetMouseY(), WHITE);
|
if (customCursor && cursorOnScreen) DrawTexture(cursor, GetMouseX(), GetMouseY(), WHITE);
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ void Begin3dMode(Camera camera)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ends 3D mode and returns to default 2D orthographic mode
|
// Ends 3D mode and returns to default 2D orthographic mode
|
||||||
void End3dMode()
|
void End3dMode(void)
|
||||||
{
|
{
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
||||||
@ -389,13 +389,13 @@ void SetTargetFPS(int fps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns current FPS
|
// Returns current FPS
|
||||||
float GetFPS()
|
float GetFPS(void)
|
||||||
{
|
{
|
||||||
return (1/(float)frameTime);
|
return (1/(float)frameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns time in seconds for one frame
|
// Returns time in seconds for one frame
|
||||||
float GetFrameTime()
|
float GetFrameTime(void)
|
||||||
{
|
{
|
||||||
// As we are operating quite a lot with frameTime, it could be no stable
|
// As we are operating quite a lot with frameTime, it could be no stable
|
||||||
// so we round it before before passing around to be used
|
// so we round it before before passing around to be used
|
||||||
@ -447,7 +447,7 @@ Color Fade(Color color, float alpha)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Activates raylib logo at startup
|
// Activates raylib logo at startup
|
||||||
void ShowLogo()
|
void ShowLogo(void)
|
||||||
{
|
{
|
||||||
showLogo = true;
|
showLogo = true;
|
||||||
}
|
}
|
||||||
@ -553,7 +553,7 @@ bool IsMouseButtonUp(int button)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns mouse position X
|
// Returns mouse position X
|
||||||
int GetMouseX()
|
int GetMouseX(void)
|
||||||
{
|
{
|
||||||
double mouseX;
|
double mouseX;
|
||||||
double mouseY;
|
double mouseY;
|
||||||
@ -564,7 +564,7 @@ int GetMouseX()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns mouse position Y
|
// Returns mouse position Y
|
||||||
int GetMouseY()
|
int GetMouseY(void)
|
||||||
{
|
{
|
||||||
double mouseX;
|
double mouseX;
|
||||||
double mouseY;
|
double mouseY;
|
||||||
@ -575,7 +575,7 @@ int GetMouseY()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns mouse position XY
|
// Returns mouse position XY
|
||||||
Vector2 GetMousePosition()
|
Vector2 GetMousePosition(void)
|
||||||
{
|
{
|
||||||
double mouseX;
|
double mouseX;
|
||||||
double mouseY;
|
double mouseY;
|
||||||
@ -588,7 +588,7 @@ Vector2 GetMousePosition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns mouse wheel movement Y
|
// Returns mouse wheel movement Y
|
||||||
int GetMouseWheelMove()
|
int GetMouseWheelMove(void)
|
||||||
{
|
{
|
||||||
previousMouseWheelY = currentMouseWheelY;
|
previousMouseWheelY = currentMouseWheelY;
|
||||||
|
|
||||||
@ -749,7 +749,7 @@ static void WindowSizeCallback(GLFWwindow* window, int width, int height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Takes a bitmap (BMP) screenshot and saves it in the same folder as executable
|
// Takes a bitmap (BMP) screenshot and saves it in the same folder as executable
|
||||||
static void TakeScreenshot()
|
static void TakeScreenshot(void)
|
||||||
{
|
{
|
||||||
static int shotNum = 0; // Screenshot number, increments every screenshot take during program execution
|
static int shotNum = 0; // Screenshot number, increments every screenshot take during program execution
|
||||||
|
|
||||||
|
42
src/raylib.h
42
src/raylib.h
@ -259,22 +259,22 @@ extern "C" { // Prevents name mangling of functions
|
|||||||
void InitWindow(int width, int height, const char *title); // Initialize Window and Graphics Context (OpenGL)
|
void InitWindow(int width, int height, const char *title); // Initialize Window and Graphics Context (OpenGL)
|
||||||
void InitWindowEx(int width, int height, const char* title, // Initialize Window and Graphics Context (OpenGL),...
|
void InitWindowEx(int width, int height, const char* title, // Initialize Window and Graphics Context (OpenGL),...
|
||||||
bool resizable, const char *cursorImage); // ...define if windows-resizable and custom cursor
|
bool resizable, const char *cursorImage); // ...define if windows-resizable and custom cursor
|
||||||
void CloseWindow(); // Close Window and Terminate Context
|
void CloseWindow(void); // Close Window and Terminate Context
|
||||||
bool WindowShouldClose(); // Detect if KEY_ESCAPE pressed or Close icon pressed
|
bool WindowShouldClose(void); // Detect if KEY_ESCAPE pressed or Close icon pressed
|
||||||
void ToggleFullscreen(); // Fullscreen toggle (by default F11)
|
void ToggleFullscreen(void); // Fullscreen toggle (by default F11)
|
||||||
void SetCustomCursor(const char *cursorImage); // Set a custom cursor icon/image
|
void SetCustomCursor(const char *cursorImage); // Set a custom cursor icon/image
|
||||||
void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
|
void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
|
||||||
|
|
||||||
void ClearBackground(Color color); // Sets Background Color
|
void ClearBackground(Color color); // Sets Background Color
|
||||||
void BeginDrawing(); // Setup drawing canvas to start drawing
|
void BeginDrawing(void); // Setup drawing canvas to start drawing
|
||||||
void EndDrawing(); // End canvas drawing and Swap Buffers (Double Buffering)
|
void EndDrawing(void); // End canvas drawing and Swap Buffers (Double Buffering)
|
||||||
|
|
||||||
void Begin3dMode(Camera cam); // Initializes 3D mode for drawing (Camera setup)
|
void Begin3dMode(Camera cam); // Initializes 3D mode for drawing (Camera setup)
|
||||||
void End3dMode(); // Ends 3D mode and returns to default 2D orthographic mode
|
void End3dMode(void); // Ends 3D mode and returns to default 2D orthographic mode
|
||||||
|
|
||||||
void SetTargetFPS(int fps); // Set target FPS (maximum)
|
void SetTargetFPS(int fps); // Set target FPS (maximum)
|
||||||
float GetFPS(); // Returns current FPS
|
float GetFPS(void); // Returns current FPS
|
||||||
float GetFrameTime(); // Returns time in seconds for one frame
|
float GetFrameTime(void); // Returns time in seconds for one frame
|
||||||
|
|
||||||
Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
|
Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
|
||||||
int GetHexValue(Color color); // Returns hexadecimal value for a Color
|
int GetHexValue(Color color); // Returns hexadecimal value for a Color
|
||||||
@ -282,7 +282,7 @@ int GetHexValue(Color color); // Returns hexadecim
|
|||||||
int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
|
int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
|
||||||
Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0 to 1.0
|
Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0 to 1.0
|
||||||
|
|
||||||
void ShowLogo(); // Activates raylib logo at startup
|
void ShowLogo(void); // Activates raylib logo at startup
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Input Handling Functions (Module: core)
|
// Input Handling Functions (Module: core)
|
||||||
@ -296,10 +296,10 @@ bool IsMouseButtonPressed(int button); // Detect if a mouse but
|
|||||||
bool IsMouseButtonDown(int button); // Detect if a mouse button is being pressed
|
bool IsMouseButtonDown(int button); // Detect if a mouse button is being pressed
|
||||||
bool IsMouseButtonReleased(int button); // Detect if a mouse button has been released once
|
bool IsMouseButtonReleased(int button); // Detect if a mouse button has been released once
|
||||||
bool IsMouseButtonUp(int button); // Detect if a mouse button is NOT being pressed
|
bool IsMouseButtonUp(int button); // Detect if a mouse button is NOT being pressed
|
||||||
int GetMouseX(); // Returns mouse position X
|
int GetMouseX(void); // Returns mouse position X
|
||||||
int GetMouseY(); // Returns mouse position Y
|
int GetMouseY(void); // Returns mouse position Y
|
||||||
Vector2 GetMousePosition(); // Returns mouse position XY
|
Vector2 GetMousePosition(void); // Returns mouse position XY
|
||||||
int GetMouseWheelMove(); // Returns mouse wheel movement Y
|
int GetMouseWheelMove(void); // Returns mouse wheel movement Y
|
||||||
|
|
||||||
bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available
|
bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available
|
||||||
Vector2 GetGamepadMovement(int gamepad); // Return axis movement vector for a gamepad
|
Vector2 GetGamepadMovement(int gamepad); // Return axis movement vector for a gamepad
|
||||||
@ -359,7 +359,7 @@ void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, V
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Font Loading and Text Drawing Functions (Module: text)
|
// Font Loading and Text Drawing Functions (Module: text)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
SpriteFont GetDefaultFont(); // Get the default SpriteFont
|
SpriteFont GetDefaultFont(void); // Get the default SpriteFont
|
||||||
SpriteFont LoadSpriteFont(const char *fileName); // Load a SpriteFont image into GPU memory
|
SpriteFont LoadSpriteFont(const char *fileName); // Load a SpriteFont image into GPU memory
|
||||||
void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory
|
void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory
|
||||||
|
|
||||||
@ -411,8 +411,8 @@ void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vec
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Audio Loading and Playing Functions (Module: audio)
|
// Audio Loading and Playing Functions (Module: audio)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
void InitAudioDevice(); // Initialize audio device and context
|
void InitAudioDevice(void); // Initialize audio device and context
|
||||||
void CloseAudioDevice(); // Close the audio device and context (and music stream)
|
void CloseAudioDevice(void); // Close the audio device and context (and music stream)
|
||||||
|
|
||||||
Sound LoadSound(char *fileName); // Load sound to memory
|
Sound LoadSound(char *fileName); // Load sound to memory
|
||||||
Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource)
|
Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource)
|
||||||
@ -425,12 +425,12 @@ void SetSoundVolume(Sound sound, float volume); // Set volume fo
|
|||||||
void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
||||||
|
|
||||||
void PlayMusicStream(char *fileName); // Start music playing (open stream)
|
void PlayMusicStream(char *fileName); // Start music playing (open stream)
|
||||||
void StopMusicStream(); // Stop music playing (close stream)
|
void StopMusicStream(void); // Stop music playing (close stream)
|
||||||
void PauseMusicStream(); // Pause music playing
|
void PauseMusicStream(void); // Pause music playing
|
||||||
bool MusicIsPlaying(); // Check if music is playing
|
bool MusicIsPlaying(void); // Check if music is playing
|
||||||
void SetMusicVolume(float volume); // Set volume for music (1.0 is max level)
|
void SetMusicVolume(float volume); // Set volume for music (1.0 is max level)
|
||||||
float GetMusicTimeLength(); // Get current music time length (in seconds)
|
float GetMusicTimeLength(void); // Get current music time length (in seconds)
|
||||||
float GetMusicTimePlayed(); // Get current music time played (in seconds)
|
float GetMusicTimePlayed(void); // Get current music time played (in seconds)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ void VectorTransform(Vector3 *v, Matrix mat)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Return a Vector3 init to zero
|
// Return a Vector3 init to zero
|
||||||
Vector3 VectorZero()
|
Vector3 VectorZero(void)
|
||||||
{
|
{
|
||||||
Vector3 zero = { 0.0, 0.0, 0.0 };
|
Vector3 zero = { 0.0, 0.0, 0.0 };
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ float VectorDistance(Vector3 v1, Vector3 v2); // Calculate distance be
|
|||||||
Vector3 VectorLerp(Vector3 v1, Vector3 v2, float amount); // Calculate linear interpolation between two vectors
|
Vector3 VectorLerp(Vector3 v1, Vector3 v2, float amount); // Calculate linear interpolation between two vectors
|
||||||
Vector3 VectorReflect(Vector3 vector, Vector3 normal); // Calculate reflected vector to normal
|
Vector3 VectorReflect(Vector3 vector, Vector3 normal); // Calculate reflected vector to normal
|
||||||
void VectorTransform(Vector3 *v, Matrix mat); // Transforms a Vector3 with a given Matrix
|
void VectorTransform(Vector3 *v, Matrix mat); // Transforms a Vector3 with a given Matrix
|
||||||
Vector3 VectorZero(); // Return a Vector3 init to zero
|
Vector3 VectorZero(void); // Return a Vector3 init to zero
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Functions Declaration to work with Matrix
|
// Functions Declaration to work with Matrix
|
||||||
|
46
src/rlgl.c
46
src/rlgl.c
@ -179,10 +179,10 @@ static GLuint whiteTexture;
|
|||||||
// Module specific Functions Declaration
|
// Module specific Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
||||||
static GLuint LoadDefaultShaders();
|
static GLuint LoadDefaultShaders(void);
|
||||||
static void InitializeBuffers();
|
static void InitializeBuffers(void);
|
||||||
static void InitializeVAOs();
|
static void InitializeVAOs(void);
|
||||||
static void UpdateBuffers();
|
static void UpdateBuffers(void);
|
||||||
|
|
||||||
// Shader files loading (external) - Not used but useful...
|
// Shader files loading (external) - Not used but useful...
|
||||||
static GLuint LoadShaders(char *vertexFileName, char *fragmentFileName);
|
static GLuint LoadShaders(char *vertexFileName, char *fragmentFileName);
|
||||||
@ -223,9 +223,9 @@ void rlOrtho(double left, double right, double bottom, double top, double near,
|
|||||||
glOrtho(left, right, bottom, top, near, far);
|
glOrtho(left, right, bottom, top, near, far);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rlPushMatrix() { glPushMatrix(); }
|
void rlPushMatrix(void) { glPushMatrix(); }
|
||||||
void rlPopMatrix() { glPopMatrix(); }
|
void rlPopMatrix(void) { glPopMatrix(); }
|
||||||
void rlLoadIdentity() { glLoadIdentity(); }
|
void rlLoadIdentity(void) { glLoadIdentity(); }
|
||||||
void rlTranslatef(float x, float y, float z) { glTranslatef(x, y, z); }
|
void rlTranslatef(float x, float y, float z) { glTranslatef(x, y, z); }
|
||||||
void rlRotatef(float angleDeg, float x, float y, float z) { glRotatef(angleDeg, x, y, z); }
|
void rlRotatef(float angleDeg, float x, float y, float z) { glRotatef(angleDeg, x, y, z); }
|
||||||
void rlScalef(float x, float y, float z) { glScalef(x, y, z); }
|
void rlScalef(float x, float y, float z) { glScalef(x, y, z); }
|
||||||
@ -244,7 +244,7 @@ void rlMatrixMode(int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Push the current matrix to stack
|
// Push the current matrix to stack
|
||||||
void rlPushMatrix()
|
void rlPushMatrix(void)
|
||||||
{
|
{
|
||||||
if (stackCounter == MATRIX_STACK_SIZE - 1)
|
if (stackCounter == MATRIX_STACK_SIZE - 1)
|
||||||
{
|
{
|
||||||
@ -259,7 +259,7 @@ void rlPushMatrix()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pop lattest inserted matrix from stack
|
// Pop lattest inserted matrix from stack
|
||||||
void rlPopMatrix()
|
void rlPopMatrix(void)
|
||||||
{
|
{
|
||||||
if (stackCounter > 0)
|
if (stackCounter > 0)
|
||||||
{
|
{
|
||||||
@ -270,7 +270,7 @@ void rlPopMatrix()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset current matrix to identity matrix
|
// Reset current matrix to identity matrix
|
||||||
void rlLoadIdentity()
|
void rlLoadIdentity(void)
|
||||||
{
|
{
|
||||||
*currentMatrix = MatrixIdentity();
|
*currentMatrix = MatrixIdentity();
|
||||||
}
|
}
|
||||||
@ -358,7 +358,7 @@ void rlBegin(int mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rlEnd() { glEnd(); }
|
void rlEnd(void) { glEnd(); }
|
||||||
void rlVertex2i(int x, int y) { glVertex2i(x, y); }
|
void rlVertex2i(int x, int y) { glVertex2i(x, y); }
|
||||||
void rlVertex2f(float x, float y) { glVertex2f(x, y); }
|
void rlVertex2f(float x, float y) { glVertex2f(x, y); }
|
||||||
void rlVertex3f(float x, float y, float z) { glVertex3f(x, y, z); }
|
void rlVertex3f(float x, float y, float z) { glVertex3f(x, y, z); }
|
||||||
@ -378,7 +378,7 @@ void rlBegin(int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finish vertex providing
|
// Finish vertex providing
|
||||||
void rlEnd()
|
void rlEnd(void)
|
||||||
{
|
{
|
||||||
if (useTempBuffer)
|
if (useTempBuffer)
|
||||||
{
|
{
|
||||||
@ -633,7 +633,7 @@ void rlEnableTexture(unsigned int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Disable texture usage
|
// Disable texture usage
|
||||||
void rlDisableTexture()
|
void rlDisableTexture(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGL_11
|
#ifdef USE_OPENGL_11
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
@ -668,7 +668,7 @@ void rlClearColor(byte r, byte g, byte b, byte a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear used screen buffers (color and depth)
|
// Clear used screen buffers (color and depth)
|
||||||
void rlClearScreenBuffers()
|
void rlClearScreenBuffers(void)
|
||||||
{
|
{
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear used buffers: Color and Depth (Depth is used for 3D)
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear used buffers: Color and Depth (Depth is used for 3D)
|
||||||
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // Stencil buffer not used...
|
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // Stencil buffer not used...
|
||||||
@ -681,7 +681,7 @@ void rlClearScreenBuffers()
|
|||||||
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
||||||
|
|
||||||
// Init OpenGL 3.3+ required data
|
// Init OpenGL 3.3+ required data
|
||||||
void rlglInit()
|
void rlglInit(void)
|
||||||
{
|
{
|
||||||
// Initialize GLEW
|
// Initialize GLEW
|
||||||
glewExperimental = 1; // Needed for core profile
|
glewExperimental = 1; // Needed for core profile
|
||||||
@ -765,7 +765,7 @@ void rlglInit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Vertex Buffer Object deinitialization (memory free)
|
// Vertex Buffer Object deinitialization (memory free)
|
||||||
void rlglClose()
|
void rlglClose(void)
|
||||||
{
|
{
|
||||||
// Unbind everything
|
// Unbind everything
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
@ -815,7 +815,7 @@ void rlglClose()
|
|||||||
free(draws);
|
free(draws);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rlglDraw()
|
void rlglDraw(void)
|
||||||
{
|
{
|
||||||
UpdateBuffers();
|
UpdateBuffers();
|
||||||
|
|
||||||
@ -1254,12 +1254,12 @@ unsigned char *rlglReadScreenPixels(int width, int height)
|
|||||||
|
|
||||||
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
||||||
|
|
||||||
void PrintProjectionMatrix()
|
void PrintProjectionMatrix(void)
|
||||||
{
|
{
|
||||||
PrintMatrix(projection);
|
PrintMatrix(projection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintModelviewMatrix()
|
void PrintModelviewMatrix(void)
|
||||||
{
|
{
|
||||||
PrintMatrix(modelview);
|
PrintMatrix(modelview);
|
||||||
}
|
}
|
||||||
@ -1273,7 +1273,7 @@ void PrintModelviewMatrix()
|
|||||||
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
||||||
|
|
||||||
// Load Shaders (Vertex and Fragment)
|
// Load Shaders (Vertex and Fragment)
|
||||||
static GLuint LoadDefaultShaders()
|
static GLuint LoadDefaultShaders(void)
|
||||||
{
|
{
|
||||||
// NOTE: Shaders are written using GLSL 110 (desktop), that is equivalent to GLSL 100 on ES2
|
// NOTE: Shaders are written using GLSL 110 (desktop), that is equivalent to GLSL 100 on ES2
|
||||||
|
|
||||||
@ -1411,7 +1411,7 @@ static char *TextFileRead(char *fn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Allocate and initialize float array buffers to store vertex data (lines, triangles, quads)
|
// Allocate and initialize float array buffers to store vertex data (lines, triangles, quads)
|
||||||
static void InitializeBuffers()
|
static void InitializeBuffers(void)
|
||||||
{
|
{
|
||||||
// Initialize lines arrays (vertex position and color data)
|
// Initialize lines arrays (vertex position and color data)
|
||||||
lines.vertices = (float *)malloc(sizeof(float)*3*2*MAX_LINES_BATCH); // 3 float by vertex, 2 vertex by line
|
lines.vertices = (float *)malloc(sizeof(float)*3*2*MAX_LINES_BATCH); // 3 float by vertex, 2 vertex by line
|
||||||
@ -1464,7 +1464,7 @@ static void InitializeBuffers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize Vertex Array Objects (Contain VBO)
|
// Initialize Vertex Array Objects (Contain VBO)
|
||||||
static void InitializeVAOs()
|
static void InitializeVAOs(void)
|
||||||
{
|
{
|
||||||
// Initialize Lines VAO
|
// Initialize Lines VAO
|
||||||
glGenVertexArrays(1, &vaoLines);
|
glGenVertexArrays(1, &vaoLines);
|
||||||
@ -1543,7 +1543,7 @@ static void InitializeVAOs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update VBOs with vertex array data
|
// Update VBOs with vertex array data
|
||||||
static void UpdateBuffers()
|
static void UpdateBuffers(void)
|
||||||
{
|
{
|
||||||
// Activate Lines VAO
|
// Activate Lines VAO
|
||||||
glBindVertexArray(vaoLines);
|
glBindVertexArray(vaoLines);
|
||||||
|
22
src/rlgl.h
22
src/rlgl.h
@ -84,9 +84,9 @@ extern "C" { // Prevents name mangling of functions
|
|||||||
// Functions Declaration - Matrix operations
|
// Functions Declaration - Matrix operations
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
void rlMatrixMode(int mode); // Choose the current matrix to be transformed
|
void rlMatrixMode(int mode); // Choose the current matrix to be transformed
|
||||||
void rlPushMatrix(); // Push the current matrix to stack
|
void rlPushMatrix(void); // Push the current matrix to stack
|
||||||
void rlPopMatrix(); // Pop lattest inserted matrix from stack
|
void rlPopMatrix(void); // Pop lattest inserted matrix from stack
|
||||||
void rlLoadIdentity(); // Reset current matrix to identity matrix
|
void rlLoadIdentity(void); // Reset current matrix to identity matrix
|
||||||
void rlTranslatef(float x, float y, float z); // Multiply the current matrix by a translation matrix
|
void rlTranslatef(float x, float y, float z); // Multiply the current matrix by a translation matrix
|
||||||
void rlRotatef(float angleDeg, float x, float y, float z); // Multiply the current matrix by a rotation matrix
|
void rlRotatef(float angleDeg, float x, float y, float z); // Multiply the current matrix by a rotation matrix
|
||||||
void rlScalef(float x, float y, float z); // Multiply the current matrix by a scaling matrix
|
void rlScalef(float x, float y, float z); // Multiply the current matrix by a scaling matrix
|
||||||
@ -98,7 +98,7 @@ void rlOrtho(double left, double right, double bottom, double top, double near,
|
|||||||
// Functions Declaration - Vertex level operations
|
// Functions Declaration - Vertex level operations
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
void rlBegin(int mode); // Initialize drawing mode (how to organize vertex)
|
void rlBegin(int mode); // Initialize drawing mode (how to organize vertex)
|
||||||
void rlEnd(); // Finish vertex providing
|
void rlEnd(void); // Finish vertex providing
|
||||||
void rlVertex2i(int x, int y); // Define one vertex (position) - 2 int
|
void rlVertex2i(int x, int y); // Define one vertex (position) - 2 int
|
||||||
void rlVertex2f(float x, float y); // Define one vertex (position) - 2 float
|
void rlVertex2f(float x, float y); // Define one vertex (position) - 2 float
|
||||||
void rlVertex3f(float x, float y, float z); // Define one vertex (position) - 3 float
|
void rlVertex3f(float x, float y, float z); // Define one vertex (position) - 3 float
|
||||||
@ -113,19 +113,19 @@ void rlColor4f(float x, float y, float z, float w); // Define one vertex (color)
|
|||||||
// NOTE: This functions are used to completely abstract raylib code from OpenGL layer
|
// NOTE: This functions are used to completely abstract raylib code from OpenGL layer
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
void rlEnableTexture(unsigned int id); // Enable texture usage
|
void rlEnableTexture(unsigned int id); // Enable texture usage
|
||||||
void rlDisableTexture(); // Disable texture usage
|
void rlDisableTexture(void); // Disable texture usage
|
||||||
void rlDeleteTextures(unsigned int id); // Delete OpenGL texture from GPU
|
void rlDeleteTextures(unsigned int id); // Delete OpenGL texture from GPU
|
||||||
void rlDeleteVertexArrays(unsigned int id); // Unload vertex data from GPU memory
|
void rlDeleteVertexArrays(unsigned int id); // Unload vertex data from GPU memory
|
||||||
void rlClearColor(byte r, byte g, byte b, byte a); // Clear color buffer with color
|
void rlClearColor(byte r, byte g, byte b, byte a); // Clear color buffer with color
|
||||||
void rlClearScreenBuffers(); // Clear used screen buffers (color and depth)
|
void rlClearScreenBuffers(void); // Clear used screen buffers (color and depth)
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Functions Declaration - rlgl functionality
|
// Functions Declaration - rlgl functionality
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
||||||
void rlglInit(); // Initialize rlgl (shaders, VAO, VBO...)
|
void rlglInit(void); // Initialize rlgl (shaders, VAO, VBO...)
|
||||||
void rlglClose(); // De-init rlgl
|
void rlglClose(void); // De-init rlgl
|
||||||
void rlglDraw(); // Draw VAOs
|
void rlglDraw(void); // Draw VAOs
|
||||||
unsigned int rlglLoadModel(VertexData mesh);
|
unsigned int rlglLoadModel(VertexData mesh);
|
||||||
unsigned int rlglLoadCompressedTexture(unsigned char *data, int width, int height, int mipmapCount, int format);
|
unsigned int rlglLoadCompressedTexture(unsigned char *data, int width, int height, int mipmapCount, int format);
|
||||||
#endif
|
#endif
|
||||||
@ -137,8 +137,8 @@ unsigned int rlglLoadTexture(unsigned char *data, int width, int height, bool ge
|
|||||||
byte *rlglReadScreenPixels(int width, int height); // Read screen pixel data (color buffer)
|
byte *rlglReadScreenPixels(int width, int height); // Read screen pixel data (color buffer)
|
||||||
|
|
||||||
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
|
||||||
void PrintProjectionMatrix(); // DEBUG: Print projection matrix
|
void PrintProjectionMatrix(void); // DEBUG: Print projection matrix
|
||||||
void PrintModelviewMatrix(); // DEBUG: Print modelview matrix
|
void PrintModelviewMatrix(void); // DEBUG: Print modelview matrix
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -82,7 +82,7 @@ static SpriteFont LoadRBMF(const char *fileName); // Load a rBMF font file (ra
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Definition
|
// Module Functions Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
extern void LoadDefaultFont()
|
extern void LoadDefaultFont(void)
|
||||||
{
|
{
|
||||||
defaultFont.numChars = 96; // We know our default font has 94 chars
|
defaultFont.numChars = 96; // We know our default font has 94 chars
|
||||||
|
|
||||||
@ -181,14 +181,14 @@ extern void LoadDefaultFont()
|
|||||||
TraceLog(INFO, "Default font loaded successfully");
|
TraceLog(INFO, "Default font loaded successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void UnloadDefaultFont()
|
extern void UnloadDefaultFont(void)
|
||||||
{
|
{
|
||||||
rlDeleteTextures(defaultFont.texture.id);
|
rlDeleteTextures(defaultFont.texture.id);
|
||||||
free(defaultFont.charSet);
|
free(defaultFont.charSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the default font, useful to be used with extended parameters
|
// Get the default font, useful to be used with extended parameters
|
||||||
SpriteFont GetDefaultFont()
|
SpriteFont GetDefaultFont(void)
|
||||||
{
|
{
|
||||||
return defaultFont;
|
return defaultFont;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user