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

Building SDL2 with NDK toolchain

I wonder if anyone did managed to build the fresh SDL2 with the toolchain of the Android NDK(r8d). SDL2 seems to be very close to the release (since yesterday it isn't "UNDER CONSTROCTION anymore: http://hg.libsdl.org/SDL/rev/0a3d2ec7af6d). It comes…
drayman
  • 83
  • 5
8
votes
2 answers

SDL2 OpenGL3 How to initialize SDL inside a function

I'm experimenting with the new SDL2 beta and an OpenGL3 context, and I'm having a weird problem: If I run the SDL initialization code in my main() function, it works fine, but I want to have this code in a separete init_sdl() function. If I put the…
Defcronyke
  • 611
  • 1
  • 7
  • 21
8
votes
1 answer

How to wrap C structs in Cython for use in Python?

For a bit of learning experience, I'm trying to wrap a few parts of SDL (1.2.14) in Cython in an extension for Python 3.2. I am having a problem figuring out how to wrap C structs straight into Python, being able to access its attributes directly…
l0rdx3nu
  • 81
  • 1
  • 2
8
votes
3 answers

How to avoid tearing with pygame on Linux/X11

I've been playing with pygame (on Debian/Lenny). It seems to work nicely, except for annoying tearing of blits (fullscreen or windowed mode). I'm using the default SDL X11 driver. Googling suggests that it's a known issue with SDL that X11 provides…
timday
  • 24,582
  • 12
  • 83
  • 135
7
votes
2 answers

Which is the fastest way to clear a memory block (or a SDL surface)?

I'm currently developing a project with SDL. It basically draws and moves images (surfaces) on the screen. To move an image without leaving a trail, you must first clear the screen surface, pretty much like glClear(), and I'm currently doing it with…
NeonMan
  • 623
  • 10
  • 24
7
votes
3 answers

Ubuntu 11.10: GCC/G++ won't link libraries

I went to compile a project of mine, which uses SDL, SDL_ttf, OpenAL, and GTK. All of which are outputting errors like the following: TxtFunc.cpp:(.text+0x61): undefined reference to `TTF_OpenFont' TxtFunc.cpp:(.text+0x8c): undefined reference to…
Caleb Stewart
  • 643
  • 6
  • 21
7
votes
4 answers

Setting up SDL on Mac OS X Lion with Xcode 4

I've been trying to get a super simple SDL program to work. I'm using Mac OS X Lion. I've got SDL to work in Snow Leopard, but it doesn't seem to want to work in lion. So far I have this: #include #include "SDL/SDL.h" using namespace…
Cole
  • 720
  • 1
  • 8
  • 18
7
votes
1 answer

SDL / OpenGL: Implementing a "Loading thread"

I currently try to implement a "Loading thread" for a very basic gaming engine, which takes care of loading e.g. textures or audio while the main thread keeps rendering a proper message/screen until the operation is finished or even render regular…
PuerNoctis
  • 1,364
  • 1
  • 15
  • 34
7
votes
0 answers

Properly handling HighDPI on MacOS with SDL and OpenGL

My attempts at High-DPI rendering on MacOS for my game, Bitfighter, always end up looking bad, like a scaled-up version of a low-res game. The game uses SDL2 + OpenGL and I have correctly enabled the SDL_WINDOW_ALLOW_HIGHDPI window flag as well as…
raptor
  • 799
  • 1
  • 5
  • 16
7
votes
2 answers

Linux/X11 input library without creating a window

Is there a good library to use for gathering user input in Linux from the mouse/keyboard/joystick that doesn't force you to create a visible window to do so? SDL lets you get user input in a reasonable way, but seems to force you to create a…
rck
  • 2,020
  • 2
  • 23
  • 23
7
votes
2 answers

Using SDL_INIT_JOYSTICK without SDL_INIT_VIDEO

I've lost some time trying to get joystick support for my an application using SDL, mostly because the initialization steps where these: SDL_Init(SDL_INIT_JOYSTICK|SDL_INIT_VIDEO); SDL_JoystickEventState(SDL_ENABLE); It didn't work if I just…
lfzawacki
  • 1,422
  • 11
  • 10
7
votes
1 answer

Slow window creation with SDL_WINDOW_OPENGL flag

I've just started to testing SDL library. I've notice that SDL_CreateWindow() is very slow when I set SDL_WINDOW_OPENGL flag (takes about 10x longer). And I'm talking only about the window creation, not creation of OpenGl context. Basically this…
7
votes
3 answers

How do you get a minimal SDL program to compile and link in visual studio 2008 express?

I'm trying to use SDL in C++ with Visual Studio 2008 Express. The following program compiles but does not link: #include int main(int argc, char *argv[]) { return 0; } The link error is: LINK : fatal error LNK1561: entry point must be…
Johannes Hoff
  • 3,731
  • 5
  • 31
  • 37
7
votes
1 answer

c++ linker error LNK2005 already defined in SDL

I am compiling my program using VS2005. I am linking to SDL static libraries and am getting the following linker errors; 1>LIBCMTD.lib(fpinit.obj) : error LNK2005: __fltused already defined in SDL2d.lib(SDL_stdlib.obj) 1>LIBCMTD.lib(ftol2.obj) :…
codetemplar
  • 671
  • 6
  • 19
7
votes
1 answer

SDL Mouse Click

So, I'm currently working on an options menu for my game, I have a button that when pressed it changes it's text to the next resolution in an array, so basically the user presses this button to change their resolution to the next string in the…
genfy
  • 83
  • 3
  • 4
  • 18