Git Product home page Git Product logo

bindbc-sdl's People

Contributors

dannyarends avatar dayllenger avatar herringway avatar ichordev avatar isaacs-dev avatar leotada avatar mdparker avatar mmcomando avatar moon-chilled avatar moth-tolias avatar mrcsnm avatar ogi-kun avatar repr-man avatar rombankzero avatar ryhon0 avatar shigekikarita avatar srmordred avatar trikko avatar unleashy avatar vabenil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bindbc-sdl's Issues

SDL_WINDOWPOS_UNDEFINED_DISPLAY cannot be used at runtime

It takes a template argument so it can't be used with compile-time unknown values. Can you change it to a function?

Probably ditto for SDL_WINDOWPOS_ISUNDEFINED, SDL_WINDOWPOS_CENTERED_DISPLAY, and SDL_WINDOWPOS_ISCENTERED, but I haven't had need of those.

Problem building in release mode

I've decided to port my graphics engine from Derelict to BindBC. When I try to build it with --build=release option, DMD hangs in an infinite loop compiling BindBC_SDL.lib. When doing a plain build it takes almost no time.
Tested with DMD 2.083.0 and 2.082.0 under 64-bit Windows 10. Specified API version is SDL_205.

Loading old version of SDL Mixer

I updated SDL Mixer 2.6.X recently but when I check sdlMixerSupport, it's 'sdlMixer200'. I'm using macOS. Is it because of an unimplemented binding?

somehow using SDL_2022 instead of SDL_206 makes unavailable some SDL functions and constants

Error: undefined identifier SDL_CaptureMouse
Error: undefined identifier SDL_CaptureMouse
Error: undefined identifier SDL_CaptureMouse
Error: undefined identifier SDL_GetGlobalMouseState
Error: undefined identifier SDL_CaptureMouse
Error: undefined identifier SDL_GetGlobalMouseState
Error: undefined identifier SDL_WINDOW_POPUP_MENU
Error: undefined identifier SDL_GetWindowBordersSize

Unable to find and link to SDL2

I installed a project https://github.com/yeti0904/YETI-16-Mk2 and built it on MacOS which uses bindbc-sdl v1.4.5.

YETI-16-Mk2 main ➜ dub build --force
    Starting Performing "debug" build using ldc2 for x86_64.
    Building bindbc-common 0.1.2: building configuration [noBC]
    Building bindbc-loader 1.1.3: building configuration [noBC]
    Building bindbc-sdl 1.4.5: building configuration [dynamic]
    Building yeti-16 ~main: building configuration [application]
     Linking yeti-16

When running it, it errors out with the following message defined by yeti-16:

YETI-16-Mk2 main ➜ ./yeti-16 run tests/helloWorld.asm
No SDL support
Library not available

even though I have both SDL2 and SDL3 installed in standard locations.

YETI-16-Mk2 main ? ➜ ls /usr/local/lib | grep libSDL
libSDL2-2.0.0.dylib
libSDL2-2.0.dylib
libSDL2.a
libSDL2.dylib
libSDL2.la
libSDL2_test.a
libSDL2_test.la
libSDL2main.a
libSDL2main.la
libSDL3.1.0.0.dylib
libSDL3.dylib
libSDL3_test.a
YETI-16-Mk2 main ?

What got the program to work was creating a symlink to /usr/local/lib/libSDL2.dylib and placing that in the same directory as the executable.


I can't really provide much more info than this because I'm not proficient with D not am I the creator of Yeti-16.

SDL 3.1 preview support?

The SDL 3.1 preview was released today. Although the ABI hasn't been declared totally stable yet, it seems safe to say things won't change too dramatically for the stable release at this point. I would like to see some support for 3.x so that I can start testing things out in my own projects.

SDL_RenderGeometryRaw should be restricted to SDL 2.0.18+

SDL_RenderGeometryRaw was introduced in SDL 2.0.18 with a pointer to int as the color parameter. In SDL 2.0.20, it was modified to take a pointer to SDL_Color.

In the binding, the int pointer form is protected in a static if, but with the wrong logic (<2.0.20), and the SDL_Color pointer form is unprotected in a naked else:

https://github.com/BindBC/bindbc-sdl/blob/master/source/sdl/render.d#L201

It should be static if(sdlSupport == SDLSupport.v2_0_18) and else static if(sdlSupport > SDLSupport.v2_0_18).

This came up in Discord when a user tried to use the default support for SDL 2.0.0 and got an error for the missing symbol.

`SDL_SYSWM_UNKNOWN` on Linux/X11

Running the demo in bindbc-wgpu.

Nothing should be wrong with my X11, the equivalent Rust code works, and running in a VM with mesa had the same results.

Tag v0.21.0 doesn't build

C:\Users\guill\AppData\Local\dub\packages\bindbc-sdl-0.21.0\bindbc-sdl\source\bindbc\sdl\bind\sdlgamecontroller.d(219,9): Error: undefined identifier `SDL_GameControllerButton`
C:\Users\guill\AppData\Local\dub\packages\bindbc-sdl-0.21.0\bindbc-sdl\source\bindbc\sdl\bind\sdlgamecontroller.d(220,9): Error: undefined identifier `SDL_GameControllerButton`
C:\Users\guill\AppData\Local\dub\packages\bindbc-sdl-0.21.0\bindbc-sdl\source\bindbc\sdl\bind\sdlgamecontroller.d(221,9): Error: undefined identifier `SDL_GameControllerButton`
C:\Users\guill\AppData\Local\dub\packages\bindbc-sdl-0.21.0\bindbc-sdl\source\bindbc\sdl\bind\sdlgamecontroller.d(222,9): Error: undefined identifier `SDL_GameControllerButton`

Workaround: using v0.20.0

Maybe an example?

Since it is different from baseline SDL, an example would be good. I spent literally hours searching the source packages to find what to import to get SDL_Window and SDL_Renderer, and it gives no definition of struct.

atomicFence is not a template declaration

I have an old project that used the derelictSDL2 bindings on a different computer. I moved it to this computer and I can no longer figure out how to install derelictSDL. The pdf of instructions that I saved references files that do not even exist. So I decided I would try to update to the new bindings here in bindbc.

My project uses make (as opposed to dub) because it's a fairly old project and I was inexperienced in D when I started writing it. So I downloaded bindbc and went to compile the project and got these results:

Directory Listing for Reference
Directory: C:\Program Files\D\dmd2\src\etc\bindbc-sdl

Mode LastWriteTime Length Name


d----- 2/25/2021 12:08 AM source
-a---- 11/5/2020 10:17 PM 41 .gitignore
-a---- 11/5/2020 10:17 PM 681 dub.sdl
-a---- 11/5/2020 10:17 PM 1337 LICENSE_1_0.txt
-a---- 11/5/2020 10:17 PM 17990 README.md

This is the command that I ran
PS C:\Program Files\D\dmd2\src\etc\bindbc-sdl> dub build
Performing "debug" build using C:\Program Files\D\dmd2\windows\bin\dmd.exe for x86_64.
bindbc-sdl ~master: building configuration "dynamic"...
source\bindbc\sdl\bind\sdlatomic.d(29,29): Error: template instance atomicFence!() atomicFence is not a template declaration, it is a function
C:\Program Files\D\dmd2\windows\bin\dmd.exe failed with exit code 1.
PS C:\Program Files\D\dmd2\src\etc\bindbc-sdl>

Compiler Version:
DMD32 D Compiler v2.087.0

I saw this dependency was mentioned as optional to include in the readme and I will not be using SDL atomic directly. I am not that good at any of this stuff (bindings/D/dub). I figured this was an easy thing to correct, which is why I'm asking for help here. If this is not a simple issue to respond to, then I can try removing that dependency or start over with a dub project instead.

broken on windows

discussion: https://forum.dlang.org/thread/[email protected]

With dmd:

$ dub run
    Fetching bindbc-loader 1.0.3 (getting selected version)
    Fetching bindbc-sdl 1.3.1 (getting selected version)
    Starting Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64.
    Building bindbc-loader 1.0.3: building configuration [noBC]
    Building bindbc-sdl 1.3.1: building configuration [dynamic]
C:\Users\ryuukk\AppData\Local\dub\packages\bindbc-sdl-1.3.1\bindbc-sdl\source\bindbc\sdl\ctypes.c(8): fatal error C1034: stddef.h: no include path set
C:\Users\ryuukk\AppData\Local\dub\packages\bindbc-sdl-1.3.1\bindbc-sdl\source\bindbc\sdl\config.d(127,16): Error: C preprocess command C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\cl.exe failed for file C:\Users\ryuukk\AppData\Local\dub\packages\bindbc-sdl-1.3.1\bindbc-sdl\source\bindbc\sdl\ctypes.c, exit status 2

Error C:\D\dmd2\windows\bin\dmd.exe failed with exit code 1.

With command line for developpers since you seem to be using ImportC

    Starting Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64.
  Up-to-date bindbc-loader 1.0.3: target for configuration [noBC] is up to date.
    Building bindbc-sdl 1.3.1: building configuration [dynamic]
C:\Users\ryuukk\AppData\Local\dub\packages\bindbc-sdl-1.3.1\bindbc-sdl\source\sdl\rwops.d(44,9): Warning: statement is not reachable
C:\Users\ryuukk\AppData\Local\dub\packages\bindbc-sdl-1.3.1\bindbc-sdl\source\bindbc\sdl\package.d(26,26): Deprecation: enum member `bindbc.sdl.config.SDLSupport.sdl209` is deprecated - Please use `v2_0_9` instead
Error: warnings are treated as errors
       Use -wi if you wish to treat warnings only as informational.
Error C:\D\dmd2\windows\bin\dmd.exe failed with exit code 1.

And with ldc

    Starting Performing "debug" build using ldc2 for x86_64.
    Building bindbc-loader 1.0.3: building configuration [noBC]
    Building bindbc-sdl 1.3.1: building configuration [dynamic]
C:\Users\ryuukk\AppData\Local\dub\packages\bindbc-sdl-1.3.1\bindbc-sdl\source\bindbc\sdl\ctypes.c(8,1): Error: C preprocessor directive `#include` is not supported
C:\Users\ryuukk\AppData\Local\dub\packages\bindbc-sdl-1.3.1\bindbc-sdl\source\bindbc\sdl\ctypes.c(8,1): Error: no type for declarator before `#`
C:\Users\ryuukk\AppData\Local\dub\packages\bindbc-sdl-1.3.1\bindbc-sdl\source\bindbc\sdl\ctypes.c(9,1): Error: C preprocessor directive `#include` is not supported
C:\Users\ryuukk\AppData\Local\dub\packages\bindbc-sdl-1.3.1\bindbc-sdl\source\bindbc\sdl\config.d(127,16): Error: module `ctypes` import `c_long` not found, did you mean alias `ctypes.c_ulong`?
Error: undefined identifier `wchar_t`, did you mean alias `c_wchar_t`?
Error: undefined identifier `va_list`, did you mean alias `c_va_list`?
C:\Users\ryuukk\AppData\Local\dub\packages\bindbc-sdl-1.3.1\bindbc-sdl\source\sdl\rwops.d(44,9): Warning: statement is not reachable
C:\Users\ryuukk\AppData\Local\dub\packages\bindbc-sdl-1.3.1\bindbc-sdl\source\bindbc\sdl\package.d(26,26): Deprecation: enum member `bindbc.sdl.config.SDLSupport.sdl209` is deprecated - Please use `v2_0_9` instead
Error ldc2 failed with exit code 1.

Dub file:

{
	"authors": [
		"ryuukk"
	],
	"copyright": "Copyright © 2023, ryuukk",
	"description": "A minimal D application.",
	"license": "proprietary",
	"name": "hellosdl",
	"dependencies": {
		"bindbc-sdl": "~>1.3.0",
	},
	"versions": [
		"SDL_2_26"
	],
}

code:

import bindbc.sdl;
import core.stdc.stdio;

void main(){

	// here we load the dll
	auto ret = loadSDL();

	// here handle cases where it failed to load the dll
	if(ret != sdlSupport){
		if(ret == SDLSupport.noLibrary){
			// dll not found
		}else if(ret == SDLSupport.badLibrary){
			// wrong DLL, perhaps 32bit vs 64bit?
		}
		return;
	}

	// all good, let's use SDL


	SDL_Window* window = NULL;
	SDL_Surface* screenSurface = NULL;
	if (SDL_Init(SDL_INIT_VIDEO) < 0) {
	  fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError());
	  return 1;
	}
	window = SDL_CreateWindow(
				    "hello_sdl2",
				    SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
				    SCREEN_WIDTH, SCREEN_HEIGHT,
				    SDL_WINDOW_SHOWN
				    );
	if (window == null) {
	  fprintf(stderr, "could not create window: %s\n", SDL_GetError());
	  return 1;
	}
	screenSurface = SDL_GetWindowSurface(window);
	SDL_FillRect(screenSurface, null, SDL_MapRGB(screenSurface->format, 0xFF, 0xFF, 0xFF));
	SDL_UpdateWindowSurface(window);
	SDL_Delay(2000);
	SDL_DestroyWindow(window);
	SDL_Quit();
}

Last version working: 1.2.4

I suggest making the experience as smooth as possible since SDL is quite popular and people expect things to be working out of the box

Fail to load some library on windows

tried to load SDL2's dynamic link library,
Succeed to load SDL2(2.26.5 x64),
Failed to load SDL2_image(2.6.3 x64), SDL2_ttf(2.20.2 x64),

dirs and files (simplified)

  • sdl2-test
    • source
      • app.d
    • dub.json
    • SDL2.dll
    • SDL2_image.dll
    • SDL2_ttf.dll
    • sdl2-test.exe

dub.json

{
	"authors": [
		"RiceShark"
	],
	"copyright": "Copyright © 2023, RiceShark",
	"dependencies": {
		"bindbc-sdl": "~>1.3.5"
	},
	"description": "A minimal D application.",
	"license": "proprietary",
	"name": "sdl2-test",
	"versions":[
		"SDL_2_26","SDL_Image_2_6","SDL_TTF_2_20"
	]
}

app.d

import std.stdio;
import bindbc.sdl;

int flagSDL = SDL_INIT_VIDEO;
int flagSDLImage = IMG_INIT_PNG | IMG_INIT_JPG;

void main()
{
	initSDL();
	initSDLImage();
	initSDLTTF();
	return;
}

void initSDL()
{
	SDLSupport ret;
	ret = loadSDL();
	if(ret != sdlSupport){
		if(ret == SDLSupport.noLibrary){
			writeln("Failed to load SDL2, no library.");
			return;
		}else if(ret == SDLSupport.badLibrary){
			writeln("Failed to load SDL2, something bad.",getVersionSDL());
			return;
		}
	}
	if(SDL_Init(flagSDL) < 0){
		writefln("Failed to init SDL2. (%(%s.%))",getVersionSDL());
		return;
	}
	writefln("Succeed to init SDL2. (%(%s.%))",getVersionSDL());
	return;
}

ubyte[3] getVersionSDL()
{
	SDL_version ver;
	SDL_GetVersion(&ver);
	return [ver.major, ver.minor, ver.patch];
}

void initSDLImage()
{
	SDLImageSupport ret;
	ret = loadSDLImage();
	if (ret != sdlImageSupport)
	{
		if (ret == SDLImageSupport.noLibrary)
		{
			writeln("Failed to load SDL2_image, no libs.");
			return;
		}
		else if (ret == SDLImageSupport.badLibrary)
		{
			writefln("Failed to load SDL2_image, something bad. (%(%s.%))", getVersionSDLImage());
			return;
		}
	}
	writefln("Succeed to load sdl2_image. (%(%s.%))", getVersionSDLImage());

	// IMG_Init() 
	return;
}

ubyte[3] getVersionSDLImage()
{
	const SDL_version* ver = IMG_Linked_Version();
	return [ver.major, ver.minor, ver.patch];
}

void initSDLTTF()
{
	SDLTTFSupport ret;

	ret = loadSDLTTF();

	if (ret != sdlTTFSupport)
	{
		if (ret == SDLTTFSupport.noLibrary)
		{
			writeln("Failed to load SDL2_ttf, no lib.");
			return;
		}
		else if (ret == SDLTTFSupport.badLibrary)
		{
			writefln("Failed to load SDL2_ttf, somthing bad. (%(%s.%))", getVersionSDLTTF());
			return;
		}
	}
	writefln("Succeed to load sdl2_ttf. (%(%s,%))", getVersionSDLTTF());

	// TTF_Init();
	return;
}

ubyte[3] getVersionSDLTTF()
{
	const SDL_version* ver = TTF_Linked_Version();
	return [ver.major, ver.minor, ver.patch];
}

PowerShell in Windows Terminal

$ dmd --version
DMD64 D Compiler v2.103.1-dirty
Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved written by Walter Bright
$ dub run
    Starting Performing "debug" build using C:\D\dmd2\windows\bin64\dmd.exe for x86_64.
  Up-to-date bindbc-loader 1.0.3: target for configuration [noBC] is up to date.
  Up-to-date bindbc-sdl 1.3.5: target for configuration [dynamic] is up to date.
    Building sdl2-test ~master: building configuration [application]
     Linking sdl2-test
    Finished To force a rebuild of up-to-date targets, run again with --force
     Running sdl2-test.exe
Succeed to init SDL2. (2.26.5)
Failed to load SDL2_image, something bad. (2.6.3)
failed to load SDL2_ttf, somthing bad. (2.20.2)

massage of bindbc.loader.sharedlib

Missing Symbol: IMG_LoadSVG
Missing Symbol: TTF_GetFontKerningSizeGlyph

I tried to find above 2 symbol in official SDL2 wiki,
but I could not find them.

Windows 11 22H2 22621.1778

Build error on ARM

Hi

I just wanted to try this library on a Raspberry Pi 400.

  1. Created a new dub package using dub init
  2. Added bindbc-sdl as dependency
  3. Added some example code to app.d

...and i got this error when trying to run dub build:

 Fetching bindbc-loader 1.0.1 (getting selected version)...
 Fetching bindbc-sdl 1.2.1 (getting selected version)...
 Performing "debug" build using /usr/bin/gdc for arm, arm_hardfloat.
 bindbc-loader 1.0.1: building configuration "noBC"...
 bindbc-sdl 1.2.1: building configuration "dynamic"...
 ../../.dub/packages/bindbc-sdl-1.2.1/bindbc-sdl/source/bindbc/sdl/bind/sdlatomic.d:29:29: error:
 template instance atomicFence!() atomicFence is not a template declaration, it is a function
    29 | alias SDL_CompilerBarrier = atomicFence!();
       |                             ^
 /usr/bin/gdc failed with exit code 1.

Is there something I'm missing?

Alias instead of function in sdlpower.d

In static version of sdlpower there is
alias pSDL_GetPowerInfo = SDL_PowerState function(int*,int*);
instead of
SDL_PowerState SDL_GetPowerInfo(int*,int*);
also
SDL_INIT_EVERYTHING
don't have
SDL_INIT_SENSOR
for sdl209

Issue: "undefined identifier SDL_LinuxSetThreadPriorityAndPolicy"

When compiling with ldc, compiler show this error.

../.dub/packages/bindbc-sdl-1.1.1/bindbc-sdl/source/bindbc/sdl/dynload.d(862,41): Error: undefined identifier `SDL_LinuxSetThreadPriorityAndPolicy`

But only when using SDL_2018 and SDL_2020 using fewer versions on dub.sdl makes executable unable to find SDL2.

Current SDL version installed: 2.0.20

SDL_SCANCODE_TO_KEYCODE cannot be used in runtime

Typically SDL_SCANCODE_TO_KEYCODE is expected to be a function/macro which can be called during runtime, but as it's defined as a compile-time constant, it cannot be used in a following scenario:

SDL_Scancode scancode = SDL_Scancode.SDL_SCANCODE_UNKNOWN;
SDL_SCANCODE_TO_KEYCODE(scancode);
Error: template bindbc.sdl.bind.sdlkeycode.SDL_SCANCODE_TO_KEYCODE cannot deduce function from argument types !()(SDL_Scancode), candidates are:
bindbc-sdl\source\bindbc\sdl\bind\sdlkeycode.d(14,6): : bindbc.sdl.bind.sdlkeycode.SDL_SCANCODE_TO_KEYCODE(SDL_Scancode x)

No library assertion failure

On macOS Big Sur M1 comes up with not supported - no library.

'''d
SDLSupport ret = loadSDL();
if(ret != sdlSupport) {
// Handle error. For most use cases, this is enough. The error handling API in
// bindbc-loader can be used for error messages. If necessary, it's possible
// to determine the primary cause programmtically:

	if(ret == SDLSupport.noLibrary) {
		// SDL shared library failed to load
		assert(0, "no library");
	}

'''

Error: 805240832u | x has no effect

Windows 7 64 bit
LDC2 version 1.19.0 (DMD v2.089.1, LLVM 9.0.1)

SDL_Window* window = SDL_CreateWindow(
        "SDL2/OpenGL Demo", 300, 100, SCREEN_WIDTH, SCREEN_HEIGHT, 
        SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);

this works with v0.13.0 but not with v0.14.0:

bindbc-sdl-0.14.0\bindbc-sdl\source\bindbc\sdl\bind\sdlvideo.d(139,51): Error: 805240832u | x has no effect
..dub\packages\bindbc-sdl-0.14.0\bindbc-sdl\source\bindbc\sdl\bind\sdlvideo.d(134,66): called from here: SDL_WINDOWPOS_CENTERED_DISPLAY(0u)

SDL2 - SDL_Keycode

For key bindings provided by the user of my engine, my code uses:

to!SDL_Keycode("SDLK_a");

Up until version 1.2.4 this worked since SDL_Keycode was defined as:

enum SDL_Keycode { }

However, in later versions of the bindings, the code changed to:

alias SDL_KeyCode = uint;
enum : SDL_KeyCode{ }

Now this automated conversion from string containing the enum member name to enum member is not possible anymore:

std.conv.ConvException@/usr/include/dmd/phobos/std/conv.d(2533): Unexpected 'S' when converting from type string to type int

Is there an easy way to restore the original behaviour?

My engine uses a config file to allow the user to configure SDL_Keycode (and SDL_EventType) to allow rebind-able keys (on runtime) to be coupled to in engine events, e.g.:

SDLK_ESCAPE, Quit, SDL_QUIT, QUIT
SDLK_UP, CameraMove, SDL_USEREVENT, FORWARD_3D
SDLK_DOWN, CameraMove, SDL_USEREVENT, BACKWARD_3D
SDLK_LEFT, CameraMove, SDL_USEREVENT, LEFT_3D
SDLK_RIGHT, CameraMove, SDL_USEREVENT, RIGHT_3D
SDLK_PAGEUP, CameraMove, SDL_USEREVENT, UP_3D
SDLK_PAGEDOWN, CameraMove, SDL_USEREVENT, DOWN_3D

example code in the readme cannot compile

in the example code I found the line LoadMsg ret = loadSDL(); which should be SDLSupport ret = loadSDL(); as it is in one of the other examples. Also the line SDL_version version; cannot work as version is a keyword in D so I had to change the variable to v. Finally the example made use of itoa which I needed to change to use the std.conv : to function:

			SDL_version v;
			SDL_GetVersion(&v);
			msg = "Your SDL version is too low: " ~
				to!string(v.major) ~ "." ~
				to!string(v.minor) ~ "." ~
				to!string(v.patch) ~
				". Please upgrade to 2.0.16+.";

Missing function: SDL_BlitSurface

The bindings seem to be missing SDL_BlitSurface(). I suspect it was overlooked because it's a macro'd alias for SDL_UpperBlit() in SDL_surface.h. My workaround for now is to just call SDL_UpperBlit() directly, but SDL_BlitSurface() is part of the public API and should be covered.

Wav Sound files not load

Using Mix_LoadWAV, files are found, but won't load!?

[Edit]

I've tried different versions. I have it initialized.

Calling `loadSDL` before `Mix_Init` with any argument causes segmentation fault on WSL

Initializing SDL2_mixer using Mix_Init supplied with any argument (other than 0) causes a segfault with error code -11, when a loadSDL call is present before it. This bug is present in WSL Ubuntu, where I tested it, and it might be present on native Linux machines as well.

Upon debugging, the segfault is thrown in an SDL_snprintf call, which's invoked from load_music_type (an internal SDL2_mixer function), which's invoked from the user-called Mix_Init function. Could SDL2_mixer possibly be trying to call from a different instance of SDL2 than the one loaded by bindbc-sdl?

Minimal reproduceable example

import bindbc.sdl;

void main() {
    loadSDL(); // So long as it's here, it'll produce the bug.
    loadSDLMixer();
    Mix_Init(MIX_INIT_OGG); // `MIX_INIT_OGG` can be substituted with anything.
}

Wrong parameter type in `SDL_RenderCopyF` and `SDL_RenderCopyExF`

The functions SDL_RenderCopyF and SDL_RenderCopyExF seem to have the wrong type for parameter srcrect. The documentation gives const SDL_Rect * srcrect, while the bindings have const(SDL_FRect)* srcrect.

Using an actual SDL_FRect gives me strange results, while SDL_Rect with a cast seems to work:

SDL_Rect src = ...;
SDL_FRect dst = ...;
SDL_RenderCopyF(renderer, texture, cast(SDL_FRect*) &src, &dst);

Thanks for maintaining these bindings.

[Windows] Loading SDL_TTF from a specific folder doesn't work

I have a project where I'm using SDL2, SDL2_Image and SDL2_TTF. I downloaded the proper binaries from their site and placed them in the folder with the executable and everything works fine.

So I tried to move those sdl binaries to their own lib folder:

build/
    app.exe
    libs/
        - SDL2.dll
        - SDL2_image.dll
        - ...

And that doesn't work, every library loads except SDL2_TTF. I also tried loading only SDL2 and SDL2_TTF (without SDL2_Image) and that doesn't work either. So it looks like loadSDLTTF doesn't work when specifying the library path.

Here are also 2 example project, sdltest is with the lib folder and SDL_TTF doesn't load. sdltest2 is the one that does work (without lib folder):

SDL Mutex and Thread

It appears as though the modules for SDL_Thread and SDL_Mutex are missing from these bindings.

Is there a reason why they're not exposed?

SDL2_net

I migrated my project from Derelict to bindbc last weekend, which went very smooth.
However, the SDL2_Net module / library I used in Derelict is not available for bindbc, are there any plans to port it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.