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

2
votes
1answer
445 views

Bad FPS for smaller size (OpenGL ES with SDL)

If you saw my other question, well, there is still a little problem: Click here to watch on youtube Basically, the frame rate is very bad on the actual device, where for some reason the animation is ...
0
votes
3answers
336 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?
0
votes
1answer
434 views

2d Game using monotouch?

I'd like to make a 2d game and I like SDL but I don't think there is an SDL for monotouch. Whats the closest solution?
1
vote
1answer
114 views

SDL deleting an image from the screen?

Well, I'm sort of a beginner to SDL, and I was wondering how one would go about deleting an image from the screen and replacing it with another? I attempted to do this, but it didn't seem to change ...
3
votes
2answers
272 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. ...
2
votes
4answers
4k 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 ...
1
vote
1answer
526 views

SDL2 focus lost = massive gain in FPS

Whenever I lose focus from my game window, I go from ~60FPS to 6000+, then when the window gains focus again, I go back to around 60 frames per second. And yes, this happens every time I run my game, ...
3
votes
2answers
236 views

Not So Beginner Tutorial Request

So my game is done for now but every time it flashes on the screen and my game loop is awful. So crowded with logic. I need to learn more about games and how they are running. My idea now is that at ...
-2
votes
2answers
926 views

making a game in 2D(C++). SDL or openGL? Or, why not both? [closed]

I'm trying to make a platform game in 2D and I want to know what tool should I use to make it happen. I understand that I can use SDL with openGL. However, if I want to make a solid 2D platform game, ...
1
vote
1answer
182 views

Implementing a Menu System and Buttons (Waiting in a whle loop)

I have a menu system with four screens and six buttons. I have created a button class and it works great. I even have events for the buttons working. The problem is that I have to run the events ...
0
votes
1answer
546 views

Does SFML render it's graphics using OpenGL internally?

By that, I mean that SFML has an abstraction for OpenGL? Sort of like SDL's blit functions, but using OpenGL internally? "Yes SFML uses OpenGL for all the graphical stuff. " Received this comment ...
0
votes
1answer
201 views

Logic For camera Movement

Every time I move the hero on my screen I increment a screenOffsetX and a screenOffsetY. These add 1 if you move right, -1 if left to the sceenOffsetX. Add the screenOffestY +=1 if down, -=1 if up. I ...
0
votes
1answer
115 views

Help Applying SDL_Surface on an array of SDL_Surface?

I'm trying to make a 4x4 blocks (50x50 px) with SDL Surface. Added another block (50x50 px, I wrote the variable as 'flag') that can only move within the 4x4 blocks, so I can select one of the blocks ...
0
votes
2answers
221 views

Map is rendering too slow

I have a basic 20x20 array that stores the map for my game. It either has a 1 or 0 to say a path and a non path. When I draw it on the screen, It seems to take to long to draw one at a time and looks ...
2
votes
3answers
897 views

How can I measure the execution time of some code?

How can I capture how long something takes to complete and log it to the output window (in Visual Studio)? Is there a special library for this? clock_t start, end; double cpuTime; start = clock(); ...
-1
votes
2answers
232 views

My 2D collision code does not work as expected. How do I fix it?

I have a simple 2D game with a tile-based map. I am new to game development, I followed the LazyFoo tutorials on SDL. The tiles are in a bmp file, but each tile inside it corresponds to an internal ...
1
vote
2answers
223 views

How do I cap rendering of tiles in a 2D game with SDL?

I have some boilerplate code working, I basically have a tile based map composed of just 3 colors, and some walls and render with SDL. The tiles are in a bmp file, but each tile inside it corresponds ...
-1
votes
3answers
182 views

SDL_BlitSurface segmentation fault (surfaces aren't null) [closed]

My app is crashing on SDL_BlitSurface() and i can't figure out why. I think it has something to do with my static object. If you read the code you'll why I think so. This happens when the limits of ...
4
votes
1answer
105 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 ...
1
vote
0answers
80 views

SDK mouse relative motion, weird results

I have a simple SDL application that tracks the relative change in mouse position But for some reason, the motion.xrel and motion.yrel give back massive numbers! my code: ...
3
votes
2answers
944 views

How to hide assets from user? ( e.g.: a png file )

I think the title is quite self-explaining, still this is a big area I think, so let me drop a few words: I've got a simple experiment game project going, and I want to make sure, that the user isn't ...
1
vote
0answers
340 views

How to pick a 3D object with known mouse coordinates if the camera is rotated 60 degrees?

I am making a simple game engine for a simple RTS game and would like to be able to pick a cube and move it around with the mouse coordinates. The problem is that my camera is rotated 60 degrees just ...
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 ...
1
vote
3answers
386 views

SDL_image & OpenGL Problem

i've been following tutorials online to load textures using SDL and display them on a opengl quad. but ive been getting weird results that no one else on the internet seems to be getting... so when i ...
0
votes
5answers
558 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, ...
2
votes
3answers
516 views

SDL_DisplayFormat works, but not SDL_DisplayFormatAlpha

The following code is intended to display a green square on a black background. It executes, but the green square does not show up. However, if I change SDL_DisplayFormatAlpha to SDL_DisplayFormat ...
2
votes
1answer
164 views

How to alter image pixels of a wild life bird?

Hello so I was hoping someone knew how to move or change color and position actual image pixels and could explain and show the code to do so. I know how to write pixels on a surface or screen-surface ...
1
vote
2answers
6k 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 ...
9
votes
1answer
474 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 ...
0
votes
1answer
521 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
1answer
266 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 ...
3
votes
1answer
256 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 ...
10
votes
2answers
1k 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 ...
8
votes
2answers
841 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 ...
0
votes
1answer
308 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 ...
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 ...
3
votes
2answers
166 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 ...
0
votes
3answers
897 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 ...
5
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
4answers
1k 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 ...
1
vote
1answer
424 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 ...
4
votes
1answer
405 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
343 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
829 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 ...
2
votes
2answers
214 views

Problem with SDL_Mixer/MikMod playing XM files properly

Some of the music I've made for my game have note bends in them (1xx Portamento up)...The problem is that when they play in my game, the note bends and then goes right back to original note instead of ...
1
vote
1answer
207 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 ...
2
votes
3answers
490 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
496 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 ...
5
votes
3answers
1k 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 ...