Merge branch 'master' of https://github.com/raysan5/raylib
This commit is contained in:
commit
049917f282
|
|
@ -16,7 +16,10 @@ pub fn addRaylib(b: *std.Build, target: std.zig.CrossTarget, optimize: std.built
|
|||
});
|
||||
raylib.linkLibC();
|
||||
|
||||
// No GLFW required on PLATFORM_DRM
|
||||
if (!options.platform_drm) {
|
||||
raylib.addIncludePath(srcdir ++ "/external/glfw/include");
|
||||
}
|
||||
|
||||
raylib.addCSourceFiles(&.{
|
||||
srcdir ++ "/raudio.c",
|
||||
|
|
@ -49,6 +52,7 @@ pub fn addRaylib(b: *std.Build, target: std.zig.CrossTarget, optimize: std.built
|
|||
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
||||
},
|
||||
.linux => {
|
||||
if (!options.platform_drm) {
|
||||
raylib.addCSourceFiles(&.{srcdir ++ "/rglfw.c"}, raylib_flags);
|
||||
raylib.linkSystemLibrary("GL");
|
||||
raylib.linkSystemLibrary("rt");
|
||||
|
|
@ -58,6 +62,22 @@ pub fn addRaylib(b: *std.Build, target: std.zig.CrossTarget, optimize: std.built
|
|||
raylib.addIncludePath("/usr/include");
|
||||
|
||||
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
||||
} else {
|
||||
raylib.linkSystemLibrary("GLESv2");
|
||||
raylib.linkSystemLibrary("EGL");
|
||||
raylib.linkSystemLibrary("drm");
|
||||
raylib.linkSystemLibrary("gbm");
|
||||
raylib.linkSystemLibrary("pthread");
|
||||
raylib.linkSystemLibrary("rt");
|
||||
raylib.linkSystemLibrary("m");
|
||||
raylib.linkSystemLibrary("dl");
|
||||
raylib.addIncludePath("/usr/include/libdrm");
|
||||
|
||||
raylib.defineCMacro("PLATFORM_DRM", null);
|
||||
raylib.defineCMacro("GRAPHICS_API_OPENGL_ES2", null);
|
||||
raylib.defineCMacro("EGL_NO_X11", null);
|
||||
raylib.defineCMacro("DEFAULT_BATCH_BUFFER_ELEMENT", "2048");
|
||||
}
|
||||
},
|
||||
.freebsd, .openbsd, .netbsd, .dragonfly => {
|
||||
raylib.addCSourceFiles(&.{srcdir ++ "/rglfw.c"}, raylib_flags);
|
||||
|
|
@ -115,8 +135,9 @@ pub fn addRaylib(b: *std.Build, target: std.zig.CrossTarget, optimize: std.built
|
|||
return raylib;
|
||||
}
|
||||
|
||||
const Options = struct {
|
||||
pub const Options = struct {
|
||||
raygui: bool = false,
|
||||
platform_drm: bool = false,
|
||||
};
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
|
|
@ -131,9 +152,11 @@ pub fn build(b: *std.Build) void {
|
|||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const raygui = b.option(bool, "raygui", "Compile with raygui support");
|
||||
const platform_drm = b.option(bool, "platform_drm", "Compile raylib in native mode (no X11)");
|
||||
|
||||
const lib = addRaylib(b, target, optimize, .{
|
||||
.raygui = raygui orelse false,
|
||||
.platform_drm = platform_drm orelse false,
|
||||
});
|
||||
|
||||
lib.installHeader("src/raylib.h", "raylib.h");
|
||||
|
|
|
|||
|
|
@ -974,7 +974,7 @@ RLAPI int GetMonitorPhysicalHeight(int monitor); // Get specifi
|
|||
RLAPI int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate
|
||||
RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor
|
||||
RLAPI Vector2 GetWindowScaleDPI(void); // Get window scale DPI factor
|
||||
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the primary monitor
|
||||
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor
|
||||
RLAPI void SetClipboardText(const char *text); // Set clipboard text content
|
||||
RLAPI const char *GetClipboardText(void); // Get clipboard text content
|
||||
RLAPI void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling
|
||||
|
|
@ -1588,7 +1588,7 @@ RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan
|
|||
RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
|
||||
RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data
|
||||
|
||||
RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream
|
||||
RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives the samples as <float>s
|
||||
RLAPI void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Detach audio stream processor from stream
|
||||
|
||||
RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives the samples as <float>s
|
||||
|
|
|
|||
|
|
@ -3135,18 +3135,14 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color)
|
|||
if (rec.height < 0) rec.height = 0;
|
||||
|
||||
int sy = (int)rec.y;
|
||||
int ey = sy + (int)rec.height;
|
||||
|
||||
int sx = (int)rec.x;
|
||||
|
||||
int bytesPerPixel = GetPixelDataSize(1, 1, dst->format);
|
||||
|
||||
for (int y = sy; y < ey; y++)
|
||||
{
|
||||
// Fill in the first pixel of the row based on image format
|
||||
ImageDrawPixel(dst, sx, y, color);
|
||||
// Fill in the first pixel of the first row based on image format
|
||||
ImageDrawPixel(dst, sx, sy, color);
|
||||
|
||||
int bytesOffset = ((y*dst->width) + sx)*bytesPerPixel;
|
||||
int bytesOffset = ((sy*dst->width) + sx)*bytesPerPixel;
|
||||
unsigned char *pSrcPixel = (unsigned char *)dst->data + bytesOffset;
|
||||
|
||||
// Repeat the first pixel data throughout the row
|
||||
|
|
@ -3154,6 +3150,12 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color)
|
|||
{
|
||||
memcpy(pSrcPixel + x*bytesPerPixel, pSrcPixel, bytesPerPixel);
|
||||
}
|
||||
|
||||
// Repeat the first row data for all other rows
|
||||
int bytesPerRow = bytesPerPixel * (int)rec.width;
|
||||
for (int y = 1; y < (int)rec.height; y++)
|
||||
{
|
||||
memcpy(pSrcPixel + (y*dst->width)*bytesPerPixel, pSrcPixel, bytesPerRow);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user