GithubHelp home page GithubHelp logo

derelictsdl2's People

Contributors

buggins avatar commonquail avatar darkragnara avatar hackerpilot avatar johanengelen avatar marfisc avatar mathstuf avatar mdparker avatar mleise avatar notspooky avatar p0nce avatar pineapplemachine avatar puffi avatar rosequix avatar smandy avatar srmordred avatar zaafonin 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

derelictsdl2's Issues

Linux builds should look for .so files in /usr/lib.

On Gentoo, the system's .so files are located in /usr/lib.
This is the current situation:

derelict.util.exception.SharedLibLoadException@../../../../home/chad/.dub/packages/derelict-util-1.0.2/source/derelict/util/exception.d(35): Failed to load one or more shared libraries:
        libSDL2_ttf.so - libSDL2_ttf.so: cannot open shared object file: No such file or directory
        libSDL2_ttf-2.0.so - libSDL2_ttf-2.0.so: cannot open shared object file: No such file or directory
        libSDL2_ttf-2.0.so.0 - libSDL2_ttf-2.0.so.0: cannot open shared object file: No such file or directory
        /usr/local/lib/libSDL2_ttf-2.0.so - /usr/local/lib/libSDL2_ttf-2.0.so: cannot open shared object file: No such file or directory
        /usr/local/lib/libSDL2_ttf-2.0.so.0 - /usr/local/lib/libSDL2_ttf-2.0.so.0: cannot open shared object file: No such file or directory

My system looks like this:

$ ls /usr/lib/libSDL_ttf*
/usr/lib/libSDL_ttf-2.0.so.0  /usr/lib/libSDL_ttf-2.0.so.0.10.1  /usr/lib/libSDL_ttf.so
$ ls /usr/local/lib
# ...crickets

Ideally, there should be some way for callers to include their own search paths in addition to the paths provided by Derelict. By default, Derelict should probably use the following search logic for .so files:

  1. Look at any paths provided by the caller as arguments to .load(...).

  2. Look in ./

  3. Look in $LD_LIBRARY_PATH (Reference)

  4. Look in all directories listed in /etc/ld.so.conf

  5. Look in a baked-in list of last-ditch fallback options. Although I'm sure better could be done, my current suggestion would look like this:

    ~/lib
    /usr/local/lib
    /usr/lib
    

Tangent time...
At some level, this is giving me a strong desire to have a standard (default) procedure for finding .so files on Linux/Posix systems for the entire D community. This is something that should "just work" for application developers and end-users, and it reflects poorly on application developers (and the Linux ecosystem) when users get spurious .so load failures. I wouldn't be surprised if this is a challenge on some other platforms as well.

Whew, when I look at what I wrote, it seems like a significant amount of work! Maybe, for now, just adding /usr/lib (and maybe ~/lib) to some of the enum libNames = ... lines in a few .d files would be a good idea for some easy gratification ;)

Thank you for reading, and thank you for keeping Derelict maintained for a truly respectable length of time!

Failed to load symbol SDL_HasAVX

Some really simple code is already throwing an error for me (perhaps SDL2 has updated?):
import derelict.sdl2.sdl;
void main() {DerelictSDL2.load(); }

I'm including DerelictSDL2 and DerelictUtil libraries, and libdl, and everything compiles/links okay. However when running the program, I get the following error:

[email protected](35): Failed to load symbol SDL_HasAVX from shared library libSDL2.so

SDL_LoadBMP segfaults

Invoking any of SDL_LoadBMP, SDL_LoadBMP_RW, IMG_Load causes a segfault.

To reproduce, run the following:

import derelict.sdl2.sdl;

void main() {
  SDL_Init(SDL_INIT_VIDEO);
  SDL_Window *window = SDL_CreateWindow(
    "Hello World!",
    SDL_WINDOWPOS_UNDEFINED,
    SDL_WINDOWPOS_UNDEFINED,
    640, 480,
    0);
  SDL_RWops *file = SDL_RWFromFile("image.bmp", "rb");
  // Next line segfaults
  SDL_Surface *foo = SDL_LoadBMP_RW(file, 0);
  SDL_Surface *surface = SDL_GetWindowSurface(window);

  SDL_Rect r;
  r.x=0; r.y=0; r.h=8*16; r.w=8*16;
  SDL_BlitSurface(foo, &r, surface, &r);
  SDL_UpdateWindowSurface(window);

  while (1) {
    SDL_PumpEvents();

    SDL_Event e;
    bool quitting = false;
    while (SDL_PollEvent(&e) == 1) {
      if (e.type == SDL_QUIT) quitting = true;
    }

    if (quitting) break;

  }
}

The equivalent C code does not exhibit this problem.

#include <SDL2/SDL.h>

void main(void) {
  SDL_Init(SDL_INIT_VIDEO);
  SDL_Window *window = SDL_CreateWindow(
    "Hello World!",
    SDL_WINDOWPOS_UNDEFINED,
    SDL_WINDOWPOS_UNDEFINED,
    640, 480,
    0);
  SDL_RWops *file = SDL_RWFromFile("image.bmp", "rb");
  // Next line does what you would expect
  SDL_Surface *foo = SDL_LoadBMP_RW(file, 0);
  SDL_Surface *surface = SDL_GetWindowSurface(window);

  SDL_Rect r;
  r.x=0; r.y=0; r.h=8*16; r.w=8*16;
  SDL_BlitSurface(foo, &r, surface, &r);
  SDL_UpdateWindowSurface(window);

  while (1) {
    SDL_PumpEvents();

    SDL_Event e;
    int quitting = 0;
    while (SDL_PollEvent(&e) == 1) {
      if (e.type == SDL_QUIT) quitting = 1;
    }

    if (quitting) break;

  }
}

Window border sizing issue on Windows.

window size

The appears to be a discrepancy in the window bar's height on Windows specifically when setting the window to be non-resizable.

There's also another issue that I believe may be related, wherein which minimizing the window while set to non-resizable will shrink the window to the minimum possible size Windows can make it, leaving only the window bar and controls.

I've seen similar odd behaviors in other DLang libraries regarding locked window sizing, however. Is this a wider issue, if so is it known of?

Can't load DerelictSDL2

I seem to have troubles calling DerelictSDL2.load();. This causes the program to exit with code 1 whenever I try compiling it with dub run --force -v. My dub.json has "derelict-sdl2": "~>3.0.0-beta.2" as a dependency. Even

import derelict.sdl2.sdl;
void main() {
    DerelictSDL2.load();
}

fails to run. The error I get is

derelict.util.exception.SymbolLoadException@../../../../.dub/packages/derelict-util-3.0.0-beta.1/derelict-util/source/derelict/util/sharedlib.d(181): Failed to load symbol SDL_DequeueAudio from shared library libSDL2.so
----------------
../../../../.dub/packages/derelict-util-3.0.0-beta.1/derelict-util/source/derelict/util/sharedlib.d:181 void* derelict.util.sharedlib.SharedLib.loadSymbol(immutable(char)[], bool) [0x445a3e]
../../../../.dub/packages/derelict-util-3.0.0-beta.1/derelict-util/source/derelict/util/loader.d:382 void* derelict.util.loader.SharedLibLoader.loadSymbol(immutable(char)[], bool) [0x443b44]
../../../../.dub/packages/derelict-util-3.0.0-beta.1/derelict-util/source/derelict/util/loader.d:71 void derelict.util.loader.SharedLibLoader.bindFunc(void**, immutable(char)[], bool) [0x443466]
../../../../.dub/packages/derelict-sdl2-3.0.0-beta.2/derelict-sdl2/source/derelict/sdl2/internal/sdl_dynload.d:72 void derelict.sdl2.internal.sdl_dynload.DerelictSDL2Loader.loadSymbols() [0x43fa01]
../../../../.dub/packages/derelict-util-3.0.0-beta.1/derelict-util/source/derelict/util/loader.d:253 void derelict.util.loader.SharedLibLoader.load(immutable(char)[][]) [0x443794]
../../../../.dub/packages/derelict-util-3.0.0-beta.1/derelict-util/source/derelict/util/loader.d:196 void derelict.util.loader.SharedLibLoader.load(immutable(char)[]) [0x443685]
../../../../.dub/packages/derelict-util-3.0.0-beta.1/derelict-util/source/derelict/util/loader.d:134 void derelict.util.loader.SharedLibLoader.load() [0x4434dd]
source/app.d:4 _Dmain [0x43f3da]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFNlZv [0x44a1bf]
??:? scope void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x44a0ef]
??:? scope void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x44a168]
??:? scope void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x44a0ef]
??:? _d_run_main [0x44a05f]
??:? main [0x43f401]
??:? __libc_start_main [0x1bcb882f]
Program exited with code 1

which happens regardless of whichever dub run configuration I use. Any help would be appreciated.

SDL functions seemingly no-ops when built in Release (on OSX)

On OSX, SDL2 suddenly started to fail in Release mode seemingly by silently failing and turning all SDL calls into no-ops ?

This minimal example:

    SDL_Window *window;
    SDL_Renderer *renderer;
    DerelictSDL2.load();
    enforce(SDL_Init(SDL_INIT_VIDEO) >= 0, "Failed to initialize SDL: " ~ to!string(SDL_GetError()));
    assert(SDL_CreateWindowAndRenderer(640, 480, 0, &window, &renderer) == 0);
    writeln(window, " ", renderer);

prints null null when built using dub -b release but works fine with dub -b debug

nothrow issue.

Making SDL_LogOutputFunction nothrow prevent you from using any writeln/writefln functions in log callbacks cause those functions are not nothrow.

Errors compiling functions.d and sdl.d

I'm rebuilding some Derelict libraries on a new installation of linux and while DerelictUtil and DerelictGL3 compile file with the same commands, I'm currently getting the following errors when compiling DerelictSDL2 in the 2.0.0 branch:
functions.d:414: error: undefined identifier SDL_SysWMinfo
sdl.d:383: error: undefined identifier SDL_GetWindowWMInfo

Faild to load from dynamic library on Linux.

When I build my app(with dub) on Linux(Mint) the dynamic bindings fail.

I get this log:
"""
derelict.util.exception.SymbolLoadException@../../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/sharedlib.d(181): Failed to load symbol SDL_DequeueAudio from shared library libSDL2.so
"""

Is this a bug with these bindings or some noob mistake of my own?

SDL_CaptureMouse

SDL_CaptureMouse is a new function that appeared in SDL 2.0.4

Remove (s|u)int\d+ types ?

Hi ! I just wonder why there's sint16 ... etc types ?
It is actually in C, where type sizes are not defined. In D size of each type is strongly defined, so i think we can use uint / short / ... types, can't we ?

Error writing the DerelictSDL2.lib

Trying to build a package that requires DerelictSDL2.lib for building, but there's always an error writing the DerelictSDL2.lib.

> dub run
Performing "debug" build using dmd for x86.
derelict-util 3.0.0-beta.2: target for configuration "library" is up to date.
derelict-ft 2.0.0-beta.5: target for configuration "library" is up to date.
derelict-gl3 2.0.0-beta.8: target for configuration "library" is up to date.
derelict-sdl2 3.0.0-beta.8: building configuration "derelict-sdl2-dynamic"...
Error: Error writing file '..\..\..\..\AppData\Local\dub\packages\derelict-sdl2-3.0.0-beta.8\derelict-sdl2\.dub\build\derelict-sdl2-dynamic-debug-windows-x86-dmd_2068-BDC231064BB351BF6C13F99DC7A49CFA\DerelictSDL2.lib'
dmd failed with exit code 1.

Mark functions with @nogc - Part 2

Missing the binding for the Render_*_Wrapped functions

There are three new functions in SDL2_TTF library that allow easy rendering of wrapped text:
TTF_RenderText_Blended_Wrapped
TTF_RenderUNICODE_Blended_Wrapped
TTF_RenderUTF8_Blended_Wrapped
but they are currently not bound in DerelictSDL2.
Those are badly documented but they can be easily found both in the source code and by inspecting the symbols exported in the SDL2_ttf.dll.
I will (try to) create a pull request for this tomorrow.

Compiling SDL2 - OS X. And other OS X questions.

How do I compile a test program, I'm trying the one in the README.md file?

Joels-MacBook-Pro:DerelictSDL2 joelcnz$ dmd jest.d -Isource
source/derelict/sdl2/types.d(33): Error: module system is in file 'derelict/util/system.d' which cannot be read
import path[0] = source
import path[1] = /usr/share/dmd/src/phobos
import path[2] = /usr/share/dmd/src/druntime/import
Joels-MacBook-Pro:DerelictSDL2 joelcnz$

Here's some other questions:

How do you make files writable?

How do you open a finder window with the directory of the terminal from the terminal?

How do you add (or which one to choose) a new path on DMD, and how do you copy to them?

SDL_LockTexture crash

I´m trying a simple SDL app and it crash when calling SDL_LockTexture.

SDL_LockTexture(null, null,null, null); don´t crash.

But if I put the texture on first argument or any other combination of arguments, the app crash;

Failed to load symbol SDLNet_Linked_Version

I am trying to get the example file to work ;)

the used dependancy is "derelict-sdl2":"~>1.0.0"
and just dubbing gives me

nikki@crunchbang:~/projects/d/myTest$ dub --force
derelict-util: ["derelict-util"]
derelict-sdl2: ["derelict-sdl2", "derelict-util"]
mysdltest: ["mysdltest", "derelict-sdl2", "derelict-util"]
Building derelict-util configuration "library", build type debug.
Running dmd...
Building derelict-sdl2 configuration "library", build type debug.
Running dmd...
Building mysdltest configuration "application", build type debug.
Compiling...
Linking...
Running ./mysdltest 
derelict.util.exception.SymbolLoadException@../../../.dub/packages/derelict-util-1.0.2/source/derelict/util/exception.d(35): Failed to load symbol SDLNet_Linked_Version from shared library /usr/local/lib/libSDL2.so
----------------
./mysdltest(void derelict.util.loader.SharedLibLoader.bindFunc(void**, immutable(char)[], bool)+0x54) [0x80b2fcc]
./mysdltest(void derelict.sdl2.net.DerelictSDL2NetLoader.loadSymbols()+0x58) [0x80af4d0]
./mysdltest(void derelict.util.loader.SharedLibLoader.load(immutable(char)[][])+0x56) [0x80b2d8e]
./mysdltest(void derelict.util.loader.SharedLibLoader.load(immutable(char)[])+0xc0) [0x80b2d30]
./mysdltest(void derelict.util.loader.SharedLibLoader.load()+0x47) [0x80b2c67]
./mysdltest(_Dmain+0x47) [0x80a6857]
./mysdltest(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll().void __lambda1()+0x10) [0x80b73c8]
./mysdltest(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x18) [0x80b7340]
./mysdltest(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()+0x27) [0x80b738f]
./mysdltest(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x18) [0x80b7340]
./mysdltest(_d_run_main+0x117) [0x80b72d7]
./mysdltest(main+0x14) [0x80ae55c]
/lib/i386-linux-gnu/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0xb75d0e66]
./mysdltest() [0x80a6741]
Error executing command run: Program exited with code 1

I've installed all sdl2 libraries linked to in the readme, I specifically don't understand why it's looking for SDLNet_Linked_Version in /usr/local/lib/libSDL2.so I'd imagine the /usr/local/lib/libSDL2_net.so which is there too would be more the place to look in ?

All of this could also just be me not understanding something;)

No bindings for SDL_syswm

There is one difficulty with creating the bindings: we need to parse / look up SDL_config.h to see which driver SDL is configured to use (x11, mir or wayland.)
Mir and wayland types are not in derelict util, though their members in the syswm union could perhaps be opaque pointers until they are supported.

Building errors

Platform: x86_64 Fedora 20
Compiler: dmd 2.065
Dub: 0.9.21

Having the package as dependency:

"dependencies": {
    "derelict-sdl2": "~master"
}

Got following compilation errors (i've also removed ~/.dub folder for pure build):

../../../.dub/packages/derelict-sdl2-master/source/derelict/sdl2/types.d(1925): Error: undefined identifier Derelict_OS_iOS
../../../.dub/packages/derelict-sdl2-master/source/derelict/sdl2/types.d(1928): Error: undefined identifier Derelict_OS_Android
../../../.dub/packages/derelict-sdl2-master/source/derelict/sdl2/types.d(1932): Error: undefined identifier Derelict_OS_WindowsRT, did you mean variable Derelict_OS_Windows?
../../../.dub/packages/derelict-sdl2-master/source/derelict/sdl2/functions.d(428): Error: undefined identifier Derelict_OS_iOS
../../../.dub/packages/derelict-sdl2-master/source/derelict/sdl2/functions.d(432): Error: undefined identifier Derelict_OS_Android
../../../.dub/packages/derelict-sdl2-master/source/derelict/sdl2/functions.d(440): Error: undefined identifier Derelict_OS_WindowsRT, did you mean variable Derelict_OS_Windows?
../../../.dub/packages/derelict-sdl2-master/source/derelict/sdl2/functions.d(927): Error: undefined identifier Derelict_OS_iOS
../../../.dub/packages/derelict-sdl2-master/source/derelict/sdl2/functions.d(931): Error: undefined identifier Derelict_OS_Android
../../../.dub/packages/derelict-sdl2-master/source/derelict/sdl2/functions.d(939): Error: undefined identifier Derelict_OS_WindowsRT, did you mean variable Derelict_OS_Windows?

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.