Manually review previous PR
This commit is contained in:
parent
bcdde6c65a
commit
53ad53d051
6 changed files with 36 additions and 32 deletions
21
src/core.c
21
src/core.c
|
@ -153,9 +153,8 @@
|
||||||
//#define GLFW_DLL // Using GLFW DLL on Windows -> No, we use static version!
|
//#define GLFW_DLL // Using GLFW DLL on Windows -> No, we use static version!
|
||||||
|
|
||||||
#if !defined(SUPPORT_BUSY_WAIT_LOOP) && defined(_WIN32)
|
#if !defined(SUPPORT_BUSY_WAIT_LOOP) && defined(_WIN32)
|
||||||
// NOTE: Those functions require linking with winmm library
|
__stdcall unsigned int timeBeginPeriod(unsigned int uPeriod);
|
||||||
unsigned int __stdcall timeBeginPeriod(unsigned int uPeriod);
|
__stdcall unsigned int timeEndPeriod(unsigned int uPeriod);
|
||||||
unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -352,7 +351,7 @@ extern void UnloadDefaultFont(void); // [Module: text] Unloads default fo
|
||||||
static void InitGraphicsDevice(int width, int height); // Initialize graphics device
|
static void InitGraphicsDevice(int width, int height); // Initialize graphics device
|
||||||
static void SetupFramebufferSize(int displayWidth, int displayHeight);
|
static void SetupFramebufferSize(int displayWidth, int displayHeight);
|
||||||
static void InitTimer(void); // Initialize timer
|
static void InitTimer(void); // Initialize timer
|
||||||
double GetTime(void); // Returns time since InitTimer() was run
|
static double GetTime(void); // Returns time since InitTimer() was run
|
||||||
static void Wait(float ms); // Wait for some milliseconds (stop program execution)
|
static void Wait(float ms); // Wait for some milliseconds (stop program execution)
|
||||||
static bool GetKeyStatus(int key); // Returns if a key has been pressed
|
static bool GetKeyStatus(int key); // Returns if a key has been pressed
|
||||||
static bool GetMouseButtonStatus(int button); // Returns if a mouse button has been pressed
|
static bool GetMouseButtonStatus(int button); // Returns if a mouse button has been pressed
|
||||||
|
@ -413,7 +412,7 @@ static void *GamepadThread(void *arg); // Mouse reading thread
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB)
|
||||||
// Initialize window and OpenGL context
|
// Initialize window and OpenGL context
|
||||||
// NOTE: data parameter could be used to pass any kind of required data to the initialization
|
// NOTE: data parameter could be used to pass any kind of required data to the initialization
|
||||||
void InitRLWindow(int width, int height, void *data)
|
void InitWindow(int width, int height, void *data)
|
||||||
{
|
{
|
||||||
TraceLog(LOG_INFO, "Initializing raylib (v1.9-dev)");
|
TraceLog(LOG_INFO, "Initializing raylib (v1.9-dev)");
|
||||||
|
|
||||||
|
@ -477,7 +476,7 @@ void InitRLWindow(int width, int height, void *data)
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
// Initialize window and OpenGL context (and Android activity)
|
// Initialize window and OpenGL context (and Android activity)
|
||||||
// NOTE: data parameter could be used to pass any kind of required data to the initialization
|
// NOTE: data parameter could be used to pass any kind of required data to the initialization
|
||||||
void InitRLWindow(int width, int height, void *data)
|
void InitWindow(int width, int height, void *data)
|
||||||
{
|
{
|
||||||
TraceLog(LOG_INFO, "Initializing raylib (v1.9-dev)");
|
TraceLog(LOG_INFO, "Initializing raylib (v1.9-dev)");
|
||||||
|
|
||||||
|
@ -538,7 +537,7 @@ void InitRLWindow(int width, int height, void *data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Close window and unload OpenGL context
|
// Close window and unload OpenGL context
|
||||||
void CloseRLWindow(void)
|
void CloseWindow(void)
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_GIF_RECORDING)
|
#if defined(SUPPORT_GIF_RECORDING)
|
||||||
if (gifRecording)
|
if (gifRecording)
|
||||||
|
@ -715,7 +714,7 @@ int GetScreenHeight(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show mouse cursor
|
// Show mouse cursor
|
||||||
void ShowRLCursor()
|
void ShowCursor()
|
||||||
{
|
{
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
@ -728,7 +727,7 @@ void ShowRLCursor()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hides mouse cursor
|
// Hides mouse cursor
|
||||||
void HideRLCursor()
|
void HideCursor()
|
||||||
{
|
{
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
@ -1135,7 +1134,7 @@ void SetConfigFlags(char flags)
|
||||||
// Takes a screenshot of current screen (saved a .png)
|
// Takes a screenshot of current screen (saved a .png)
|
||||||
void TakeScreenshot(const char *fileName)
|
void TakeScreenshot(const char *fileName)
|
||||||
{
|
{
|
||||||
#if (defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)) && defined(SUPPORT_SAVE_PNG)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
|
||||||
unsigned char *imgData = rlReadScreenPixels(renderWidth, renderHeight);
|
unsigned char *imgData = rlReadScreenPixels(renderWidth, renderHeight);
|
||||||
SavePNG(fileName, imgData, renderWidth, renderHeight, 4); // Save image as PNG
|
SavePNG(fileName, imgData, renderWidth, renderHeight, 4); // Save image as PNG
|
||||||
free(imgData);
|
free(imgData);
|
||||||
|
@ -2120,7 +2119,7 @@ static void InitTimer(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current time measure (in seconds) since InitTimer()
|
// Get current time measure (in seconds) since InitTimer()
|
||||||
double GetTime(void)
|
static double GetTime(void)
|
||||||
{
|
{
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||||
return glfwGetTime();
|
return glfwGetTime();
|
||||||
|
|
14
src/raylib.h
14
src/raylib.h
|
@ -682,8 +682,8 @@ extern "C" { // Prevents name mangling of functions
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Window-related functions
|
// Window-related functions
|
||||||
RLAPI void InitRLWindow(int width, int height, void *data); // Initialize window and OpenGL context
|
RLAPI void InitWindow(int width, int height, void *data); // Initialize window and OpenGL context
|
||||||
RLAPI void CloseRLWindow(void); // Close window and unload OpenGL context
|
RLAPI void CloseWindow(void); // Close window and unload OpenGL context
|
||||||
RLAPI bool WindowShouldClose(void); // Check if KEY_ESCAPE pressed or Close icon pressed
|
RLAPI bool WindowShouldClose(void); // Check if KEY_ESCAPE pressed or Close icon pressed
|
||||||
RLAPI bool IsWindowMinimized(void); // Check if window has been minimized (or lost focus)
|
RLAPI bool IsWindowMinimized(void); // Check if window has been minimized (or lost focus)
|
||||||
RLAPI void ToggleFullscreen(void); // Toggle fullscreen mode (only PLATFORM_DESKTOP)
|
RLAPI void ToggleFullscreen(void); // Toggle fullscreen mode (only PLATFORM_DESKTOP)
|
||||||
|
@ -696,8 +696,8 @@ RLAPI int GetScreenWidth(void); // Get current
|
||||||
RLAPI int GetScreenHeight(void); // Get current screen height
|
RLAPI int GetScreenHeight(void); // Get current screen height
|
||||||
|
|
||||||
// Cursor-related functions
|
// Cursor-related functions
|
||||||
RLAPI void ShowRLCursor(void); // Shows cursor
|
RLAPI void ShowCursor(void); // Shows cursor
|
||||||
RLAPI void HideRLCursor(void); // Hides cursor
|
RLAPI void HideCursor(void); // Hides cursor
|
||||||
RLAPI bool IsCursorHidden(void); // Check if cursor is not visible
|
RLAPI bool IsCursorHidden(void); // Check if cursor is not visible
|
||||||
RLAPI void EnableCursor(void); // Enables cursor (unlock cursor)
|
RLAPI void EnableCursor(void); // Enables cursor (unlock cursor)
|
||||||
RLAPI void DisableCursor(void); // Disables cursor (lock cursor)
|
RLAPI void DisableCursor(void); // Disables cursor (lock cursor)
|
||||||
|
@ -722,9 +722,7 @@ RLAPI Matrix GetCameraMatrix(Camera camera); // Returns cam
|
||||||
RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
|
RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
|
||||||
RLAPI int GetFPS(void); // Returns current FPS
|
RLAPI int GetFPS(void); // Returns current FPS
|
||||||
RLAPI float GetFrameTime(void); // Returns time in seconds for last frame drawn
|
RLAPI float GetFrameTime(void); // Returns time in seconds for last frame drawn
|
||||||
|
//RLAPI double GetCurrentTime(void); // Return current time in seconds
|
||||||
RLAPI double GetTime(void); // Return time in seconds
|
|
||||||
|
|
||||||
|
|
||||||
// Color-related functions
|
// Color-related functions
|
||||||
RLAPI int GetHexValue(Color color); // Returns hexadecimal value for a Color
|
RLAPI int GetHexValue(Color color); // Returns hexadecimal value for a Color
|
||||||
|
@ -1049,7 +1047,7 @@ RLAPI void SetShaderValuei(Shader shader, int uniformLoc, const int *value, int
|
||||||
RLAPI void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4)
|
RLAPI void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4)
|
||||||
RLAPI void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix)
|
RLAPI void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix)
|
||||||
RLAPI void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix)
|
RLAPI void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix)
|
||||||
RLAPI Matrix GetMatrixModelview();
|
RLAPI Matrix GetMatrixModelview(); // Get internal modelview matrix
|
||||||
|
|
||||||
// Texture maps generation (PBR)
|
// Texture maps generation (PBR)
|
||||||
// NOTE: Required shaders should be provided
|
// NOTE: Required shaders should be provided
|
||||||
|
|
|
@ -227,13 +227,15 @@ RMDEF float Clamp(float value, float min, float max)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Vector with components value 0.0f
|
// Vector with components value 0.0f
|
||||||
RMDEF Vector2 Vector2Zero(void) {
|
RMDEF Vector2 Vector2Zero(void)
|
||||||
|
{
|
||||||
Vector2 tmp = {0.0f, 0.0f};
|
Vector2 tmp = {0.0f, 0.0f};
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vector with components value 1.0f
|
// Vector with components value 1.0f
|
||||||
RMDEF Vector2 Vector2One(void) {
|
RMDEF Vector2 Vector2One(void)
|
||||||
|
{
|
||||||
Vector2 tmp = {1.0f, 1.0f};
|
Vector2 tmp = {1.0f, 1.0f};
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -312,13 +314,15 @@ RMDEF void Vector2Normalize(Vector2 *v)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Vector with components value 0.0f
|
// Vector with components value 0.0f
|
||||||
RMDEF Vector3 Vector3Zero(void) {
|
RMDEF Vector3 Vector3Zero(void)
|
||||||
|
{
|
||||||
Vector3 tmp = { 0.0f, 0.0f, 0.0f };
|
Vector3 tmp = { 0.0f, 0.0f, 0.0f };
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vector with components value 1.0f
|
// Vector with components value 1.0f
|
||||||
RMDEF Vector3 Vector3One(void) {
|
RMDEF Vector3 Vector3One(void)
|
||||||
|
{
|
||||||
Vector3 tmp = { 1.0f, 1.0f, 1.0f };
|
Vector3 tmp = { 1.0f, 1.0f, 1.0f };
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1293,6 +1293,12 @@ int rlGetVersion(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set debug marker
|
||||||
|
void rlSetDebugMarker(const char *text)
|
||||||
|
{
|
||||||
|
if(debugMarkerSupported) glInsertEventMarkerEXT(0, text); // 0 terminated string
|
||||||
|
}
|
||||||
|
|
||||||
// Load OpenGL extensions
|
// Load OpenGL extensions
|
||||||
// NOTE: External loader function could be passed as a pointer
|
// NOTE: External loader function could be passed as a pointer
|
||||||
void rlLoadExtensions(void *loader)
|
void rlLoadExtensions(void *loader)
|
||||||
|
|
10
src/rlgl.h
10
src/rlgl.h
|
@ -422,6 +422,7 @@ void rlglClose(void); // De-inititialize rlgl (buffers
|
||||||
void rlglDraw(void); // Update and Draw default buffers (lines, triangles, quads)
|
void rlglDraw(void); // Update and Draw default buffers (lines, triangles, quads)
|
||||||
|
|
||||||
int rlGetVersion(void); // Returns current OpenGL version
|
int rlGetVersion(void); // Returns current OpenGL version
|
||||||
|
void rlDebugSetMarker(const char *text); // Set debug marker for analysis
|
||||||
void rlLoadExtensions(void *loader); // Load OpenGL extensions
|
void rlLoadExtensions(void *loader); // Load OpenGL extensions
|
||||||
Vector3 rlUnproject(Vector3 source, Matrix proj, Matrix view); // Get world coordinates from screen coordinates
|
Vector3 rlUnproject(Vector3 source, Matrix proj, Matrix view); // Get world coordinates from screen coordinates
|
||||||
|
|
||||||
|
@ -440,9 +441,6 @@ void rlUpdateMesh(Mesh mesh, int buffer, int numVertex); // Update ve
|
||||||
void rlDrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform
|
void rlDrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform
|
||||||
void rlUnloadMesh(Mesh *mesh); // Unload mesh data from CPU and GPU
|
void rlUnloadMesh(Mesh *mesh); // Unload mesh data from CPU and GPU
|
||||||
|
|
||||||
// Debug Marker for Analysis
|
|
||||||
void rlSetMarker(const char *text);
|
|
||||||
|
|
||||||
// NOTE: There is a set of shader related functions that are available to end user,
|
// NOTE: There is a set of shader related functions that are available to end user,
|
||||||
// to avoid creating function wrappers through core module, they have been directly declared in raylib.h
|
// to avoid creating function wrappers through core module, they have been directly declared in raylib.h
|
||||||
|
|
||||||
|
@ -462,9 +460,9 @@ int GetShaderLocation(Shader shader, const char *uniformName); // G
|
||||||
void SetShaderValue(Shader shader, int uniformLoc, const float *value, int size); // Set shader uniform value (float)
|
void SetShaderValue(Shader shader, int uniformLoc, const float *value, int size); // Set shader uniform value (float)
|
||||||
void SetShaderValuei(Shader shader, int uniformLoc, const int *value, int size); // Set shader uniform value (int)
|
void SetShaderValuei(Shader shader, int uniformLoc, const int *value, int size); // Set shader uniform value (int)
|
||||||
void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4)
|
void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4)
|
||||||
void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix)
|
void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix)
|
||||||
void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix)
|
void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix)
|
||||||
Matrix GetMatrixModelview();
|
Matrix GetMatrixModelview(); // Get internal modelview matrix
|
||||||
|
|
||||||
|
|
||||||
// Texture maps generation (PBR)
|
// Texture maps generation (PBR)
|
||||||
|
|
|
@ -554,13 +554,12 @@ void UpdateTexture(Texture2D texture, const void *pixels)
|
||||||
// Save image to a PNG file
|
// Save image to a PNG file
|
||||||
void SaveImageAs(const char* fileName, Image image)
|
void SaveImageAs(const char* fileName, Image image)
|
||||||
{
|
{
|
||||||
#if (defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)) && defined(SUPPORT_SAVE_PNG)
|
// NOTE: Getting Color array as RGBA unsigned char values
|
||||||
unsigned char* imgData = (unsigned char*)GetImageData(image); // this works since Color is just a container for the RGBA values
|
unsigned char* imgData = (unsigned char*)GetImageData(image);
|
||||||
SavePNG(fileName, imgData, image.width, image.height, 4);
|
SavePNG(fileName, imgData, image.width, image.height, 4);
|
||||||
free(imgData);
|
free(imgData);
|
||||||
|
|
||||||
TraceLog(LOG_INFO, "Image saved: %s", fileName);
|
TraceLog(LOG_INFO, "Image saved: %s", fileName);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert image data to desired format
|
// Convert image data to desired format
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue