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
460 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
0answers
13 views

Issue setting a MonoGame project from scratch on linux [on hold]

I'm using monodevelop 5.1, along with MonoGame 3.2. This is all in Ubuntu 14.04. Since I wasn't able to add the MonoGame template to monodevelop (maybe because my mono runtime has been compiled from ...
-1
votes
0answers
26 views

How to get 3D objects using Visual C++ | OpenGL | SDL | Blender [on hold]

How to get 3D objects using Visual C++ | OpenGL | SDL | Blender Hi, I have been searching for a tutorial(s) witch corresponds or my specific desire but I had no luck, any suggestions? Thanks.
1
vote
1answer
90 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, ...
0
votes
1answer
21 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 ...
1
vote
1answer
17 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
25 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
42 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
235 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.
2
votes
2answers
121 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
1answer
37 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
25 views

SDL_AddTimer + SDL_GL_MakeCurrent not working on Windows

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
61 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
26 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 ...
0
votes
2answers
53 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.
1
vote
0answers
13 views

Input handling system using the command pattern [migrated]

The online book Game Programming Patterns briefly describes the use of the command pattern to handle input in a game. I've attempted to write my own "one size fits all" input handling system based on ...
1
vote
4answers
228 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
33 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) ...
0
votes
1answer
70 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
51 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
140 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
58 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
143 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
26 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 ...
1
vote
0answers
93 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
123 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
168 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
69 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
108 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
166 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
302 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
183 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
350 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
276 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 ...
0
votes
1answer
36 views

Text not being rendered until I recreate the text class in SDL

I made a Text class, it is as shown below: Text::Text(const int score, const float &x, const float &y, const float &w, const float &h, SDL_Renderer *rend) { font = ...
0
votes
1answer
122 views

Having issues with pong physics, is my approach wrong?

I've been working on a pong clone, i've made games in the past but they have all been very hacky. This time I was trying to go for a better approach in terms of using OOP or patterns. So far the games ...
1
vote
1answer
50 views

Multiple keypresses causing wierd results in SDL

I have been building a pong clone. I've been using a mixture of peoples different code to understand the way they structure their games as well as reading on game patterns. Currently I've gotten to ...
0
votes
0answers
48 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
241 views

Scrolling with SDL2 & Box2d - My Camera isn't keeping up with my player

I'm trying to get a game on the google play store before I'm 40 (long held dream to publish a game since the days of the speccy), I have just over a month to go so it's not looking good! Foolishly I ...
4
votes
3answers
226 views

Make openGL program only update every 1/60 seconds

I'm learning C++ and openGL and have this program as a result from tutorials and playing around. The problem is that the main loop is running at "full speed", making the program unnecessarily cpu ...
1
vote
1answer
114 views

SDL_GameController automatic detection

Here's something that's been bugging me all day: Controller detection in SDL. First thing is that it doesn't automatically detect when a controller is connected. Finding out when a controller is ...
5
votes
2answers
261 views

Do I really need to clear the renderer every iteration?

Just a quick question about fine-tuning/optimization. If I'm making a 2D platformer with a parallax-scrolling background (meaning no two frames are the same) do I really need to clear my renderer for ...
1
vote
3answers
282 views

How can I implement a main menu?

I have been following the tutorials at http://lazyfoo.net/tutorials/SDL/index.php and although they are all very well written and I have learned more than I would have on my own, I am not sure how to ...
0
votes
1answer
178 views

Why does this code to filter events with SDL not function properly?

According to the SDL2 wiki, SDL_SetEventFilter : Use this function to set up a filter to process all events before they change internal state and are posted to the internal event queue. ...
0
votes
1answer
182 views

Render two images to an SDL_window

I want to create a menu for an SDL game, so I load an Image to an SDL_Window as the background, then I try to load the next image which will be a button but it doesn't display the button to the ...
1
vote
1answer
88 views

Background color gradient with SDL

I want to create a menu for a game using a color gradient as the background. Is there a way to create a gradient background instead of using an image for it (since I don't know what size the window ...
5
votes
3answers
3k views

Trap mouse in SDL

How can I trap the user's mouse inside my game? It's not a fullscreen game, but I want it so that the user cannot drag the mouse to outside the screen. Do I have to check the coordinates of the mouse ...
1
vote
0answers
50 views

How do I make a game object move at an angle in an integer-indexed grid? [duplicate]

I'm making a game in SDL2 and C++. I want a way to make any game object move in a specific direction. I've thought of assigning each object a direction in radians, from 0 until 2 PI where 0 would ...
0
votes
1answer
66 views

Events management using SDL 2.0

I wrote a simple SDL program using SDL 2.0. I have a little problem when I want to check the mouse wheel events. Actually, in the version 2.0 the flags SDL_BUTTON_WHEELDOWN and SDL_BUTTON_WHEELUP no ...