mirror of
https://github.com/raysan5/raylib.git
synced 2026-11-25 09:01:47 -05:00
Compare commits
4 Commits
debc1f6b1f
...
257de088a8
| Author | SHA1 | Date | |
|---|---|---|---|
| 257de088a8 | |||
| 76ee15224a | |||
| 15a915ed5e | |||
| f2939a6b87 |
13
BINDINGS.md
13
BINDINGS.md
@ -150,12 +150,9 @@ These are older raylib bindings that are more than 2 versions old or have not be
|
||||
| [gforth-raylib](https://github.com/ArnautDaniel/gforth-raylib) | 3.5 | [Gforth](https://gforth.org) |
|
||||
| [raylib\*d](https://github.com/Sepheus/raylib_d) | 2.5 | [D](https://dlang.org) |
|
||||
| [bindbc-raylib](https://github.com/o3o/bindbc-raylib) | 3.0 | [D](https://dlang.org) |
|
||||
| [dray](https://github.com/redthing1/dray) | **5.0** | [D](https://dlang.org) |
|
||||
| [go-raylib](https://github.com/chunqian/go-raylib) | 3.5 | [Go](https://golang.org) |
|
||||
| [raylib-goplus](https://github.com/Lachee/raylib-goplus) | 2.6-dev | [Go](https://golang.org) |
|
||||
| [ray-go](https://github.com/hecate-tech/ray-go) | 2.6-dev | [Go](https://golang.org) |
|
||||
| [raylib-luamore](https://github.com/HDPLocust/raylib-luamore) | 3.0 | [Lua](http://www.lua.org) |
|
||||
| [LuaJIT-Raylib](https://github.com/Bambofy/LuaJIT-Raylib) | 2.6 | [Lua](http://www.lua.org) |
|
||||
| [raylib-lua-sol](https://github.com/RobLoach/raylib-lua-sol) | 2.5 | [Lua](http://www.lua.org) |
|
||||
| [raylib-lua-ffi](https://github.com/raysan5/raylib/issues/693) | 2.0 | [Lua](http://www.lua.org) |
|
||||
| [raylib-lua](https://github.com/raysan5/raylib-lua) | 1.7 | [Lua](http://www.lua.org) |
|
||||
@ -171,19 +168,18 @@ These are older raylib bindings that are more than 2 versions old or have not be
|
||||
| [raylib-cr](https://github.com/AregevDev/raylib-cr) | 2.5-dev | [Crystal](https://crystal-lang.org) |
|
||||
| [raylib.cr](https://github.com/sam0x17/raylib.cr) | 2.0 | [Crystal](https://crystal-lang.org) |
|
||||
| [cray](https://gitlab.com/Zatherz/cray) | 1.8 | [Crystal](https://crystal-lang.org) |
|
||||
| [raylib-pas](https://github.com/tazdij/raylib-pas) | 3.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal*(programming*language)) |
|
||||
| [raylib-pascal](https://github.com/drezgames/raylib-pascal) | 2.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal*(programming*language)) |
|
||||
| [raylib-pas](https://github.com/tazdij/raylib-pas) | 3.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) |
|
||||
| [raylib-pascal](https://github.com/drezgames/raylib-pascal) | 2.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) |
|
||||
| [Graphics-Raylib](https://github.com/athreef/Graphics-Raylib) | 1.4 | [Perl](https://www.perl.org) |
|
||||
| [Relib](https://github.com/RedCubeDev-ByteSpace/Relib) | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) |
|
||||
| [raylib-ruby](https://github.com/a0/raylib-ruby) | 2.6 | [Ruby](https://www.ruby-lang.org/en) |
|
||||
| [raylib-ruby-ffi](https://github.com/D3nX/raylib-ruby-ffi) | 2.0 | [Ruby](https://www.ruby-lang.org/en) |
|
||||
| [raylib-mruby](https://github.com/lihaochen910/raylib-mruby) | 2.5-dev | [mruby](https://github.com/mruby/mruby) |
|
||||
| [raylib-java](https://github.com/XoanaIO/raylib-java) | 2.0 | [Java](https://en.wikipedia.org/wiki/Java*(programming_language)) |
|
||||
| [raylib-java](https://github.com/XoanaIO/raylib-java) | 2.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) |
|
||||
| [kaylib](https://github.com/electronstudio/kaylib) | 3.7 | [Kotlin/native](https://kotlinlang.org) |
|
||||
| [clj-raylib](https://github.com/lsevero/clj-raylib) | 3.0 | [Clojure](https://clojure.org) |
|
||||
| [QuickJS-raylib](https://github.com/sntg-p/QuickJS-raylib) | 3.0 | [QuickJS](https://bellard.org/quickjs) |
|
||||
| [raylib-duktape](https://github.com/RobLoach/raylib-duktape) | 2.6 | [JavaScript (Duktape)](https://en.wikipedia.org/wiki/JavaScript) |
|
||||
| [rayjule](https://github.com/SabeDoesThings/rayjule) | **5.5** | [Jule](https://jule.dev/) |
|
||||
| [raylib-chaiscript](https://github.com/RobLoach/raylib-chaiscript) | 2.6 | [ChaiScript](http://chaiscript.com) |
|
||||
| [raylib-squirrel](https://github.com/RobLoach/raylib-squirrel) | 2.5 | [Squirrel](http://www.squirrel-lang.org) |
|
||||
| [racket-raylib-2d](https://github.com/arvyy/racket-raylib-2d) | 2.5 | [Racket](https://racket-lang.org) |
|
||||
@ -196,8 +192,6 @@ These are older raylib bindings that are more than 2 versions old or have not be
|
||||
| [raylib-gambit-scheme](https://github.com/georgjz/raylib-gambit-scheme) | 3.1-dev | [Gambit Scheme](https://github.com/gambit/gambit) |
|
||||
| [Euraylib](https://github.com/gAndy50/Euraylib) | 3.0 | [Euphoria](https://openeuphoria.org) |
|
||||
| [raylib-odin](https://github.com/kevinw/raylib-odin) | 3.0 | [Odin](https://odin-lang.org) |
|
||||
| [vraylib](https://github.com/waotzi/vraylib) | 3.5 | [V](https://vlang.io) |
|
||||
| [raylib-vala](https://code.guddler.uk/mart/raylibVapi) | 3.0 | [Vala](https://wiki.gnome.org/Projects/Vala) |
|
||||
| [raylib-jai](https://github.com/kujukuju/raylib-jai) | 3.1-dev | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) |
|
||||
| [ray.zig](https://github.com/BitPuffin/zig-raylib-experiments) | 2.5 | [Zig](https://ziglang.org) |
|
||||
| [raylib-Ada](https://github.com/mimo/raylib-Ada) | 3.0 | [Ada](https://www.adacore.com/about-ada) |
|
||||
@ -206,7 +200,6 @@ These are older raylib bindings that are more than 2 versions old or have not be
|
||||
| [raylib-mosaic](https://github.com/pluckyporcupine/raylib-mosaic) | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) |
|
||||
| [raylib-xdpw](https://github.com/vtereshkov/raylib-xdpw) | 2.6 | [XD Pascal](https://github.com/vtereshkov/xdpw) |
|
||||
| [raylib-carp](https://github.com/sacredbirdman/raylib-carp) | 3.0 | [Carp](https://github.com/carp-lang/Carp) |
|
||||
| [raylib-fb](https://github.com/IchMagBier/raylib-fb) | 3.0 | [FreeBasic](https://www.freebasic.net) |
|
||||
| [raylib-purebasic](https://github.com/D-a-n-i-l-o/raylib-purebasic) | 3.0 | [PureBasic](https://www.purebasic.com) |
|
||||
| [pyraylib](https://github.com/Ho011/pyraylib) | 3.7 | [Python](https://www.python.org) |
|
||||
| [raylib-ats2](https://github.com/mephistopheles-8/raylib-ats2) | 3.0 | [ATS2](http://www.ats-lang.org) |
|
||||
|
||||
10
src/external/rlsw.h
vendored
10
src/external/rlsw.h
vendored
@ -2963,14 +2963,15 @@ static bool sw_polygon_clip(sw_vertex_t polygon[SW_MAX_CLIPPED_POLYGON_VERTICES]
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Argument count (1-4)
|
||||
#define SW_NARGS_(_1,_2,_3,_4,N,...) N
|
||||
#define SW_NARGS(...) SW_NARGS_(__VA_ARGS__,4,3,2,1)
|
||||
#define SW_EXPAND(x) x
|
||||
#define SW_NARGS(...) SW_EXPAND(SW_NARGS_(__VA_ARGS__,4,3,2,1))
|
||||
|
||||
// State tokens -> OR'd SW_STATE_xxx flags
|
||||
#define SW_OR1(a) (SW_STATE_##a)
|
||||
#define SW_OR2(a,b) (SW_STATE_##a | SW_STATE_##b)
|
||||
#define SW_OR3(a,b,c) (SW_STATE_##a | SW_STATE_##b | SW_STATE_##c)
|
||||
#define SW_OR4(a,b,c,d) (SW_STATE_##a | SW_STATE_##b | SW_STATE_##c | SW_STATE_##d)
|
||||
#define SW_FLAGS_(N, ...) SW_CONCATX(SW_OR, N)(__VA_ARGS__)
|
||||
#define SW_FLAGS_(N, ...) SW_EXPAND(SW_CONCATX(SW_OR, N)(__VA_ARGS__))
|
||||
#define SW_FLAGS(...) SW_FLAGS_(SW_NARGS(__VA_ARGS__), __VA_ARGS__)
|
||||
|
||||
// State tokens -> function name suffix
|
||||
@ -2978,11 +2979,12 @@ static bool sw_polygon_clip(sw_vertex_t polygon[SW_MAX_CLIPPED_POLYGON_VERTICES]
|
||||
#define SW_CAT2(a,b) a##_##b
|
||||
#define SW_CAT3(a,b,c) a##_##b##_##c
|
||||
#define SW_CAT4(a,b,c,d) a##_##b##_##c##_##d
|
||||
#define SW_NAME_(N, ...) SW_CONCATX(SW_CAT, N)(__VA_ARGS__)
|
||||
#define SW_NAME_(N, ...) SW_EXPAND(SW_CONCATX(SW_CAT, N)(__VA_ARGS__))
|
||||
#define SW_NAME(...) SW_NAME_(SW_NARGS(__VA_ARGS__), __VA_ARGS__)
|
||||
|
||||
// Forward decl for one variant; SIG is a parenthesized param list
|
||||
#define SW_RASTER_FWD(PREFIX, SIG, ...) \
|
||||
#define SW_RASTER_FWD(...) SW_EXPAND(SW_RASTER_FWD_(__VA_ARGS__))
|
||||
#define SW_RASTER_FWD_(PREFIX, SIG, ...) \
|
||||
static void SW_CONCATX(PREFIX, SW_NAME(__VA_ARGS__)) SIG;
|
||||
|
||||
// Dispatch table entry for one variant
|
||||
|
||||
@ -95,6 +95,8 @@ typedef struct {
|
||||
HBITMAP hbitmap; // GDI bitmap handler
|
||||
unsigned int *pixels; // Pointer to pixel data buffer (BGRA format)
|
||||
|
||||
int previousRenderWidth;
|
||||
int previousRenderHeight;
|
||||
int appScreenWidth;
|
||||
int appScreenHeight;
|
||||
unsigned int desiredFlags;
|
||||
@ -1602,6 +1604,35 @@ void PollInputEvents(void)
|
||||
DispatchMessageW(&msg);
|
||||
}
|
||||
|
||||
if ((platform.previousRenderWidth != CORE.Window.render.width) || (platform.previousRenderHeight != CORE.Window.render.height))
|
||||
{
|
||||
SetupViewport(CORE.Window.render.width, CORE.Window.render.height);
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
BITMAPINFO bmi = { 0 };
|
||||
ZeroMemory(&bmi, sizeof(bmi));
|
||||
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bmi.bmiHeader.biWidth = (LONG)CORE.Window.render.width;
|
||||
bmi.bmiHeader.biHeight = -(LONG)(CORE.Window.render.height); // Top-down bitmap
|
||||
bmi.bmiHeader.biPlanes = 1;
|
||||
bmi.bmiHeader.biBitCount = 32; // 32-bit BGRA
|
||||
bmi.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
platform.hbitmap = CreateDIBSection(
|
||||
platform.hdcmem, &bmi, DIB_RGB_COLORS,
|
||||
(void **)&platform.pixels, NULL, 0);
|
||||
|
||||
HGDIOBJ oldBitmap = SelectObject(platform.hdcmem, platform.hbitmap);
|
||||
DeleteObject(oldBitmap);
|
||||
|
||||
swResize(CORE.Window.render.width, CORE.Window.render.height);
|
||||
}
|
||||
#endif
|
||||
platform.previousRenderWidth = CORE.Window.render.width;
|
||||
platform.previousRenderHeight = CORE.Window.render.height;
|
||||
}
|
||||
|
||||
// Windows will miss key up events for specific keys; check them manually
|
||||
if ((GetKeyState(VK_LSHIFT) & 0x8000) == 0) CORE.Input.Keyboard.currentKeyState[KEY_LEFT_SHIFT] = 0;
|
||||
if ((GetKeyState(VK_RSHIFT) & 0x8000) == 0) CORE.Input.Keyboard.currentKeyState[KEY_RIGHT_SHIFT] = 0;
|
||||
@ -1903,29 +1934,7 @@ int InitPlatform(void)
|
||||
// NOTE: Windows GDI object that represents a drawing surface
|
||||
platform.hdc = GetDC(platform.hwnd);
|
||||
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE) // Using software renderer
|
||||
{
|
||||
// Initialize software framebuffer
|
||||
BITMAPINFO bmi = { 0 };
|
||||
ZeroMemory(&bmi, sizeof(bmi));
|
||||
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bmi.bmiHeader.biWidth = platform.appScreenWidth;
|
||||
bmi.bmiHeader.biHeight = -(int)(platform.appScreenHeight); // Top-down bitmap
|
||||
bmi.bmiHeader.biPlanes = 1;
|
||||
bmi.bmiHeader.biBitCount = 32; // 32-bit BGRA
|
||||
bmi.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
platform.hdcmem = CreateCompatibleDC(platform.hdc);
|
||||
|
||||
platform.hbitmap = CreateDIBSection(
|
||||
platform.hdcmem, &bmi, DIB_RGB_COLORS,
|
||||
(void **)&platform.pixels, NULL, 0);
|
||||
|
||||
SelectObject(platform.hdcmem, platform.hbitmap);
|
||||
|
||||
//ReleaseDC(platform.hwnd, platform.hdc); // Required?
|
||||
}
|
||||
else
|
||||
if (rlGetVersion() != RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
// Init hardware-accelerated OpenGL modern context
|
||||
platform.glContext = InitOpenGL(platform.hwnd, platform.hdc);
|
||||
@ -1946,10 +1955,6 @@ int InitPlatform(void)
|
||||
UpdateFlags(platform.hwnd, platform.desiredFlags, platform.appScreenWidth, platform.appScreenHeight);
|
||||
|
||||
CORE.Window.resizedLastFrame = false;
|
||||
CORE.Window.render.width = CORE.Window.screen.width;
|
||||
CORE.Window.render.height = CORE.Window.screen.height;
|
||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully %s",
|
||||
FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)? "(HighDPI)" : "");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
@ -1964,6 +1969,25 @@ int InitPlatform(void)
|
||||
TRACELOG(LOG_INFO, " > Renderer: %s", glGetString(GL_RENDERER));
|
||||
TRACELOG(LOG_INFO, " > Version: %s", glGetString(GL_VERSION));
|
||||
TRACELOG(LOG_INFO, " > GLSL: %s", "NOT SUPPORTED");
|
||||
|
||||
// Initialize software framebuffer
|
||||
BITMAPINFO bmi = { 0 };
|
||||
ZeroMemory(&bmi, sizeof(bmi));
|
||||
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bmi.bmiHeader.biWidth = (LONG)CORE.Window.render.width;
|
||||
bmi.bmiHeader.biHeight = -(LONG)(CORE.Window.render.height); // Top-down bitmap
|
||||
bmi.bmiHeader.biPlanes = 1;
|
||||
bmi.bmiHeader.biBitCount = 32; // 32-bit BGRA
|
||||
bmi.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
platform.hdcmem = CreateCompatibleDC(platform.hdc);
|
||||
|
||||
platform.hbitmap = CreateDIBSection(
|
||||
platform.hdcmem, &bmi, DIB_RGB_COLORS,
|
||||
(void **)&platform.pixels, NULL, 0);
|
||||
|
||||
SelectObject(platform.hdcmem, platform.hbitmap);
|
||||
//ReleaseDC(platform.hwnd, platform.hdc); // Not required because the window class uses CS_OWNDC
|
||||
}
|
||||
|
||||
// Initialize timing system
|
||||
@ -2107,15 +2131,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
// WARNING: Don't trust the docs, they say this message can not be obtained if not calling DefWindowProc()
|
||||
// in response to WM_WINDOWPOSCHANGED but looks like when a window is created,
|
||||
// this message can be obtained without getting WM_WINDOWPOSCHANGED
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
// WARNING: Waiting two frames before resizing because software-renderer backend is initilized with swInit() later
|
||||
// than InitPlatform(), that triggers WM_SIZE, so avoid crashing
|
||||
if (CORE.Time.frameCounter > 2) HandleWindowResize(hwnd, &platform.appScreenWidth, &platform.appScreenHeight);
|
||||
#else
|
||||
// NOTE: This message is only triggered on window creation
|
||||
HandleWindowResize(hwnd, &platform.appScreenWidth, &platform.appScreenHeight);
|
||||
#endif
|
||||
result = 0; // If an application processes WM_SIZE message, it should return zero
|
||||
} break;
|
||||
case WM_GETMINMAXINFO:
|
||||
@ -2287,7 +2303,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
HDC hdc = BeginPaint(hwnd, &ps);
|
||||
|
||||
// Blit from memory DC to window DC
|
||||
BitBlt(hdc, 0, 0, platform.appScreenWidth, platform.appScreenHeight, platform.hdcmem, 0, 0, SRCCOPY);
|
||||
BitBlt(hdc, 0, 0, CORE.Window.render.width, CORE.Window.render.height, platform.hdcmem, 0, 0, SRCCOPY);
|
||||
|
||||
EndPaint(hwnd, &ps);
|
||||
}
|
||||
@ -2516,9 +2532,10 @@ static void HandleWindowResize(HWND hwnd, int *width, int *height)
|
||||
GetClientRect(hwnd, &rect);
|
||||
SIZE clientSize = { rect.right, rect.bottom };
|
||||
|
||||
CORE.Window.render.width = (int)clientSize.cx;
|
||||
CORE.Window.render.height = (int)clientSize.cy;
|
||||
CORE.Window.currentFbo.width = (int)clientSize.cx;
|
||||
CORE.Window.currentFbo.height = (int)clientSize.cy;
|
||||
SetupViewport(clientSize.cx, clientSize.cy);
|
||||
|
||||
CORE.Window.resizedLastFrame = true;
|
||||
float dpiScale = ((float)GetDpiForWindowCompat(hwnd))/96.0f;
|
||||
@ -2537,10 +2554,6 @@ static void HandleWindowResize(HWND hwnd, int *width, int *height)
|
||||
|
||||
CORE.Window.screenScale = MatrixScale( (float)CORE.Window.render.width/CORE.Window.screen.width,
|
||||
(float)CORE.Window.render.height/CORE.Window.screen.height, 1.0f);
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
swResize(clientSize.cx, clientSize.cy);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Update window style
|
||||
|
||||
@ -493,6 +493,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "IMAGE: HDR file format not supported");
|
||||
UnloadImage(image);
|
||||
image = (Image){ 0 };
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user