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

0
votes
1answer
31 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
19 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
59 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 ...
2
votes
2answers
111 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
21 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
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 ...
0
votes
1answer
32 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) ...
2
votes
0answers
49 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 ...
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 ...
0
votes
1answer
101 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
24 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
87 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 ...
3
votes
1answer
136 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 ...
-2
votes
2answers
99 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 ...
0
votes
1answer
68 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 ...
0
votes
1answer
67 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
106 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
3answers
174 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
1answer
56 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
35 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
120 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
49 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
45 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 ...
4
votes
3answers
213 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
110 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
260 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 ...
3
votes
1answer
165 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 ...
1
vote
3answers
260 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 ...
2
votes
1answer
156 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
251 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 ...
0
votes
2answers
51 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
1answer
220 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 ...
0
votes
1answer
169 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
83 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 ...
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
63 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 ...
1
vote
0answers
61 views

SDL_FillRect() causes access violation on palletized surface with specific inputs [closed]

SDL2-2.0.1, Windows 7, MSVC 2008. Originally saw this problem with the release SDL libs, debugging now with the development libs. Following is the entire program I'm running, minus error checking for ...
1
vote
1answer
420 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
2answers
70 views

Collision detection in seemingly random locations [closed]

I have a square that moves around with user input and should return to top left of screen when it collides with one of the rectangles on the screen. It works fine when the the rectangles are not ...
1
vote
2answers
102 views

SDL sprite animation problem

I'm currently drawing my character from a single file, and my sprite class handles it taking the file path as an argument. Now, I need to add a simple animation, cycling between two frames. The ...
0
votes
1answer
172 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. ...
1
vote
1answer
102 views

How to manage screen and input when using libSDL2 for both desktop and Android?

I have worked on libSDL1.2. Since, the release of 2.0, SDL also supports android. So, I am trying to develop game that can work both on desktop and android. But there are few things that are confusing ...
0
votes
1answer
125 views

Drawing Colored Geometry in OpenGL using SDL

First off, I will confess I have asked the same question on stackoverflow, but I think this forum might be a better fit. I am trying to combine 2 things using SDL: Draw a webcam feed via an ...
0
votes
1answer
97 views

Why does my SDL code crash when I move the mouse over the window?

Whenever I move my mouse below where the image renders in my game, the SDL window crashes and closes down. I have narrowed the crash down to the bit of code where I check to see if the Escape key ...
3
votes
1answer
193 views

How to convert a SDL window to a SDL surface? SDL 2

I am trying to make a paint program and there is a sdl function called IMG_SavePNG() which requires a surface and destination file. How can I turn what I see in the window to a surface?
0
votes
1answer
217 views

Texturing a PyOpenGL 3D Cube with PySDL2

So, I've just started learning OpenGL with PySDL2, and I've created a class that will create a cube to the window that I've created with PySDL2. What I'd like to do now, is to figure out a way to ...
1
vote
1answer
105 views

Update and Render logic with interpolation

I am working with C and SDL2 and just wanted some insight as to how to properly apply interpolation to the rendering. EDIT - some clarification, update() input() and render() are just hypothetical ...
1
vote
0answers
134 views

Im getting LNK2019 errors using SDL 2.0.1 in visual studio 2013 [closed]

Here are the error codes and Here Is the link to all the code: Error 5 error LNK2019: unresolved external symbol WinMain@16 referenced in function __tmainCRTStartup ...
0
votes
1answer
162 views

How to handle simultaneous mouse and keyboard input with sdl?

I'm making a game in SDL2 that so far is basically just a top down shooter, where the player aims at the mouse. When I run the game, you can move properly and shoot properly, and shoot and move the ...
1
vote
1answer
84 views

Multiple keys being pressed, some being ignored SDL

I'm making a two player pong clone and my problem is that when the second player presses both of his/her buttons at once, the first player locks up and cannot move, even though this does not happen ...