Questions tagged [sdl]

Simple DirectMedia Layer (SDL) is a cross-platform, free and open source multimedia library. Should not be confused with Security Development Lifecycle.

Simple DirectMedia Layer (SDL) is a cross-platform, free and open source multimedia library written in C that presents a simple interface to various platforms' graphics, sound, and input devices.

From SDL's home page:

Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.

SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source code.

SDL is written in C, works natively with C++, and there are bindings available for several other languages, including C# and Python.

SDL 2.0 is distributed under the zlib license. This license allows you to use SDL freely in any software.

4893 questions
16
votes
4 answers

SDL2_image not found

I am trying to compile the following code which has the headers: #include #include However after running the following makefile: g++ -std=c++11 src/main.cpp -lSDL2 -lSDL2_image I get the following error: fatal…
mas4
  • 989
  • 1
  • 8
  • 20
16
votes
4 answers

SDL2: How to properly toggle fullscreen?

I have problems deactivating fullscreen mode with my program. Entering fullscreen happens correctly, but trying to go back to windowed mode doesn't work, the only effect is that the cursor gets shown again. Here's the MCVE/SSCCE that reproduces the…
Emil Laine
  • 41,598
  • 9
  • 101
  • 157
16
votes
5 answers

Scaling sprites in SDL

How can i scale sprites in SDL?
kmaxeg
  • 163
  • 1
  • 1
  • 4
16
votes
3 answers

How do I take and save a BMP screenshot in SDL 2?

Using just a given SDL_Window* and SDL_Renderer*, how can I create and save a screenshot in SDL 2.0?
Neil Flodin
  • 578
  • 7
  • 22
15
votes
1 answer

Strange sdl side-effect on unrelated windows

When playing with sdl2 via pysdl2 I noticed this strange side-effect where once the sdl script runs unrelated windows which would normally become translucent when moved do now stay opaque. I wouldn't mind all that much if it weren't for the nagging…
Paul Panzer
  • 51,835
  • 3
  • 54
  • 99
15
votes
3 answers

Linux, C++, ThirdParty libs

Ok just a simple question. I am programming in Visual C++ on Windows and for learning purposes have changed to Ubuntu and started in Code::Blocks, CodeLite and Eclipse. I have written some simple program using SDL2 and GLEW to make a simple OpenGL…
Puso
  • 263
  • 1
  • 8
15
votes
2 answers

SDL2: Generate fully transparent texture

How using SDL_CreateTexture create transparent texture? By default I'm creating texure with such code: SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888,SDL_TEXTUREACCESS_TARGET, x, y); And then I'm paining on this texture with redirecting…
Lemonek
  • 175
  • 1
  • 1
  • 10
15
votes
4 answers

SDL2.0 Alternative for SDL_Overlay

So I've been trying to go through the following tutorial on ffmpeg: http://dranger.com/ffmpeg/tutorial02.html However, when I try to compile using gcc, I get the following output: root:/Users/mbrodeur/Downloads/HACKATHON CONTENT/Tutorials-> gcc -o…
Disco Globeulon
  • 459
  • 1
  • 6
  • 16
15
votes
5 answers

What 3D graphics framework should I use for a real world game engine?

I'm a C++ programmer with very extensive server programming experience. I'm however fairly bored at the moment and I decided to tackle a new area: 3D game programming, for learning purposes. Additionally I think this learning project may turn out to…
Andreas Bonini
  • 44,018
  • 30
  • 122
  • 156
15
votes
5 answers

How to handle multiple keypresses at once with SDL?

been getting myself familiar with OpenGL programming using SDL on Ubuntu using c++. After some looking around and experimenting I am starting to understand. I need advice on keyboard event handling with SDL. I have a 1st person camera, and can walk…
Tim
  • 964
  • 2
  • 15
  • 30
15
votes
3 answers

How to disable vsync on macOS

With all my SDL/OpenGL programs, the framerate is stuck at 60fps, so looks like the vsync is enable, but not by me, nor in my code or my settings. so i would like to now if there is a way to disable it, maybe in some deep macOS settings?
Nox
  • 932
  • 1
  • 9
  • 27
15
votes
3 answers

OpenGL 3.x context creation using SDL2 on OSX (Macbook Air 2012)

As far as I'm aware, the Macbook Air 2012 supports OpenGL 3.2. When using SDL 2.0 to create the OpenGL context, however, the context is only opengl version 2.1. Is it possible for SDL 2.0 to create a GL 3.2 context?
Captain Head
  • 333
  • 1
  • 2
  • 9
14
votes
3 answers

Fastest way to draw filled quad/triangle with the SDL2 renderer?

I have a game written using SDL2, and the SDL2 renderer (hardware accelerated) for drawing. Is there a trick to draw filled quads or triangles? At the moment I'm filling them by just drawing lots of lines (SDL_Drawlines), but the performance…
Tom Davies
  • 2,386
  • 3
  • 27
  • 44
14
votes
1 answer

Smart pointers with SDL

For my game should I use a raw pointer to create SDL_Window, SDL_Renderer, SDL_Texture etc. as they have specific delete functions SDL_DestroyTexture(texture); or should I add a custom deleter when I create a unique_ptr or shared_ptr and if so…
Dennis Harrop
  • 167
  • 1
  • 7
14
votes
1 answer

/usr/bin/ld: cannot find : No such file or directory

I'm following this SDL tutorial to try and make use of some SDL extension libraries. My code is identical to theirs but I am still unable to make the file which leads me to believe the problem is in my makefile which looks like this: CXX = g++ #…
Nanor
  • 2,400
  • 6
  • 35
  • 66