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();
|
raylib.linkLibC();
|
||||||
|
|
||||||
raylib.addIncludePath(srcdir ++ "/external/glfw/include");
|
// No GLFW required on PLATFORM_DRM
|
||||||
|
if (!options.platform_drm) {
|
||||||
|
raylib.addIncludePath(srcdir ++ "/external/glfw/include");
|
||||||
|
}
|
||||||
|
|
||||||
raylib.addCSourceFiles(&.{
|
raylib.addCSourceFiles(&.{
|
||||||
srcdir ++ "/raudio.c",
|
srcdir ++ "/raudio.c",
|
||||||
|
|
@ -49,15 +52,32 @@ pub fn addRaylib(b: *std.Build, target: std.zig.CrossTarget, optimize: std.built
|
||||||
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
||||||
},
|
},
|
||||||
.linux => {
|
.linux => {
|
||||||
raylib.addCSourceFiles(&.{srcdir ++ "/rglfw.c"}, raylib_flags);
|
if (!options.platform_drm) {
|
||||||
raylib.linkSystemLibrary("GL");
|
raylib.addCSourceFiles(&.{srcdir ++ "/rglfw.c"}, raylib_flags);
|
||||||
raylib.linkSystemLibrary("rt");
|
raylib.linkSystemLibrary("GL");
|
||||||
raylib.linkSystemLibrary("dl");
|
raylib.linkSystemLibrary("rt");
|
||||||
raylib.linkSystemLibrary("m");
|
raylib.linkSystemLibrary("dl");
|
||||||
raylib.linkSystemLibrary("X11");
|
raylib.linkSystemLibrary("m");
|
||||||
raylib.addIncludePath("/usr/include");
|
raylib.linkSystemLibrary("X11");
|
||||||
|
raylib.addIncludePath("/usr/include");
|
||||||
|
|
||||||
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
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 => {
|
.freebsd, .openbsd, .netbsd, .dragonfly => {
|
||||||
raylib.addCSourceFiles(&.{srcdir ++ "/rglfw.c"}, raylib_flags);
|
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;
|
return raylib;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Options = struct {
|
pub const Options = struct {
|
||||||
raygui: bool = false,
|
raygui: bool = false,
|
||||||
|
platform_drm: bool = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn build(b: *std.Build) void {
|
pub fn build(b: *std.Build) void {
|
||||||
|
|
@ -131,9 +152,11 @@ pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const raygui = b.option(bool, "raygui", "Compile with raygui support");
|
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, .{
|
const lib = addRaylib(b, target, optimize, .{
|
||||||
.raygui = raygui orelse false,
|
.raygui = raygui orelse false,
|
||||||
|
.platform_drm = platform_drm orelse false,
|
||||||
});
|
});
|
||||||
|
|
||||||
lib.installHeader("src/raylib.h", "raylib.h");
|
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 int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate
|
||||||
RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor
|
RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor
|
||||||
RLAPI Vector2 GetWindowScaleDPI(void); // Get window scale DPI factor
|
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 void SetClipboardText(const char *text); // Set clipboard text content
|
||||||
RLAPI const char *GetClipboardText(void); // Get 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
|
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 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 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 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
|
RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives the samples as <float>s
|
||||||
|
|
|
||||||
|
|
@ -3135,26 +3135,28 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color)
|
||||||
if (rec.height < 0) rec.height = 0;
|
if (rec.height < 0) rec.height = 0;
|
||||||
|
|
||||||
int sy = (int)rec.y;
|
int sy = (int)rec.y;
|
||||||
int ey = sy + (int)rec.height;
|
|
||||||
|
|
||||||
int sx = (int)rec.x;
|
int sx = (int)rec.x;
|
||||||
|
|
||||||
int bytesPerPixel = GetPixelDataSize(1, 1, dst->format);
|
int bytesPerPixel = GetPixelDataSize(1, 1, dst->format);
|
||||||
|
|
||||||
for (int y = sy; y < ey; y++)
|
// Fill in the first pixel of the first row based on image format
|
||||||
|
ImageDrawPixel(dst, sx, sy, color);
|
||||||
|
|
||||||
|
int bytesOffset = ((sy*dst->width) + sx)*bytesPerPixel;
|
||||||
|
unsigned char *pSrcPixel = (unsigned char *)dst->data + bytesOffset;
|
||||||
|
|
||||||
|
// Repeat the first pixel data throughout the row
|
||||||
|
for (int x = 1; x < (int)rec.width; x++)
|
||||||
{
|
{
|
||||||
// Fill in the first pixel of the row based on image format
|
memcpy(pSrcPixel + x*bytesPerPixel, pSrcPixel, bytesPerPixel);
|
||||||
ImageDrawPixel(dst, sx, y, color);
|
|
||||||
|
|
||||||
int bytesOffset = ((y*dst->width) + sx)*bytesPerPixel;
|
|
||||||
unsigned char *pSrcPixel = (unsigned char *)dst->data + bytesOffset;
|
|
||||||
|
|
||||||
// Repeat the first pixel data throughout the row
|
|
||||||
for (int x = 1; x < (int)rec.width; x++)
|
|
||||||
{
|
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw rectangle lines within an image
|
// Draw rectangle lines within an image
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user