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
450 views

Lost transparency in SDL surfaces drawn manually

I want to create SDL_Surface objects for each layer of my 2d tile-based map so that I have to render only one surface per layer rather than too many tiles. With normal tiles which do not have ...
1
vote
4answers
2k views

SDL - Getting a single keypress event instead of a keystate?

Right now I'm working on a simple SDL project, but I've hit an issue when trying to get a single keypress event to skip past a splash screen. Right now, there are 4 start-up splash screens that I ...
4
votes
1answer
443 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 ...
2
votes
1answer
386 views

How do I play music at half speed?

I'd like to slowdown music playback, say at half speed. I'm currently using SDLmixer. I assume I'd need to tell SDL that I have a 44KHz music and want to stream it at 22KHz, but when I pass in 22Khz ...
2
votes
2answers
1k views

Can't get simple OpenGL texture working using SDL2 and FreeImage3

I created a simple OpenGL program that display a quad with texture, but it doesn't seem to be working as it only displays a white quad. What could possibly be wrong? I checked everything I could think ...
3
votes
2answers
175 views

Best way to distribute graphics, audio and levels with an SDL game?

I'm working on finishing up a game written in C++ with SDL I've been working on for awhile, and I'm starting to ponder how I'm going to distribute it. It has hundreds of images that are loaded and ...
1
vote
1answer
221 views

Do SDL surfaces get reused?

In SDL, lets say I'm rendering text to a surface. Then I blit it with the scene's main surface to form a composite image to flip. I get the text surface into a class-level member called ...
2
votes
1answer
2k views

Does Macbook Air 2012 (Intel HD4000) support GLSL 1.3+?

I'm using SDL2 and GLEW on OSX Mountain Lion (2012 Macbook Air) to create an OpenGL context. Querying for the GLSL version, it reports GLSL version 1.2. I'm curious if this is a limitation of the ...
3
votes
2answers
354 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 ...
0
votes
3answers
353 views

Dynamic Sprite Scaling in SDL?

I was wondering if I could get a player sprite effect similar to the one in this video using SDL (without openGL). If not, does anyone know how I might achieve that effect using SDL/OpenGL?
2
votes
3answers
518 views

Should I dedicate a single thread to each player in a split-screen game?

I was thinking about making multiplayer version of a game I am making with SDL and OpenGL. It would be a split-screen game. Do you think it would be a good idea to have each part of the screen (game ...
1
vote
1answer
145 views

SDL surface inside another GUI component?

Is there a way to host an SDL surface inside another GUI component so that SDL is not at the top-level? For instance, could I put an SDL surface inside a Java JPanel or other widget?
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
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 ...
4
votes
3answers
433 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 ...
1
vote
1answer
578 views

SDL Parallax Scrolling along two axis

I'm trying to implement Parallax scrolling in two dimensions using SDL, but I've run into an issue using SDL_BlitSurface() to blit my layer images to the screen buffer. The images I'm using for this ...
2
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 ...
0
votes
1answer
331 views

C++ and SDL Trouble Creating a STL Vector of a Game Object

I am trying to create a Space Invaders clone using C++ and SDL. The problem I am having is in trying to create Waves of Enemies. I am trying to model this by making my Waves a vector of 8 Enemy ...
4
votes
5answers
749 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 ...
-1
votes
2answers
302 views

FreeType2 Crash on FT_Init_FreeType

I'm currently trying to learn how to use the FreeType2 library for drawing fonts with OpenGL. However, when I start the program it immediately crashes with the following error: "(Can't correctly start ...
-3
votes
2answers
631 views

Starting Game Programming in C++, where to begin for optimal cross-platform development? [closed]

I wish to begin learning game development in C++. I have knowledge in syntax and the console using Visual C++ 2010, however I want to begin programming. My only problem is that I want to be able to ...
1
vote
2answers
320 views

Recasting and Drawing in SDL

I have some code that essentially draws a column on the screen of a wall in a raycasting-type 3d engine. I am trying to optimize it, as it takes about 10 milliseconds do draw a million pixels using ...
1
vote
0answers
200 views

Ruby/SDL vs. RUDL [closed]

I'm interested in using Ruby for 2D games. I have to pick between Ruby/SDL and RUDL, both of which are Ruby SDL wrappers. Which is better? Better means "less bugs" and "more usable," although the ...
1
vote
2answers
7k views

SDL for 3D game programming?

I have been studying SDL for a few weeks and I have succeeded in making a 2D Ping-Pong game, but I want to get started in 3D development, and I'd like to know if SDL is capable (and suitable) for 3D ...
1
vote
1answer
2k views

SDL & Windows 8 Metro WinRT

I am just beginning to dip my tow into game programming and have been reading up on SDL, SFML, OpenGL, XNA, MonoGame and of course DirectX. (Needless to say there are a lot of choices out there) As ...
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 ...
1
vote
1answer
535 views

Is SDL too low level for a beginner?

I am getting started in game development. I started by learning SDL because it seems before I start developing big games, I have to start with the most basic stuff, like Tetris or Snake. I was ...
7
votes
1answer
2k 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 ...
0
votes
1answer
553 views

Generate texture for a heightmap

I've recently been trying to blend multiple textures based on the height at different points in a heightmap. However i've been getting poor results. I decided to backtrack and just attempt to recreate ...
1
vote
4answers
484 views

How to run my game outside of visual c++

I am having trouble running my game. It works fine when I run it from Visual C++, but when I try to open the .exe, it complains that it can't find SDL.dll. What should I do in order to play the game? ...
1
vote
1answer
1k views

Displaying a grid based map using C++ and sdl

I am trying to create a roguelike game using c++ and SDL. However, I am having trouble getting it to display the map, which is represented by a 2d array of a tile class. Currently, my code is this: ...
0
votes
4answers
3k views

Problem trying to lock framerate at 60 FPS

I've written a simple class to limit the framerate of my current project. But it does not work as it should. Here is the code: void FpsCounter::Process() { deltaTime = ...
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 ...
0
votes
1answer
628 views

SDL and software/hardware rendering. How to go about it?

I know that SDL 1.2 does software rendering (CPU) and not hardware rendering (GPU). My question is, how do I use SDL but with hardware rendering? How do I not use its rendering API (software) and ...
0
votes
1answer
834 views

SDL mouse wheel not picking up

Running Ubuntu 11.04, SDL 1.2 trying to pickup mouse wheel up/down movement with this (stripped down) code: int main( int argc, char **argv ) { SDL_MouseButtonEvent *mousebutton = NULL; ...
2
votes
1answer
319 views

Draw Bug 2D player Camera

EDIT *Along with the Palindromes helpful response, I found that my bug was because I was calculating the camera coordinates in terms of tiles instead of pixels which caused the irregular motion.* I ...
2
votes
0answers
189 views

What is causing this behavior with the movement of Pong Ball in 2D? [closed]

//edit after running it through the debugger it turned out i had the display function set to x,x...TIL how to use a debugger I've been trying to teach myself C++ SDL with the lazyfoo tutorial and ...
0
votes
2answers
192 views

Can I create a SDL_Surface as I do with Allegro?

Using allegro I can create a Bitmap to draw just doing: BITMAP* bmp = NULL; bmp = create_bitmap(width,height); // I don't remember exactly the parameters I'm using SDL now, and i want create an ...
1
vote
1answer
315 views

Is SDL conducive to detailed 2D in-Game Animation and intricate particle effects?

Is SDL (when used CORRECTLY) conducive to detailed in-Game animation and displaying interesting high quality particle effects? If my question seems too vague, at the other end of this link I have an ...
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 ...
1
vote
2answers
809 views

Why do I get a segmentation fault on launch with this code?

I am currently writing a pong clone in C++ with SDL on top. Currently, I have hit a roadblock. If I add a new variable, my game won't launch, and will give "segmentation fault" in the debug terminal. ...
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 ...
0
votes
5answers
692 views

Is the way I remove objects causing a memory leak?

The game I'm working on consumes memory, and the memory used in megabytes increases around 2MB every 4 seconds. It starts at 5MB and grows to hundreds of megabytes in minutes. I was careful, and ...
0
votes
2answers
899 views

C++ and SDL resource management for 2D game

My first question is about stateManagers. I do not use the singleton pattern (read many random posts with various reasons not to use it), I have gameStateManager which runs the pointer ...
0
votes
1answer
2k views

SDL, SFML, OpenGL, or just move to Java [closed]

I recently started a new project, and I'm wondering if I should change the technology now before it's too late. I'm using SDL with C++, I have around 6 classes, and the game is going alright, but I ...
1
vote
1answer
356 views

Why does my 2d collision and movement not work properly?

I'm trying to write(in c++ using sdl) a mario like game as in a tile based world with by pixel movement for the character and I've run into some problems I cannot seem to find the source of: 1.The ...
3
votes
2answers
267 views

Defining and selecting an area from an image

I want to create a game, where the world is loaded from an image file, much like Paradox Interactive does it for their games. If I have this image: Then the red, green, blue, cyan, magenta, white, ...
2
votes
1answer
923 views

SDL and OpenGL resize window event question

So basically my question is im making a 2D game with openGL and SDL. So what im trying to do is resize the game and have the openGL quad scale to the size my window becomes. void CApp::OnResize(int ...
0
votes
1answer
933 views

What's wrong my code to create a GL texture from an SDL_Surface?

I have an issue here with converting an existing SDL_Surface into an OpenGL texture. The texture gets created, but it's a plain white texture, below is a screenshot of the result: It seems to me ...
3
votes
1answer
891 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 ...