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.

4534 questions
190
votes
14 answers

libpng warning: iCCP: known incorrect sRGB profile

I'm trying to load a PNG image using SDL but the program doesn't work and this error appears in the console libpng warning: iCCP: known incorrect sRGB profile Why does this warning appear? What should I do to solve this problem?
Reza Karami
  • 2,135
  • 2
  • 11
  • 14
112
votes
2 answers

What is an SDL renderer?

I'm starting with SDL2 and having some trouble trying to understand what an SDL_Renderer is. What is it? What does it do? What's the difference between SDL_Renderer, SDL_Window, SDL_Surface and SDL_Texture and how they are related? I had issues with…
prcastro
  • 1,967
  • 2
  • 17
  • 19
90
votes
4 answers

Difference between surface and texture (SDL / general)

Can anyone explain to me in simple words what is the difference between texture and surface? I saw it used in SDL2 as SDL_Surface and SDL_Texture. SDL_Textureis created from SDL_Surface which in turn is created from image/bitmap. Both are collection…
ps-aux
  • 9,706
  • 17
  • 67
  • 117
53
votes
6 answers

Why are SDL and OpenGL related?

I was messing around with SDL and found out that you cannot rotate images with SDL. Everywhere the question was asked, people said to use OpenGL to do rotation. I always thought that SDL was completely separate from OpenGL, am I wrong in thinking…
Devan Buggay
  • 2,492
  • 4
  • 23
  • 34
50
votes
2 answers

Why SDL defines main macro?

After having some trouble setting up SDL, I found out that SDL defines a macro that replaces main: #define main SDL_main // And then extern C_LINKAGE int SDL_main(int argc, char *argv[]); This can also create compilation errors, if the main…
Tibi
  • 3,646
  • 8
  • 34
  • 61
48
votes
3 answers

"winapifamily.h: No such file or directory" when compiling SDL in Code::Blocks

I am following along with the SDL2.0 tutorials by LazyFoo, using Code::Blocks 13.12. I have had no trouble getting SDL2 linked and running in VS2010 but have changed IDE and come across this error: winapifamily.h: No such file or directory I think…
user3427293
  • 481
  • 1
  • 4
  • 3
45
votes
2 answers

Problems using member function as custom deleter with std::shared_ptr

I'm trying to work out how to use std::shared_ptr with a custom deleter. Specifically, I'm using it with SDL_Surface as: std::shared_ptr(SDL_LoadBMP(....),SDL_FreeSurface); which compiles and runs fine. However, I would like to try out…
Wheels2050
  • 869
  • 2
  • 9
  • 17
40
votes
4 answers

Haskell library for 2D drawing

I basically want to create a full screen window and draw text on it in different colors and sizes (and also update the screen). I've used pygame for this in python and I'm looking for a similar library (should be fairly easy to use). +1 if it…
akosch
  • 4,118
  • 7
  • 56
  • 80
39
votes
1 answer

Performant 2D OpenGL graphics in R for fast display of raster image using qtpaint (qt) or rdyncall (SDL/OpenGL) packages?

For a real-time interactive Mandelbrot viewer I was making in R & Rcpp+OpenMP & Shiny I am on the lookout for a performant way to display 1920x1080 matrices as raster images in the hope of being able to achieve ca. 5-10 fps (calculating the…
Tom Wenseleers
  • 6,574
  • 5
  • 46
  • 98
39
votes
8 answers

How to suppress console output in Python?

I'm using Pygame/SDL's joystick module to get input from a gamepad. Every time I call its get_hat() method it prints to the console. This is problematic since I use the console to help me debug and now it gets flooded with SDL_JoystickGetHat…
tankadillo
  • 794
  • 2
  • 8
  • 16
32
votes
5 answers

How to use SDL2 and SDL_image with cmake

I'm looking for the simplest way to compile a c++ program using SDL2 and SDL_image with cmake. Here is my best attempt, after hours of searching: CMakeLists.txt project(shooter-cmake2) cmake_minimum_required(VERSION…
Carl Lemaire
  • 323
  • 1
  • 3
  • 7
32
votes
2 answers

Xcode 5 crashes when running an app with SDL 2

I tried to follow these two tutorials (or the applicable parts of them, due to version differences) to install SDL 2.0.2 to work with Xcode 5.1: Tutorial 1 Tutorial 2 Running any program with the SDL 2 framework linked causes Xcode to crash with…
Olli Niskanen
  • 1,155
  • 1
  • 9
  • 18
31
votes
2 answers

In What Order Should I Send My Vertices To OpenGL for Culling

I'm learning a spot of 3d opengl, and it's going rather well, I've got a nice camera moving about and some simple cube objects, at the moment. Currently using vertex arrays, but I'm swapping to VBOs pretty quick here. I'm just trying to enable…
ultifinitus
  • 1,683
  • 2
  • 17
  • 31
31
votes
5 answers

Why does valgrind say basic SDL program is leaking memory?

Here is the SDL program: #include int main(int argc, char** argv){ SDL_Init(SDL_INIT_VIDEO); SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE); SDL_Quit(); return 0; } Compiled with the command: g++ -o test…
Christian
  • 1,101
  • 2
  • 13
  • 14
30
votes
8 answers

SDL/SDL_image.h: No such file or directory

I'm trying to follow Lazy Foo's tutorials. But when I try to run one of his examples I get this compiler error: error: SDL/SDL_image.h: No such file or directory The compiler/linker is set up correctly, I'm using Code::Blocks on Windows…
Knarf
  • 1,142
  • 3
  • 11
  • 29
1
2 3
99 100