Tagged Questions

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

0
votes
1answer
66 views

SDL - BlitSurfaced Background Slowing Time Based Movement

Whenever I use BlitSurface to apply a background image, the movement of my characters is slowed drastically even though I have movement based on time: SDL_BlitSurface( background, camera, screen, ...
-1
votes
1answer
56 views

Reverting the view SDL

So in my SDL application, which I setup for OpenGL, if I were to do the following code: glBegin(GL_QUADS); glVertex2i(0, 0); glVertex2i(50, 0); glVertex2i(50, 50); glVertex2i(0, 50); glEnd(); The ...
1
vote
2answers
4k views

How to implement SDL Button/Menu GUI with callbacks?

I have been reading Bjarne Stroustrup's Programming Principles and Practice Using C++ for a while now and am nearing the end of the book. I have to tried to make a very simple game using the SDL ...
0
votes
1answer
59 views

SDL text or additional images not loading

I've got a basic side scroller that allows the user to run and jump around. I've used various tutorials to get this far, but I can't seem to get any text to render, no matter what method. I also can't ...
2
votes
1answer
1k views

Trap mouse in SDL2

When using SDL 1.2 it the way to implement full screen or windowed applications with "no cursor" you did the following: SDL_ShowCursor(SDL_DISABLE); SDL_WM_GrabInput(SDL_GRAB_ON); See Trap mouse in ...
5
votes
1answer
369 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 ...
-1
votes
1answer
484 views

OpenGL/SDL2 window stopped rendering [closed]

I have been working on a game engine for a couple of days now and I've had it rendering a colourful cube and playing sounds in OGG format, but, after refactoring my code-base to make things easier; it ...
-1
votes
1answer
334 views

SDL Access Violation

I've created a SDL game project and this window popped up while trying to compile: First-chance exception at 0x00000000 in SDL_Game.exe: 0xC0000005: Access violation executing location 0x00000000. ...
-4
votes
1answer
253 views

C++ SDL/SFML advancing help [closed]

I've been playing around programming using SDL and SFML for a while now and done all the basic tutorials I can find(love lazyfoo). but I'm stuck and not sure how to move on from simple games like ...
0
votes
1answer
302 views

Why do I see this “ghosting” effect with my sprite in SDL?

I'm using SDL to create a 2D side-scrolling platformer, but I'm getting ghosting from the sprite. I'm not used to programming with graphics or SDL so excuse any stupid remarks I make. Here's the ...
3
votes
1answer
354 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
244 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
336 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
279 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
855 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
322 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
714 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
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 ...
-2
votes
1answer
369 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
433 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
247 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
150 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
336 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
577 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
202 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
663 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 ...
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" ...
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
145 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
213 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
242 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
255 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
263 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
270 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
239 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 ...
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 ...
1
vote
0answers
425 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
510 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
636 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
704 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
171 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
572 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 ...