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

20
votes
3answers
1k views

Multi-platform multi-threading: What are the real challenges?

While a library like SDL provides a cross-platform wrapper API for threading, I think it would be naive to assume that this leads directly to easy development of games across vastly different ...
11
votes
5answers
1k views

What are the benefits of capping frames per second? (If any)

I am working on a simple game in OpenGL, using SDL for display initialization and input, and it appears in terms of timing I have two options available to me. Number one being just sleeping for the ...
11
votes
2answers
2k views

What should I worry about when changing OpenGL origin to upper left of screen?

For self education, I'm writing a 2D platformer engine in C++ using SDL / OpenGL. I initially began with pure SDL using the tutorials on sdltutorials.com and lazyfoo.net, but I'm now using SDL to ...
10
votes
2answers
3k views

Input management techniques in large games

Is there a standard technique for managing input in large games. Currently, in my project, all input handling is done in the game loop, like so: while(SDL_PollEvent(&event)){ ...
9
votes
3answers
5k views

What animation technique is used in 'Dont Starve'? [closed]

While playing a few games in my personal time off development I've stumbled across a survival 2D/3D survival game. The game was apparently made in SDL and GLUT (Dont starve) but what really amazed me ...
9
votes
1answer
581 views

SDL blitting multiple surfaces at once

I'm trying to write a platforming game where the sprites for the level backgrounds are broken up into 512x512 chunks. I keep 3 chunks in memory at a time and I'm trying to write code to blit all three ...
9
votes
1answer
815 views

Why does V8 not run with SDL threads?

i was able to compile and link V8 against my game and code interpretation works fine. However I want to divide my code and the game loop should exist in one thread and the scripting engine should run ...
8
votes
1answer
1k views

Getting OpenGL hardware acceleration with SDL on Linux

I'm trying to use SDL + OpenGL but I don't believe hardware acceleration is working because the framerate for around 18000 polys is about 24fps on a quad core machine but is a hopeless 1-2fps on an ...
8
votes
1answer
1k views

Separating logic/update from render/drawing code in a single thread using sleep

I've read that the speed of game objects should not be hindered by FPS but instead should be based on time. How can I seperate the update/draw code to maximize performance without limiting the drawing ...
8
votes
2answers
1k views

How to deal with OpenGL and Fullscreen on OS X

I do most of my development on OS X and for my current game project this is my target environment. However when I play games I play on Windows. As a windows gamer I am used to Alt+Tab switching from ...
7
votes
1answer
7k views

Time based movement Vs Frame rate based movement?

I'm new to Game programmming and SDL, and I have been following Lazyfoo's SDL tutorials. My question is related to time based motion and frame rate based motion, basically which is better or ...
7
votes
3answers
1k views

What is the contents of the buffer *after* a call to glSwapBuffers()?

(SDL_GL_SwapBuffers() in particular) When you have drawn a scene, and you call swap-buffers, it is routine to then glClear() the scene before drawing anything; if you don't clear, what is the ...
7
votes
1answer
3k views

Turn-based JRPG battle system architecture resources

The past months I've been busy programming a 2D JRPG (Japanese-style RPG) in C++ using the SDL library. The exploration mode is more or less done. Now I'm tackling the battle mode. I have been unable ...
7
votes
1answer
3k views

SDL2 with OpenGL — weird results, what's wrong?

I'm porting an app to iOS, and therefore need to upgrade it to SDL2 from SDL1.2 (so far I'm testing it as an on OS X desktop app only). However, when running the code with SDL2, I'm getting weird ...
7
votes
5answers
591 views

Graphics module: Am I going the right way?

I'm trying to write the graphics module of my engine. That is, this part of the code only provides an interface through which to load images, fonts, etc and draw them on the screen. It is also a ...
6
votes
4answers
3k views

2D Platformer Collision Handling

I am trying to create a 2D platformer (Mario-type) game and I am some having some issues with handling collisions properly. I am writing this game in C++, using SDL for input, image loading, font ...
6
votes
2answers
1k views

Custom extensible file format for 2d tiled maps

I have implemented much of my game logic right now, but still create my maps with nasty for-loops on-the-fly to be able to work with something. Now I wanted to move on and to do some research on how ...
6
votes
4answers
10k views

Wavefront *.obj loader in C++

I'm creating a game using OpenGL (via SDL) and C++ (via Visual Studios 2010 Professional). During the game, I will be using 3D character animation. I'd like to use wavefront *.obj files for all the 3D ...
6
votes
2answers
22k views

Making a 2D Platformer in C++/SDL. Looking for tutorials/examples/resources

I have a lot of experience with C++, but I have no experience with game programming. This summer I plan to create a 2D platformer from scratch using C++/SDL for the learning experience. I am looking ...
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 ...
5
votes
3answers
2k views

What features do basic particle engines have?

I created a basic particle system for SDL in C++. It has some basic stuff like an emitter, as well as a simple particle class. It can load a image, or create a dot of a color. And that's it. What ...
5
votes
3answers
4k 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 ...
5
votes
2answers
285 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 ...
5
votes
3answers
9k views

How to draw 2D images using OpenGL, in SDL?

After everything, I managed to find a simple piece of code that shows how to draw a 2D image with openGL: #include "SDL/SDL.h" #include "SDL/SDL_opengl.h" #include "SDL/SDL_image.h" ...
5
votes
2answers
2k views

Integrate LibRocket With SDL And OpenGL

I been currently involved in a game project and we reach the point we're want to added the GUI for menus and other stuff but the time that we maybe spent developing our own system could cost us a bit ...
5
votes
1answer
386 views

Does SDL running on Mac OS not recognize Xbox controllers?

I'm trying to learn a bit of SDL, and have been bouncing between Windows and Mac platforms, but am noticing that an SDL program running on my Macbook doesn't recognize the presence of the Xbox ...
5
votes
2answers
2k views

How should I manage level progression?

In my code, I just have a Level class right now in the main game loop that just blits a background and spawns some enemies for testing purposes...But I can't figure out how to go about implementing ...
5
votes
1answer
896 views

OpenGL textures loaded with SDL_Image display with no alpha

I am making a game using OpenGL, with SDL_Image employed to load the textures. When drawn on screen, there's no alpha -- in an exact square around the opaque contents of the texture, black is drawn; ...
5
votes
2answers
902 views

Splitting a tetris game apart - where to put time-management?

I am creating a tetris game in C++ & SDL, and I'm trying to do it "good" by making it object-oriented and keeping scopes small. So far I have the following structure: A main with some lowlevel ...
5
votes
2answers
732 views

Rotating object around moving object/player in 2D

I am trying to implement a camera which rotates around the world around the player. I have found many solutions online to the task of rotating an object about the origin, or about an arbitrary point. ...
4
votes
3answers
487 views

Current library situation [closed]

Allright so I've been doing some searches, here what I got: SDL: It is a standard, very mature but very old. (I got posts of late 2009 where they were still waiting for the 1.3 to come up...we are ...
4
votes
1answer
1k views

Game class and main function

I have a Game class with my main game functions and instances of game objects like screen, etc. My game is made using C++ and SDL. I was wondering, though, should main be a function of my class? Or ...
4
votes
5answers
2k views

Does SFML support these specific features that I require?

I've been working on a game in c++ for about a week and a half, and I've been using SDL. However, my current engine only needs the following from whatever library I use: enable double buffering load ...
4
votes
1answer
2k views

Setting up OpenGL 3.3 in SDL 1.2

I've been using SDL 1.2.14 for awhile without using many of the features from newer OpenGL versions. I'm now interested working only with the 3.3 API (not using the deprecated functions, etc... that's ...
4
votes
3answers
3k views

Smooth Sprite Movement - Don't Add Velocity to Position?

I am trying to figure out if there is a way to move a sprite smoothly on the screen at different speeds without stuttering, but keeping the effect that it's moving smoothly; especially at faster ...
4
votes
3answers
403 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 ...
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 ...
4
votes
5answers
836 views

Trying to make a game with C++, using lists to store bullets and enemies, but they are not erased

I've been trying to make a pretty simple space shooter game with C++, and I have been having a lot of trouble trying to use lists to store enemies and bullets. Basically I followed the post here ...
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.
4
votes
1answer
108 views

Key events outside of an SDL application

I'm developing an app under C++ and SDL running in Ubuntu. I'm using the SDL events to handle the keypad buttons. My problem is that my app launch other programs and it should close they with a key ...
4
votes
1answer
500 views

How to use caching to increase render performance?

First of all I am going to cover the basic design of my 2d tile-based engine written with SDL in C++, then I will point out what I am up to and where I need some hints. Concept of my engine My ...
3
votes
3answers
911 views

Unable to detect continuous keypress event in SDL

I am developing a game using SDL, and am unable to do continuous motion for my object when a key is held down. I'm calling SDL_PollEvent() to retrieve all events during a frame, and passing each ...
3
votes
4answers
1k views

Should the main game object be static in c++

I am creating a 2d platformer using SDL and I was thinking that my game object could be static, but I wasn't sure if this was a good idea. The pros (that I can see): Accessing settings options ...
3
votes
4answers
6k views

How can I process continuously-held keys with SDL?

I have created a cube in opengl using SDL. Now I am trying to move the camera in X direction if user presses left or right arrow keys and Y direction if user presses up or down arrow keys. Right now ...
3
votes
3answers
2k views

Gamestate management without evil Singletons

I wanted to use a game state management system similiar to this approach: Managing Game States in C++ But from what I've heard singletons are evil and should not be used in 99.9%. Can you tell me ...
3
votes
3answers
1k views

OpenGL & SDL textures… game shuts down

I'm going to create a game in C++ with SDL & openGL but adding textures won't work. the code is in some different classes. here's the main file ...
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 ...
3
votes
2answers
351 views

How does this background scrolling code work?

I'm glad that this code does exactly what I wanted it to do...But I can't make sense of it although I wrote it from scratch myself. What I wanted to do was create an infinitely scrolling background. ...
3
votes
4answers
3k views

Most effective way to manage a gamestate system that is easy to use?

I just started working on my game, mostly the game management. I plan and using game-states to make the menu's and other stuff easier. My main idea for implementing the game-states is creating a game ...
3
votes
1answer
996 views

What are the performance implications of multiple windows with indivdual OpenGL contexts?

For an engine I'm developing I've decided to allow users to set up multiple windows showing differing views of the same "world." This is being developed using OpenGL (hopefully aiming for 3.2 core ...