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

Why (SDL) animated filled-circle leaves trail of movement?

I'm trying to achieve proper animation using SDL. Used flags are SDL_HWSURFACE and SDL_DOUBLEBUF. That what I'm getting is technically smooth (I think), but I can figure out what should I do to ...
0
votes
2answers
224 views

joystick movement for Geometry Wars clone

I am kinda new in game programming, but I've got a semestral work to make a game, so I decided to do a clone of Geometry Wars. Despite that the game is really simple (in principle), I have ran into a ...
1
vote
1answer
286 views

SDL_Image and typical SDL BMP loading fails completely

been messing with OpenGL and SDL for a pair of weeks. The thing is quite weird. I have been loading a texture from a BMP and using a really easy shader to make it work, and so far it has worked very ...
4
votes
3answers
237 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.
3
votes
3answers
702 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 ...
0
votes
1answer
286 views

SDL_types.h file not found using xcode

Getting this error when trying to use SDL_mixer... SDL_types.h file not found.. I am including all the correct files as far as I can tell and have included the frameworks (both SDL and SDL_mixer) ...
1
vote
2answers
609 views

My SDL Game executable cannot run outside codeblocks

After compiling and running SDL programs successfully inside CodeBlocks, when I run them outside CodeBlocks (by clicking .exe file) my program does not run. Instead, it says that libstdc++6.dll is ...
4
votes
3answers
2k 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 ...
-2
votes
1answer
342 views

SDL_BlitSurface does not works

I have an issue with the SDL_BlitSurface... When I blit (SDL_BlitSurface) in a transparent (background) surface, it does not blits, actually I tried all the existants functions ...
2
votes
1answer
2k views

Is basic SDL hardware accelerated?

I'm going over some SDL tutorials aimed at creating 2D games. However, when I create a basic SDL program - is it hardware accelerated? Or is hardware acceleration only relevant when it comes to 3D ...
1
vote
3answers
355 views

Can Simple Direct Media Layer be used with WebGL?

I have read that on desktop OpenGL + SDL is a great way to learn. In looking at WebGL I couldn't find a Web version of SDL. On their site I see bindings for all sorts of languages, but no JavaScript. ...
0
votes
1answer
228 views

SDL.NET vs SDL C++

I am currently transitioning from XNA to SDL, and was wondering if SDL.NET provides the same benefits as SDL C++. Considering that SDL.NET uses the .NET framework as a wrapper to the SDL base ...
1
vote
1answer
131 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
305 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. ...
1
vote
1answer
549 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, ...
-2
votes
2answers
1k 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
194 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
597 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 ...
4
votes
3answers
7k 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" ...
2
votes
3answers
1k views

How should I store levels in a C++ game?

I am writing in C++. I am storing game levels as a 2-dimensional int array. This may be a hacky way of doing things, but I am not ready to change it unless I have to. I store values in the array and ...
0
votes
1answer
129 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 ...
1
vote
4answers
2k views

Rendering multiline text with SDL_TTF

Can you use any function to render more than a line of text in a surface? If you can't do this, what whould be the way to go? I am doing the following: Create a surface (not sure if should be a ...
0
votes
1answer
207 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 ...
2
votes
3answers
1k 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(); ...
0
votes
2answers
230 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 ...
3
votes
2answers
244 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 ...
-1
votes
2answers
254 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
249 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 ...
0
votes
2answers
1k views

Is there an alternative to SDL 1.3 for a C++ game that should run on iOS and Android?

I've used SDL for many desktop games, always as the cross-platform glue for: Creating a window Processing input Rendering images Rendering fonts Playing sounds/music It has never disappointed me ...
4
votes
1answer
107 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
votes
3answers
216 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 ...
8
votes
3answers
4k 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 ...
1
vote
0answers
379 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 ...
2
votes
1answer
477 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 ...
1
vote
3answers
500 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 ...
2
votes
3answers
592 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
167 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 ...
9
votes
1answer
521 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 ...
3
votes
2answers
1k 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 ...
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 ...
0
votes
1answer
460 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?
3
votes
1answer
278 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
339 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
283 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
996 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
659 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
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 ...