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
11
votes
1 answer

using nullptr instead of NULL when mixing C and C++

i have a very simple question... i am using the SDL API which was written in C. i am using C++. my compiler supports the keyword nullptr, and I've been reading up on it. it seems as if it is better to use rather than using the NULL macro. when I…
john
  • 147
  • 1
  • 7
11
votes
1 answer

SDL: how to stop audio - not resume, which SDL_PauseAudio(1) does actually?

Developing iOS application which uses CoreAudio framework, I am dealing with IMHO nonsense behavior of SDL reg. playing audio. SDL plays audio in loop, and only way how to trigger playback is to call SDL_PauseAudio(0), and the only way how to stop…
lef
  • 1,196
  • 1
  • 9
  • 18
11
votes
2 answers

Simply including SDL header causes linker error

I was going to migrate my game from glut to sdl. It's working perfectly in glut but I wanted to use some sdl features. So I go into my project properties, under the targets header I click the program that will be compiled, build phases, link binary…
Blam
  • 2,888
  • 3
  • 25
  • 39
11
votes
2 answers

Fully transparent windows in Pygame?

Is it possible to get a fully transparent window in Pygame (see the desktop through it)? I've found how to create a window without a frame, but there doesn't seem to be any obvious way to make it transparent. I'd be willing to tie into…
One Crayon
  • 19,119
  • 11
  • 33
  • 40
11
votes
0 answers

How do I draw text using OpenGL, SDL and C++?

I heard about SDL_TFF which I read about here but I don't understand how am I supposed to connect the TrueType2 library. Maybe there is something better out there?
Haim Bender
  • 7,937
  • 10
  • 53
  • 55
11
votes
2 answers

SDL2 - Why does SDL_CreateTextureFromSurface() need a renderer*?

This is the syntax of the SDL_CreateTextureFromSurface function: SDL_Texture* SDL_CreateTextureFromSurface(SDL_Renderer* renderer, SDL_Surface* surface) However, I'm confused why we need to pass a renderer*? I thought we need a renderer* only when…
Stoatman
  • 758
  • 3
  • 9
  • 22
11
votes
3 answers

Fluid Simulation "Blows Up"

The following fluid simulation is a translation of a paper by Stam. Something truly terrible has happened. Each time the program is run with a low DIFF=0.01, the values start off small and then rapidly expand, or "blow up". I have checked the math…
qwr
  • 9,525
  • 5
  • 58
  • 102
11
votes
3 answers

Sleep(1) and SDL_Delay(1) takes 15 ms

I am writing a C++/SDL/OpenGL application, and I have had the most peculiar bug. The game seemed to be working fine with a simple variable timestep. But then the FPS started behaving strangely. I figured out that both Sleep(1) and SDL_Delay(1) take…
user3346893
  • 153
  • 1
  • 1
  • 12
11
votes
3 answers

Using SDL2 on linux with g++?

#include "SDL2/SDL.h" int main(int argc, char* args[]) { SDL_Init(SDL_INIT_EVERYTHING); SDL_QUIT(); return 0; } I have installed SDL2 through the debian repositories, and I am running g++ -o test.cpp a.out -lSDL2…
RN_
  • 878
  • 2
  • 11
  • 30
11
votes
1 answer

Bug when resizing borderless window with SDL2

I'm trying to make an application with a borderless window in SDL2. I've implemented moving and resizing via drag. Moving works perfectly fine. Resizing by dragging the bottom and right borders also works fine. Resizing by dragging the top and left…
DormoTheNord
  • 999
  • 1
  • 9
  • 20
11
votes
2 answers

What are the benefits of using OpenGL in SDL 2?

I assume that SDL 2 uses OpenGL rendering in the background (or perhaps DirectX if on Windows) and this decision is made by SDl itself. I have seen tutorials which show the use of OpenGL directly in SDL and wondered what benefit, if any would you…
TPS
  • 2,067
  • 3
  • 23
  • 32
11
votes
8 answers

SDL 2 Undefined Reference to "WinMain@16" and several SDL functions

I've just installed SDL 2 and I have some serious problems. This is my code: #include int main(int argc, char* argv[]) { SDL_Init(SDL_INIT_VIDEO); SDL_Quit(); return 0; } I am unable to compile because I get the error…
Mihai
  • 307
  • 2
  • 6
  • 14
11
votes
3 answers

What is the best way to read input from keyboard using SDL?

I'm running an update() method n times per second to "update" the keyboard input from the user so I can read it later in the logic part of the program. So I find two ways of implementing this in the SDL Docs and I'm not sure which one should I…
Leonardo Raele
  • 2,400
  • 2
  • 28
  • 32
10
votes
2 answers

GLUT Alternatives for Haskell?

I don't want to use GLUT, because it does not have a Haskell-like feeling on it. It basically forces you to use IORef and such, because of the callbacks. I've considered GLFW, which seems simple and lets me do the game loop in a monad. But it seems…
Lanbo
  • 15,118
  • 16
  • 70
  • 147
10
votes
2 answers

Creating an OpenGL 3.2/3.x context in SDL 1.3

I'm facing a problem where SDL says it does not support OpenGL 3.x contexts. I am trying to follow this tutorial: Creating a Cross Platform OpenGL 3.2 Context in SDL (C / SDL). I am using GLEW in this case, but I couldn't get gl3.h to work with this…
KScorp
  • 101
  • 1
  • 1
  • 4