SDL - Simple DirectMedia Layer 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. It is used by MPEG playback software, emulators, and many popular games, including the award winning Linux ...

learn more… | top users | synonyms

3
votes
1answer
74 views

SDL game: Snake clone

I've been coding for about two months, and I recently attempted my first game. I'd appreciate any advice or feedback on how to improve my coding. For instance, I don't think the organisation is the ...
2
votes
1answer
47 views

Makefile and object file directory

Ok this is the first makefile I've ever written. I it works and that's about it. Things that I was wondering if if I can specify where the object files go. It looks really bad with all the .o files ...
6
votes
1answer
123 views

Conway's game of life in C++ with SDL

This is my attempt at a basic implementation of GOL. The user can add and remove cells with the mouse and some basic stats are printed to console. Any feedback is welcome, but I have a couple of ...
3
votes
1answer
83 views

Pong game with a random twist

I made a simple Pong game using SDL2, with a twist: You don't get to play :), only the 2 AIs get to. ;) Because Pong is a very small game, I put everything in a single file (...
3
votes
1answer
56 views

Simple image loader using SDL and C++

I have been coding Java for 5+ years and before that did a little professional C. Picking up C++ again for the fun of it and I feel like I am just writing Java in C++ rather than understanding the C++ ...
2
votes
2answers
118 views

Making a Pong ball reflect off the paddle

I am currently making Pong in C++/SDL2 and after a while of tinkering, I have come up with a solution! This function gets the hit position and returns the necessary direction change: ...
1
vote
1answer
48 views

Initializing a game in SDL

I have recently learnt about RAII and exceptions and I have been trying to implement them into my code, but I have met an impasse. With this code here what I am trying to do is manage everything that ...
4
votes
2answers
197 views

C++/SDL2 “Space Invaders”

My biggest issue in this project was the structure of the code and using the necessary data structures. I organized it to the best of my ability but I am sure there much more room improvement and I ...
1
vote
0answers
349 views

Open a window and render to it a texture

I'm new to C++ and SDL2. I made this program that makes a window. I want to make sure I'm implementing this in the most sensible way possible. I've been learning for free from online tutorials, so I ...
7
votes
0answers
127 views

Fluid Simulation with SDL

I have always wanted to write a fluid simulation, and with the help of a paper and some StackOverflow users I've got something that works. My goal is to have a program that someone can run right away ...
15
votes
1answer
330 views

Battle Tanks game

I created a simple 2D game that I made for myself in C++ with SDL2.0 + OpenGL + Box2D, but I'm insecure about the code and structure because I developed the game using everything I've learned on the ...
4
votes
1answer
85 views

Sprite cache and Directory reader

I have been fiddling around with creating my own Sprite Cache. Currently, I am using the C header file, dirent.h, to open up a directory and load all .bmp files. I ...
2
votes
1answer
188 views

Keyboard input class

I am looking for advice on my input component. There is no real problem with it yet, but I am just getting started on everything and want to know if there is any obvious problems with it, plus I was ...
4
votes
2answers
402 views

SDL Input Managment

I've created an SDL input manager for my 3D OpenGL applications. It's not finished yet, but I would like to know if I'm doing it the right way. I really tried to optimise and compact my code, as it ...
3
votes
3answers
330 views

C++ Keyboard Controller

I've written a Controller for the keyboard so that I can map certain keys to callbacks within a game. A key can only call one callback, but a callback can be called by many keys. Currently, a ...
2
votes
1answer
228 views

Texture managing with smart pointers

I have an SDL_Wrapper which is working perfectly (it is not broken)! Please suggest how I could improve performance, and how I could make my ...
2
votes
2answers
377 views

Creating an optimized, fully functional TextureManager in SDL

After I've discussed pointer semantics with Loki Astari previously, I finally managed to code the TextureManager class using auto_pointers. But the problem is that ...
2
votes
2answers
458 views

Using std::vectors to store textures

I need to write a TextureManager class which stores Texture objects; the problem is I'm using an ...
1
vote
2answers
105 views

C++ Disposing Textures

Recently, I've asked in a code review if my code was causing any pointer related issues. They mentioned that I had problems with my dispose method. Basically, I'm disposing textures from a texture map,...
5
votes
4answers
2k views

Texture managing

I'm new to C++ and SDL, and I've written a Texture manager class whose purpose is to help me manage sprites and other textures. I have a ...
5
votes
1answer
228 views

Flexible generic event system that binds to objects

I have been trying to create an event queue system using SDL. I've been trying to use this for Pong. The game is not even finished yet, but I stopped work to examine how my event system is organized. ...
5
votes
2answers
134 views

Tile rendering/position updating performance

The code below grabs the contents of a .txt file, and scans each character of it, using that data to create a tile set. My main concern, is that for each loop, I am opening and closing a file each ...
2
votes
3answers
254 views

Pong game with AI

I have written a pong game in C++ using SDL2.0 for the graphics. I have a couple of questions regarding this code: How can I make the AI better, in such a way that it is actually dumber? Right now, ...
11
votes
2answers
999 views

Simon Says / Four tiles game, with C++ and SDL

My take on the Prebash Challenge, "Simon Says" game, in less than 300 lines of C++ (plus the header file), using SDL for window management and drawing. simon_says.hpp: ...
6
votes
1answer
1k views

Collision-detection for an SDL game

I am working on a simple SDL game in C++. I want to make my collision detection implementation better. Here's the complete project: ...
6
votes
2answers
169 views

Diagonal gradient optimization

With the SDL library, I'm creating an SDL_Surface* at w and h dimensions. ...
6
votes
3answers
710 views

SDL/C++ Pong clone

This is my first time writing a game in C++/SDL and I decided to post the code here so you can tell me what I am doing wrong. main.cpp ...
6
votes
2answers
3k views

Pong game written in C++ and using SDL 2.0 (part 2)

I have previously asked here for a review of my Pong game. Since then I have implemented most of the recommendations but I'm not sure I did so correctly, the result can be found on my github. Would ...
21
votes
4answers
15k views

Pong game using SDL 2.0

I've just finished writing my first game: a clone of the classic Pong game for Linux and Mac only. You will need SDL 2.0, SDL_ttf 2.0 and SDL_Mixer 2.0 to compile it. The complete project can be found ...
6
votes
1answer
152 views

Using ID's with a “scope” -like hierarchy

I currently have a ResourceManager class which is responsible for searching for resources with a given identifier, returning a reference counted pointer to the ...
2
votes
0answers
501 views

SDL boilerplate

The SDL code example on the SDL_Init page seems to be overly verbose, creating an exception class entirely for SDL_Init. I ...
3
votes
1answer
898 views

Colors changing in SDL program

I have black and white SDL_Surface and I'm trying to change colors, such as from black to white and from white to red. I did it, but it is taking too long to work. ...