Simple DirectMedia Layer (SDL) is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.

learn more… | top users | synonyms

1
vote
1answer
84 views

SDL2 Gamepad triggers trigger when disconnecting the pad

I'm using MonoGame and SDL2. I'm having a strange problem with the Gamepad. When I disconnect it during the game, before the disconnected event fires, the left and right triggers return values as if ...
1
vote
1answer
34 views

Problem getting mouse events while keys held down in SDL2

I'm attempting to write input capturing code using SDL2 on Windows. However, I'm running into a problem. Whenever a key is held down, the SDL event queue has no mouse movement, nor will the mouse ...
0
votes
0answers
25 views

Do i need any extra libraries apart from sdl and box2d? [on hold]

I'm planning on creating a 2d game. I must say I have no experience with this apart from a few pygame tutorials(sdl binding for python). So, if I want to create a 2d sidescroller game with ...
0
votes
1answer
49 views

Rectangle collision in SDL2 partially allowing sliding C++ [closed]

I am working on a game in SDL2, in which the player needs to be able to slide along walls, but NOT go through them. I've read up on things like Quadtrees, and this stackoverflow question ...
0
votes
3answers
188 views

Can I create relative filepaths to images in an XCode SDL project?

Can I create relative filepaths to images in an XCode SDL project? I have to use absolute filepaths as it is, but it would be much easier if I could make the filepaths relative.
0
votes
0answers
55 views

Artifacts rendering high-poly procedural meshes with OpenGL

I am having some issues when rendering some procedural generated meshes. There are some really wierd artifacts when rendering high-poly count meshes (not that much actualy). I have been able to ...
1
vote
0answers
22 views

SDL_Mixer .xm file loop not working correctly

I am working on a little game in my spare time using C++ and SDL and I have encountered a problem with a .xm file playback. The music is supposed to have an intro of a couple patterns and then ...
1
vote
1answer
82 views

How can I perform a masked erase in SDL2?

I'm trying to implement some shadow/lighting effects in my 2D-project, and I've concluded that if there is an easy way to perform a masked erase on an SDL_Texture, it would make the drawing operations ...
0
votes
1answer
53 views

Memory-leak around SDL_FreeSurface

When I call my tile engine function, the amount of memory my program uses begins to spike at about 80 - 90 megabytes per second. The memory use continues to go up until the program crashes. The ...
2
votes
1answer
77 views

How does the SDL dynamic API inject itself in statically linked code

I've been using SDL2 for development almost since it came out. Long story short, I stumbled upon the SDL dynamic api explanation. I've looked in SDL_Dynapi.c to understand how it works. I get that the ...
3
votes
1answer
159 views

Fighting Game Camera Positioning in SDL

I'm working on a 2D fighting game (using SDL) much like the original Killer Instinct on SNES. I want the camera to keep both players an equal distance from the left and right sides of the viewport. ...
0
votes
1answer
91 views

Why does my modern OpenGL heightmap render as line segments instead of faces?

I'm brand new to OpenGL and have been trying my hand modern openGL. A few days ago, I tried to create some terrain by using a heightmap stored in a grayscale 32-bit BMP. I am using SDL 2.0, GLEW and ...
0
votes
0answers
47 views

C++ Visual Studio Sprite Animation Function only setting values for certain Rect structs in SDL

I'm making a game in SDL and I am using an Array of Rects to store values of sprite sheet clip's dimensions. When I call the function and pass in one of my sprite sheet textures with it's ...
1
vote
1answer
102 views

Input processing performance

I'm building a game using SDL in Linux platform. Now I want to read user input with SDL_GetKeyboardState, but my doubt is wich is the best way using a thread or a timer. I tried both and I think ...
1
vote
0answers
44 views

Prebuilt SDL and dependencies for Android? [closed]

I've spent two days trying to build a Hello World project with SDL2 on Android, and I'm now extremely frustrated. I've followed several guides and tutorials and there's always some header missing ...
3
votes
2answers
1k views

SDL2 sprite batching and texture atlases

I have been programming a 2D game in C++, using the SDL2 graphics API for rendering. My game concept currently features effects that could result in even tens of thousands of sprites being drawn ...
0
votes
1answer
97 views

OpenGL segfault in DrawElements

I've asked this question on regular StackOverflow but without much success yet. The below program produces a segfault on the call to glDrawElements. I've looked at my max and min index values and they ...
4
votes
3answers
418 views

SDL Multiple keyboard support

I am making a game with multiplayer split screen mode using SDL. Basically, I like the idea of having each player plug in his own keyboard to the PC, set custom controls via options and being able to ...
1
vote
0answers
108 views

OpenGL - Texture disappears

I'm making a simple program with C++, SDL and GLEW. So far it is going great but I ran into a weird problem. One of my four textures would not show up on screen even though it used the same code as ...
0
votes
2answers
68 views

What is the easiest and fastest way to display an SDL_Surface in a window with SDL2?

I would like to have an SDL_Surface representing the contents of the window, just like in the old days with SDL1.2. What is the best and fastest way to do it in SDL2? What I found is that I need an ...
3
votes
3answers
356 views

Should I cap the frame rate in SDL?

I know this question has been asked a lot, but I never found an answer suitable for me. I have a game with a fairly big logic system and the movement system I am currently using is calling ...
0
votes
2answers
109 views

Why can't I load an image with a relative path in SDL2 on Linux?

When loading a texture in SDL2 the general procedure is this: SDL_Texture* texture = IMG_LoadTexture(renderer, "resources/images/image.png); However this doesn't work and I have to supply the WHOLE ...
2
votes
1answer
147 views

What is missing from SDL for it to gain more widespread adoption? [closed]

As I understand, SDL offers abstractions that let you make windows, handle input and audio much easier than doing so directly with the low level APIs provided by several operating systems. However, ...
1
vote
1answer
180 views

SDL render to a texture

I am trying to create a button for my game there are lots of similar buttons so using an image for each one is a bit inefficient. So I want to load an image then copy some text over it and render that ...
2
votes
1answer
35 views

SDL2_ttf gradient

I want to render some text using a gradient instead of a solid color, but I can't figure out how to. I first load a gradient like this: SDL_Surface* gradient = IMG_Load("blue-cian.png"); then I ...
0
votes
2answers
51 views

Is it possible to use an image, sound or font without importing them externally? [SDL2]

It's hard to explain my question, but I will try my best. When loading sounds, images or fonts in SDL2 (with SDL_image, SDL_mixer, SDL_ttf) you need to load them from an external source path. For ...
-1
votes
1answer
186 views

Is SDL2 alone capable of dynamic (or deferred) lighting? [closed]

I'm talking about JUST SDL2, not OpenGL or DirectX. Would drawing deferred lighting bulk the CPU up and how would it be done?
4
votes
3answers
294 views

sdl: unlock mouse in fullscreen mode and make it useable on another monitor

Is it possible to unlock the mouse in fullscreen mode so that you can use it on a another monitor? I read trough the SDL documentation, but I couldn't find anything related to my problem.
0
votes
1answer
341 views

Scaling an SDL Surface

I want to create a button for a game's UI. The background uses a gradient and then I blit a surface on top of the gradient and use SDL_SetColorKey to delete the unwanted pixels. The surfaces are not ...
2
votes
0answers
46 views

SDL_AddTimer + SDL_GL_MakeCurrent not working on Windows [closed]

I'm messing around with C++, OpenGL and SDL doing a game that should be able to run in Windows and Mac OS X. I have a problem that only happens on Windows. Let me describe the scenario. First I ...
0
votes
0answers
74 views

Tile Collision - subtracting a minor value to the box size

I'm having a certain problem when doing collision checks on bounding boxes that have their edges aligned with upper or right tiles. It shouldn't count as an intersection but I don't know a good ...
0
votes
1answer
61 views

SDL Surface clipping mask

I am creating a GUI for my game, so I use some buttons like . So you can see it is only text surrounded by a rectangle. But I currently use a huge png image with all the buttons I need arranged as I ...
1
vote
4answers
532 views

SDL zooming/upscaling without images becoming blurry?

I'm working on a game with 32px tiles and I have one question regarding this and scaling. When I try to see my game fullscreen my image just becomes blurry. I remember playing NES games and when the ...
0
votes
1answer
51 views

Accelerated Motion

I'm making a menu for my game with SDL, when you click on an option a sub menu slides down and is shown, just sliding down is really boring, so I want it to accelerate(like if gravity was pulling it) ...
1
vote
1answer
116 views

Drawing geometry to an SDL_Texture?

As a direct result of this question that I asked a few days ago, I want to draw potentially-complex geometry to a SDL_Texture or, I suppose, an SDL_Surface. Ultimately, I want the foreground of a 2D ...
2
votes
0answers
63 views

How to create a scripted sequence [closed]

Like countless other video games, I'd like to have scripted sequences in my game. Character 1 says something, the player replies, then a rock falls, that sorta stuff. I could find a way to do it, but ...
3
votes
1answer
182 views

Calculate the Intersection of Two Volumes

If you've ever played The Swapper, you'll have a good idea of what I'm asking about. I need to check for, and isolate, areas of a rectangle that may intersect with either a circle or another ...
5
votes
3answers
1k views

Is it a good plan to use 2D physics for a 3D racing game? [closed]

I am working on a 3D racing game using SDL and OpenGL. I thought it would be easier to use a 2D physics engine, since I really don't need the 3rd dimension. There will be no flying cars or jumps, they ...
1
vote
1answer
72 views

How can I scale a subset of my game view during rendering?

I am developing a 2d game which has a lateral panel and a main panel with the scenario. I want to scale the main scenario to apply a zoom (only the main panel portion of the screen). I think if I use ...
0
votes
1answer
599 views

SDL2 window as child of Win32 GUI

I'm building an editor. Is it possible to create a child window of SDL2 within a Win32 gui? (The most obvious page from SDLTutorials works for earlier versions of SDL)
1
vote
0answers
170 views

Which will be better for a beginner, SDL, SFML or OpenGL? [closed]

I want to make games.For now simple 2D games, but I don't know from where to start. I "know" C++, but i havent worked with classes.I want to begin with game development and I searched in the internet ...
-2
votes
2answers
606 views

Which library to choose between SDL and GTK for C game Development (Begginer) [closed]

Note: I know that this is a opinion based question I've been programming in C it's been some time, now I want to get into game development but I'm not sure which GUI library should I use between SDL ...
3
votes
1answer
172 views

How can I implement a dialogue where the words appear as if they were being typed?

I'm planning on putting a dialogue system into my game, I don't really work with surface so my way of implementing SDL_Ttf is by turning it into a texture, in other words, every paragraph would be ...
0
votes
1answer
76 views

Which buffering process would be more efficient?

I'm working on the base engine of my game right now, specifically converting a text file into a level on-screen. As a 2D platformer, each level has an array of rectangles that can be drawn to the ...
3
votes
1answer
130 views

Collision detection in Pong clone

Well I'm trying to create a pong clone using SDL and I had some problems with the frames and some times the ball would go through the paddles despite the fact that at other times the collision worked ...
2
votes
1answer
246 views

When should I use color keying vs PNG transparency?

SDL (and other toolkits) can use color keying to make a certain color in an image transparent. Alternatively, you could load a PNG image that supports transparency. When should I use which?
1
vote
2answers
1k views

How can I render a texture to the screen in SDL2?

I've recently started upgrading my SDL version from 1.2 to 2.0.3, and while on the SDL Wiki, I've come across SDL_Renderer, SDL_Window, and SDL_Texture. I did some research and found a link at ...
2
votes
3answers
312 views

How can I avoid repeatedly setting up SDL in VS 2013?

Do I have to set up SDL 2.0.3 every time I make a new project? I tried putting sdl.dll in system32 so that I don't have to include it in my project folders, but that didn't work.
1
vote
3answers
459 views

Can Simple Direct Media Layer be used with WebGL?

I have read that on desktop OpenGL + SDL is a great way to learn. In looking at WebGL I couldn't find a Web version of SDL. On their site I see bindings for all sorts of languages, but no JavaScript. ...
0
votes
1answer
309 views

Why do I see this “ghosting” effect with my sprite in SDL?

I'm using SDL to create a 2D side-scrolling platformer, but I'm getting ghosting from the sprite. I'm not used to programming with graphics or SDL so excuse any stupid remarks I make. Here's the ...