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

3
votes
1answer
295 views

How do I multiply pixels on an SDL Surface?

Okay so I'm able to put blank pixels into a surface and also draw gradient pixels rectangles,etc But I don't know how to multiply the pixels on a surface so I was hoping someone could provide me ...
-2
votes
4answers
2k views

Trying to figure out SDL pixel manipulation?

Hello so I've found code that plots a pixel in an SDL Screen Surface : void putpixels(int x, int y, int color) { unsigned int *ptr = (unsigned int*)Screen->pixels; int lineoffset = y * ...
0
votes
1answer
363 views

Data-driven animations

Say you are using C/SDL for a 2D game project. It's often the case that people use a structure to represent a frame in an animation. The struct consists of an image and how much time the frame is ...
1
vote
1answer
291 views

SDL: How would I add tile layers with my area class as a singleton?

I´m trying to wrap my head around how to get this done, if at all possible. So basically I have a Area class, Map class and Tile class. My Area class is a singleton, and this is causing some ...
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 ...
0
votes
3answers
1k views

graphical interface when using assembly language

I want to learn a framework to use in assembly. I know that's not possible without learning the framework in C first. So I'm thinking of learning SDL in C and then teach myself how to interpret the ...
0
votes
5answers
707 views

How to implement the light trails for a tron game?

Well I was creating a TRON style game, but had an issue with creating the actual light trails for the game. What I'm doing currently is I have an array the same size as my window in pixel size, ...
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 ...
1
vote
1answer
471 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
475 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
439 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
179 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
236 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 ...
4
votes
3answers
398 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
363 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
536 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
150 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
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 ...
4
votes
3answers
456 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
652 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 ...
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 ...
0
votes
1answer
374 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
795 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
328 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
688 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
335 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
207 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
8k 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
551 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
607 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
503 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
4k 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
687 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
898 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
322 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
192 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
194 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
325 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
881 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 ...