Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sdl]

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 port of "Civilization: Call To Power."

19
votes
3answers
2k views

Snake++ game (in C++ with SDL)

Yes, It's called Snake++. I build it to learn C++. What features and techniques can be improved? I used SDL for some basic rendering, but my concern is more about ...
4
votes
2answers
54 views

Frame limiting in an SDL game

I am a relatively novice programmer, and I am taking steps into graphics programming. I am writing a quick pong clone and want to cap the FPS to save system resources. This is how I have implemented ...
23
votes
3answers
2k views

2048 with GUI in C

0x2048 This is my implementation of the classic game "2048" in C. The instruction to build/run the project (GitHub repo) can be found here. I started with the core game and then built a GUI ...
3
votes
0answers
88 views

Game loop and State Machine C++/SDL2

I just finished making a flappy bird type game and would like some feedback on my game loop and state machine. The game loop was based on deWiTTER's article, and the state machine was based off of an ...
2
votes
0answers
51 views

SDL2/C++ Pong Game

I just completed my pong game. I'm trying follow the CS50 Introduction to Game Design course. The course uses LUA and LÖVE, but I'm trying to just transfer the concepts to C++ and SDL2. The game is ...
3
votes
1answer
44 views

TTF/SDL based class for text handling

So I'm currently working on sort of an SDL engine (may be too ambitious I know). I'm seeking that it would be my first actual project and it's also the first time I'm seriously using classes. So I ...
2
votes
0answers
106 views

SDL2/C++ Blackjack Game

I recently just finished making this blackjack game using C++ and SDL2. Although this took a lot longer than I expected it to, I feel like I'm getting a good hang of everything. However, this is only ...
1
vote
1answer
101 views

Pong Ultimate - Pong with 4 paddles

This is a pong game with 4 paddles. The paddles are always on the same height as the mouse. I wrote it in C using SDL. The Makefile works for linux. Do you think the code is readable or should I ...
2
votes
1answer
132 views

C++ Breakout game using SDL

I did a big mistake to create procedural C++ breakout game on start and now im having trouble converting it into OOP. As far as I can see I need classes: Loptica (eng. Ball), Splav (eng. Paddle), ...
8
votes
1answer
351 views

Gameboy emulator in C

I've been coding a Gameboy emulator in C for some time(seems like a common project for people). It's reasonably functional and has some MBC1 support, but has some minor graphical glitches still. I'...
4
votes
2answers
365 views

Simple C++ SDL2 Wrapper for small game

I'm in the process of creating a simple SDL2 wrapper for a breakout clone. The real learning objectives for this project are: Learn how to manage resources properly via wrappers Learn more about SDL2 ...
6
votes
1answer
159 views

C++/SDL2 Tic-Tac-Toe

This is my second attempt at creating a game. I think I have gotten the basic ideas of state machines and game loops down, but I'm sure there are still a lot of things I can learn. It is a basic Tic-...
3
votes
0answers
84 views

SDL/C++ High-Low Guessing Game (Version 2)

So after getting a very thorough review and feedback from indi in my previous attempt, SDL/C++ High-Low Guessing Game, I decided to go through the game and fix as many mistakes as I could. But going ...
5
votes
1answer
160 views

SDL/C++ High-Low Guessing Game

I just recently finished going through all of learncpp.com's and Lazy Foo's SDL2 tutorials. This is my first program written outside of the tutorials so I assume there's plenty of room for improvement....
7
votes
1answer
608 views

Simple game loop using SDL

This is a basic game loop written in C++ using SDL. All feedback is appreciated especially feedback related to design and extensibility. Main.cpp: ...
3
votes
0answers
81 views

C# SDL2 Wrapper — Faster Viewport/Sprite Rendering method?

I'm using this SDL2 wrapper for C#, but since it doesn't implement classes such as Sprites, Viewports or Bitmaps, I've been trying to make them myself. Everything's going well and functions as I want, ...
4
votes
1answer
281 views

C++ and SDL2: Snake implementation

I've created a simple "Snake" game in C++, to practice using OOP and SDL2 (this is the first time I've used a graphics library) and it works fine. The problem is, I do more C than C++ and I'm not ...
11
votes
2answers
2k views

Pong game using SDL

This is a simple Pong game for 2 players. Controls are ↑ and ↓ keys for the right player and W S for the left one. There is a score for each player on top of the screen but with no win conditions so ...
8
votes
1answer
212 views

SDL2.0 Conway's Game Of Life

Yet another Game Of Life implementation code review question I am attempting to learn SDL, and have a general (beginner) knowledge of c++. I am not a developer by trade so I expect my ...
5
votes
2answers
354 views

C++ Implementation of Conway's Game of Life with SDL2

This is my first attempt at using a visual library in C++, so for practice I decided to create the Game of Life utilizing SDL2; however, I would like help in terms of optimization and OOP. When ...
2
votes
1answer
140 views

A simple SDL script that creates a window

Is there possibly a way to take out the nested if statements without losing the error reports? I am just learning SDL and would like to further simplify my code so ...
3
votes
3answers
818 views

Convert hex color string to SDL Color

I am writing a small game and as a part of it I load json config with colors definitions in a format of strings #00ff00. Then I am using this function to convert ...
5
votes
2answers
194 views

2D SDL Asteroids-like game

I am writing an Asteroids clone in SDL2 using in C. I have written a game loop function that seems to work with no stutter, however I would just like to ensure my game loop will be fast and efficient ...
3
votes
1answer
605 views

Sprite animation with SDL2

For the past few days I've been trying to learn how to animate 2D sprites using SDL2. For that purpose, I've taken a 6 frames animation from a Pokémon game and made a PNG image out of it : The way I ...
4
votes
0answers
258 views

Sound recorder, based on sdl2

This is my first Haskell program, a command-line sdl-based(so, hopefully, cross-platform), parameter-less sound recorder. Tutorials, articles or chapters that concern mistakes in my code are just as ...
3
votes
1answer
119 views

Very basic and crude graphical 2D adventure game with text box

I wanted to make a sort of crude version of RuneScape. It has a text box where the majority of the information the player learns is from and basic graphics. I'm using sdl for my graphics library and ...
4
votes
2answers
322 views

C function to move and collapse cells in 2048 game

I'm implementing a clone of 2048 in C with SDL, and I have the following function for performing a movement on a column vector/array ...
6
votes
1answer
1k views

Tetris clone in C++ using SDL

Overview Using SDL and my own tiny wrapper library for it, I've written a tetris clone. I would really appreciate it if someone could take a look at it and tell me if something is particularly bad (...
1
vote
1answer
413 views

C++ Quadtree SDL2

I've written a simple Quad-tree in C++ for an SDL2 application I'm working on. It's quite simplistic, and seems to be doing its job. Its only designed to work with a collection of unmovable physical ...
4
votes
1answer
334 views

Tron Game Remake in SDL

Recently, just for fun, I've created a clone of the arcade game Tron. Since I am still a novice when it comes to C++, I would really appreciate all the feedback I can get from those with more ...
4
votes
1answer
906 views

Implementation of snake game using sdl2 and c

I have implemented the snake game using sdl2 and c. The arrow keys are used for the movement of the snake and if the snake hits the boundary of the window, the game ends. I have not implemented score ...
6
votes
1answer
403 views

SDL2 Game of Fifteen / Sliding Puzzle

I have made a simple sliding puzzle/game of fifteen using SDL. I originally attempted this to learn about game states, but it turned into a general exercise in code organisation and SDL use. Therefore,...
1
vote
2answers
2k views

Draw a centered circle

I've written this program that, renders a circle in the middle of the screen. It's been written in a very elementary way. Any suggestions on principles or techniques? Or any more optimal or efficient ...
4
votes
2answers
990 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
194 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
676 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
142 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
100 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
464 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
362 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
1k 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
384 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 ...
10
votes
0answers
661 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
1k 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
113 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
2k 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
1k 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
1k 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
565 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
711 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 ...