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

AddInstanceForFactory & HALC_ShellDriverPlugIn errors when using SDL2 with Xcode?

I am trying to make a simple game using SDL2 and C++ on Xcode 11.2.1; however, my progress has been stopped by an error. All it takes to encounter these errors is simply initializing SDL. Just calling this function will cause the program to…
Adam D
  • 81
  • 3
8
votes
4 answers

C++ 2D pixel perfect collision detection libraries?

what are the libraries available to do this which integrate with SDL and QT4 . Are there any existing packages in SDL or QT which allow for easy implementation of this?. I am looking for for an easy to use library that would allow me to have a…
Aditya P
  • 1,862
  • 5
  • 28
  • 39
8
votes
2 answers

In C++ can I pass a structure as a pointer without declaring it locally?

I'm working with SDL which is a C library that has declarations of functions like this: void SDL_foo(SDL_Rect *rect); I have my own wrappers around some of the functions like this: void foo(SDL_Rect rect) { SDL_foo(&rect); } This is so I can…
Kristopher Ives
  • 5,838
  • 7
  • 42
  • 67
8
votes
3 answers

Proper way to scale an SDL Surface without clipping?

what is the proper way to scale an SDL Surface? I found one explanation online but it required redrawing the Surface pixel by pixel. It seems like there should be some way of doing this natively through SDL rather than redrawing the image like that.…
jamesmillerio
  • 3,154
  • 4
  • 27
  • 32
8
votes
3 answers

Passing a shared_ptr through a C interface that takes void *

I have a C++ project that uses SDL, in particular SDL Events. I would like to use the event system for incoming network messages just as it is used for UI events. I can define a new event type and attach some arbitrary data (see this example). …
Edmund
  • 10,533
  • 3
  • 39
  • 57
8
votes
2 answers

Drawing 2D stuff with SDL_Renderer and OpenGL stuff with SDL_GLContext

I have been learning about SDL 2D programming for a while and now I wanted to create a program using SDL and OpenGL combined. I set it up like this: SDL_Init(SDL_INIT_VIDEO); window = SDL_CreateWindow("SDL and OpenGL", SDL_WINDOWPOS_CENTERED,…
huzzm
  • 489
  • 9
  • 24
8
votes
1 answer

Visual studio 2012 error LNK2019: unresolved external symbol, linking with static lib that is working

I'm trying to compile and link SDL2 + urho3d + QT. Now SDL and urho3d are static lib's that are working great and compiles fine in some examples but when I try to compile all of them the compilation is passing throw fine but I got alot of linker…
user63898
  • 29,839
  • 85
  • 272
  • 514
8
votes
2 answers

Wrote an SDL game using C++ and want to deploy it

I wrote this really simple game in SDL using C++ and now I want to show it to some of my friends who are using Windows. I wrote my program in Ubuntu 9.10 using Code::Blocks. I want to take my source code and make a Windows installer so they can…
TheFuzz
  • 2,607
  • 6
  • 29
  • 48
8
votes
1 answer

Porting SDL App to iOS

I have created a small game in C++ using only SDL (no OpenGL), and want to port it to iOS 6. I have no intention of releasing it publicly, It's just for personal use. The app uses only the barebones SDL library itself, no ttf or image. So, what…
user2455103
  • 505
  • 2
  • 4
  • 13
8
votes
1 answer

Linking SDL_image in make file

My Makefile - all: g++ main.cpp -I/usr/local/include -L/usr/local/lib -lSDL2 -lSDL_image My Code I am using as taken from a tutorial - /*This source code copyrighted by Lazy Foo' Productions (2004-2013) */ //Using SDL, SDL_image, standard IO,…
ILikeTurtles
  • 1,012
  • 4
  • 16
  • 47
8
votes
2 answers

SDL2 AntiAliasing

How to turn on antialiasing in SDL2, when using SDL_RenderCopyEx? I find some articles that suggest to use: SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2); and glEnable(GL_MULTISAMPLE); But…
l00k
  • 1,525
  • 1
  • 19
  • 29
8
votes
2 answers

Compiling SDL2 for Android

I am trying to compile SDL2 for Android on Ubuntu. I configure SDL2 with ./configure --host=arm-linux-androideabi After compiling using ndk-build I get a series of undefined references: Compile thumb : SDL2-2.0.0 <= SDL_androidkeyboard.c Compile…
maxwell79
  • 123
  • 1
  • 6
8
votes
2 answers

SDL: Render Texture on top of another texture

i am having trouble with the following: I need to render a texture on top of another texture and then render that main texture. For example I have the blue rectangle texture, and I want to draw red rectangles on top of this blue rect. However i want…
chelo_c
  • 1,739
  • 3
  • 21
  • 34
8
votes
1 answer

SDL2 not receiving window events

I've been using SDL2 on my Macbook with Xcode for a little bit, and I'm very pleased. Lately I tried to receive a focus lost event, but it wasn't working. After some tinkering, I found out that no window events were being received, except a window…
Biostreem
  • 169
  • 1
  • 2
  • 8
8
votes
2 answers

Invalid application of 'sizeof' to incomplete type 'SDL_Window'

Creating a pointer to an SDL_Window struct and assigning it to a shared_ptr, the mentioned error results. Part of the class: #include class Application { static std::shared_ptr window; } Definition: #include…
Appleshell
  • 7,088
  • 6
  • 47
  • 96