Merge branch 'raysan5:master' into master
This commit is contained in:
commit
ca56606630
|
|
@ -17,7 +17,7 @@ pub fn addRaylib(b: *std.build.Builder, target: std.zig.CrossTarget) *std.build.
|
||||||
raylib.setBuildMode(mode);
|
raylib.setBuildMode(mode);
|
||||||
raylib.linkLibC();
|
raylib.linkLibC();
|
||||||
|
|
||||||
raylib.addIncludeDir(srcdir ++ "/external/glfw/include");
|
raylib.addIncludePath(srcdir ++ "/external/glfw/include");
|
||||||
|
|
||||||
raylib.addCSourceFiles(&.{
|
raylib.addCSourceFiles(&.{
|
||||||
srcdir ++ "/raudio.c",
|
srcdir ++ "/raudio.c",
|
||||||
|
|
@ -35,7 +35,7 @@ pub fn addRaylib(b: *std.build.Builder, target: std.zig.CrossTarget) *std.build.
|
||||||
raylib.linkSystemLibrary("winmm");
|
raylib.linkSystemLibrary("winmm");
|
||||||
raylib.linkSystemLibrary("gdi32");
|
raylib.linkSystemLibrary("gdi32");
|
||||||
raylib.linkSystemLibrary("opengl32");
|
raylib.linkSystemLibrary("opengl32");
|
||||||
raylib.addIncludeDir("external/glfw/deps/mingw");
|
raylib.addIncludePath("external/glfw/deps/mingw");
|
||||||
},
|
},
|
||||||
.linux => {
|
.linux => {
|
||||||
raylib.addCSourceFiles(&.{srcdir ++ "/rglfw.c"}, raylib_flags);
|
raylib.addCSourceFiles(&.{srcdir ++ "/rglfw.c"}, raylib_flags);
|
||||||
|
|
|
||||||
|
|
@ -1285,8 +1285,8 @@ RLAPI void ImageDrawPixel(Image *dst, int posX, int posY, Color color);
|
||||||
RLAPI void ImageDrawPixelV(Image *dst, Vector2 position, Color color); // Draw pixel within an image (Vector version)
|
RLAPI void ImageDrawPixelV(Image *dst, Vector2 position, Color color); // Draw pixel within an image (Vector version)
|
||||||
RLAPI void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image
|
RLAPI void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image
|
||||||
RLAPI void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version)
|
RLAPI void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version)
|
||||||
RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle within an image
|
RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image
|
||||||
RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw circle within an image (Vector version)
|
RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version)
|
||||||
RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image
|
RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image
|
||||||
RLAPI void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color); // Draw circle outline within an image (Vector version)
|
RLAPI void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color); // Draw circle outline within an image (Vector version)
|
||||||
RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image
|
RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image
|
||||||
|
|
|
||||||
|
|
@ -1989,8 +1989,6 @@ const char *GetClipboardText(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Show mouse cursor
|
// Show mouse cursor
|
||||||
void ShowCursor(void)
|
void ShowCursor(void)
|
||||||
{
|
{
|
||||||
|
|
@ -4173,6 +4171,8 @@ static bool InitGraphicsDevice(int width, int height)
|
||||||
glfwSetScrollCallback(CORE.Window.handle, MouseScrollCallback);
|
glfwSetScrollCallback(CORE.Window.handle, MouseScrollCallback);
|
||||||
glfwSetCursorEnterCallback(CORE.Window.handle, CursorEnterCallback);
|
glfwSetCursorEnterCallback(CORE.Window.handle, CursorEnterCallback);
|
||||||
|
|
||||||
|
glfwSetInputMode(CORE.Window.handle, GLFW_LOCK_KEY_MODS, GLFW_TRUE); // Enable lock keys modifiers (CAPS, NUM)
|
||||||
|
|
||||||
glfwMakeContextCurrent(CORE.Window.handle);
|
glfwMakeContextCurrent(CORE.Window.handle);
|
||||||
|
|
||||||
#if !defined(PLATFORM_WEB)
|
#if !defined(PLATFORM_WEB)
|
||||||
|
|
@ -5520,6 +5520,10 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
||||||
if (action == GLFW_RELEASE) CORE.Input.Keyboard.currentKeyState[key] = 0;
|
if (action == GLFW_RELEASE) CORE.Input.Keyboard.currentKeyState[key] = 0;
|
||||||
else CORE.Input.Keyboard.currentKeyState[key] = 1;
|
else CORE.Input.Keyboard.currentKeyState[key] = 1;
|
||||||
|
|
||||||
|
// WARNING: Check if CAPS/NUM key modifiers are enabled and force down state for those keys
|
||||||
|
if (((key == KEY_CAPS_LOCK) && ((mods & GLFW_MOD_CAPS_LOCK) > 0)) ||
|
||||||
|
((key == KEY_NUM_LOCK) && ((mods & GLFW_MOD_NUM_LOCK) > 0))) CORE.Input.Keyboard.currentKeyState[key] = 1;
|
||||||
|
|
||||||
// Check if there is space available in the key queue
|
// Check if there is space available in the key queue
|
||||||
if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_PRESS))
|
if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_PRESS))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2630,7 +2630,7 @@ Mesh GenMeshKnot(float radius, float size, int radSeg, int sides)
|
||||||
// NOTE: Vertex data is uploaded to GPU
|
// NOTE: Vertex data is uploaded to GPU
|
||||||
Mesh GenMeshHeightmap(Image heightmap, Vector3 size)
|
Mesh GenMeshHeightmap(Image heightmap, Vector3 size)
|
||||||
{
|
{
|
||||||
#define GRAY_VALUE(c) ((c.r+c.g+c.b)/3.0f)
|
#define GRAY_VALUE(c) ((float)(c.r + c.g + c.b)/3.0f)
|
||||||
|
|
||||||
Mesh mesh = { 0 };
|
Mesh mesh = { 0 };
|
||||||
|
|
||||||
|
|
@ -2640,7 +2640,7 @@ Mesh GenMeshHeightmap(Image heightmap, Vector3 size)
|
||||||
Color *pixels = LoadImageColors(heightmap);
|
Color *pixels = LoadImageColors(heightmap);
|
||||||
|
|
||||||
// NOTE: One vertex per pixel
|
// NOTE: One vertex per pixel
|
||||||
mesh.triangleCount = (mapX-1)*(mapZ-1)*2; // One quad every four pixels
|
mesh.triangleCount = (mapX - 1)*(mapZ - 1)*2; // One quad every four pixels
|
||||||
|
|
||||||
mesh.vertexCount = mesh.triangleCount*3;
|
mesh.vertexCount = mesh.triangleCount*3;
|
||||||
|
|
||||||
|
|
@ -2653,7 +2653,7 @@ Mesh GenMeshHeightmap(Image heightmap, Vector3 size)
|
||||||
int tcCounter = 0; // Used to count texcoords float by float
|
int tcCounter = 0; // Used to count texcoords float by float
|
||||||
int nCounter = 0; // Used to count normals float by float
|
int nCounter = 0; // Used to count normals float by float
|
||||||
|
|
||||||
Vector3 scaleFactor = { size.x/mapX, size.y/255.0f, size.z/mapZ };
|
Vector3 scaleFactor = { size.x/(mapX - 1), size.y/255.0f, size.z/(mapZ - 1) };
|
||||||
|
|
||||||
Vector3 vA = { 0 };
|
Vector3 vA = { 0 };
|
||||||
Vector3 vB = { 0 };
|
Vector3 vB = { 0 };
|
||||||
|
|
@ -2680,7 +2680,7 @@ Mesh GenMeshHeightmap(Image heightmap, Vector3 size)
|
||||||
mesh.vertices[vCounter + 7] = GRAY_VALUE(pixels[(x + 1) + z*mapX])*scaleFactor.y;
|
mesh.vertices[vCounter + 7] = GRAY_VALUE(pixels[(x + 1) + z*mapX])*scaleFactor.y;
|
||||||
mesh.vertices[vCounter + 8] = (float)z*scaleFactor.z;
|
mesh.vertices[vCounter + 8] = (float)z*scaleFactor.z;
|
||||||
|
|
||||||
// another triangle - 3 vertex
|
// Another triangle - 3 vertex
|
||||||
mesh.vertices[vCounter + 9] = mesh.vertices[vCounter + 6];
|
mesh.vertices[vCounter + 9] = mesh.vertices[vCounter + 6];
|
||||||
mesh.vertices[vCounter + 10] = mesh.vertices[vCounter + 7];
|
mesh.vertices[vCounter + 10] = mesh.vertices[vCounter + 7];
|
||||||
mesh.vertices[vCounter + 11] = mesh.vertices[vCounter + 8];
|
mesh.vertices[vCounter + 11] = mesh.vertices[vCounter + 8];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user