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
240
votes
16 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?
Omid Karami
  • 2,675
  • 2
  • 13
  • 17
129
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
  • 2,178
  • 3
  • 19
  • 21
106
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
  • 11,627
  • 25
  • 81
  • 128
61
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,717
  • 4
  • 26
  • 35
54
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
  • 4,015
  • 8
  • 40
  • 64
53
votes
9 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…
user102430
49
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
  • 491
  • 1
  • 4
  • 3
46
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
  • 879
  • 2
  • 9
  • 17
42
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,282
  • 3
  • 12
  • 31
42
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,326
  • 7
  • 59
  • 80
42
votes
2 answers

Performant 2D SDL or OpenGL graphics in R for fast display of raster image using rdyncall package and SDL/OpenGL calls

In R, it seems none of the currently available options (e.g. image) allow for fast real-time display of 2D raster graphics. I was interested for example to make a real-time interactive Mandelbrot viewer, where I was hoping to display 1920x1080 raw…
Tom Wenseleers
  • 7,535
  • 7
  • 63
  • 103
38
votes
4 answers

error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup, but this time it's NOT a Windows/Console problem!

So, the infamous error is back. The project is complaining that it can't find the main() method (that's what the error means, right). However I do have a main, and my project is a Console project, as it should be. It worked before, so I know it's…
OddCore
  • 1,534
  • 6
  • 19
  • 32
38
votes
6 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
  • 383
  • 1
  • 3
  • 7
35
votes
1 answer

Cannot infer an appropriate lifetime for autoref due to conflicting requirements

I'm having lifetime issues with a particular function in my code. I'm following a tutorial in an attempt to learn Rust and SDL. The tutorial was slightly older and the SDL library has changed since its been written, so I'm following along while…
Brad Ziolko
  • 355
  • 1
  • 3
  • 6
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,535
  • 2
  • 12
  • 18
1
2 3
99 100