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
19
votes
2 answers

Using SDL_ttf with OpenGL

I'm using OpenGL and SDL to create a window in my program. How do I use SDL_ttf with an OpenGL window? For example I want to load a font and render some text. I want to draw the text using an SDL OpenGL surface.
Khedesh
  • 207
  • 1
  • 2
  • 4
19
votes
1 answer

What is SDL_Joystick and what is SDL_GameController? What are the relationships between the two?

What is the relationship between SDL_Joystick and SDL_GameController? These are the only things I know of right now: SDL_GameController and related functions are all part of a new API introduced in SDL2. SDL_GameController and related functions…
tom_mai78101
  • 2,383
  • 2
  • 32
  • 59
19
votes
8 answers

Printf is not printing anything to output? C++ SDL

I am trying to use "printf" in my Visual C++ project however it is not working. Using Lazy Foo's tutorial, I set up SDL in my project, but when I play it, printf doesnt do anything. #include "SDL.h" #include int main( int argc, char*…
Qasim
  • 1,686
  • 4
  • 27
  • 51
18
votes
4 answers

Achieving a constant frame rate in SDL

I'm trying to make an SDL program that runs with a constant frame rate. However I'm finding that even though my program is lagging a lot and skipping a lot of frames (even though it's running at a low frame and isn't rendering much). Do you guys…
SDLFunTimes
  • 745
  • 2
  • 7
  • 13
18
votes
9 answers

Is Python and pygame a good way to learn SDL?

If I want to move to C++ and SDL in the future, is Python and pygame a good way to learn SDL?
Not
18
votes
6 answers

SDL2: LNK1561: entry point must be defined

I want to compile this code: #include int main(int argc, char* argv[]) { return 0; } But it can't be linked: Error 1 error LNK1561: entry point must be defined There is some strange code in this library:…
Dmitry
  • 7,457
  • 12
  • 57
  • 83
18
votes
3 answers

SDL embed image inside program executable

Is it possible to embed an image within a program using SDL which can be used at run time. For example, I have a program which brings up a splash screen on startup containing the logo and copyright information. Rather than having this image in a…
Scott
  • 438
  • 6
  • 18
17
votes
1 answer

How a WebAssembly application maps its native Window / OpenGL / Vulkan calls to a canvas element in DOM?

I'm reading about WebAssembly, and I was curious about how to port graphics programming like Vulkan or OpenGL to a canvas element. The documentation is long, and I think I'll figure this out eventually, but I was curious and not successful in…
Rafael Beckel
  • 2,199
  • 5
  • 25
  • 36
17
votes
2 answers

How do you include files in C++ from the /Library/Framework folder in MAC

I am trying to use SDL. I have a folder in /Library/Frameworks called SDL2.framework. I want to include the file SDL.h in my project. How do I do this? My code looks like: // Example program: // Using SDL2 to create an application window #include…
ILikeTurtles
  • 1,012
  • 4
  • 16
  • 47
17
votes
5 answers

Saving the openGL context as a video output

I am currently trying to save the animation made in openGL to a video file. I have tried using openCV's videowriter but to no advantage. I have successfully been able to generate a snapshot and save it as bmp using the SDL library. If I save all…
psiyumm
  • 6,437
  • 3
  • 29
  • 50
17
votes
5 answers

How to statically compile an SDL game on Windows

I have been trying to produce a statically linked "single binary" version of my game for windows. I want to link with sdl, sdl_image and sdl_mixer which in turn pull in a few support libraries. Unfortunately I haven't found a way to get them all to…
Sec
  • 7,059
  • 6
  • 31
  • 58
16
votes
1 answer

SDL OpenGL Alt-tab in fullscreen has unpredictable results

I am writing a game in C++ using SDL 1.2.14 and the OpenGL bindings included with it. However, if the game is in fullscreen and I Alt - Tab out then back into the game, the results are unpredictable. The game logic still runs. However, rendering…
snobaste
  • 181
  • 1
  • 5
16
votes
1 answer

SDL GUI Library?

Anyone know of a good SDL GUI library that has standard widgets? There are tons of them that turn up in google, but majority of them look like they came straight out of 1992.
user697111
  • 2,232
  • 8
  • 29
  • 40
16
votes
3 answers

Is GLUT dead for graphics programming?

After reading a discussion on Ubuntu Forums concerning GLUT vs. FreeGLUT. Is GLUT dead for graphics programming? Is SDL all the rage now for OpenGL programming?
KingNestor
  • 65,976
  • 51
  • 121
  • 152
16
votes
1 answer

SDL_PollEvent() stuttering while idle?

I've cobbled together a very basic game loop in C++ using SDL2, and I've noticed that every few seconds, SDL_PollEvent seems to be unusually slow, even when nothing is happening. I sent my deltaTime to console every loop, and its about 100ms…
Aaron Schultheis
  • 419
  • 2
  • 10