Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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."

Filter by
Sorted by
Tagged with
5 votes
1 answer
82 views

Chess game for two human players

I'm relatively new to programming, as in my second semester of college. To practice C, I started work on a chess game. I'm wondering if there are ways I could improve my code, make it look more ...
user avatar
  • 53
4 votes
1 answer
141 views

Snake game in rust

I made a small rust snake game in order to teach myself rust. I would like to know what I am doing well and poorly, and how to improve my rust code Cargo.toml ...
user avatar
15 votes
4 answers
4k views

Chess engine for chess without checks in C++

Project Description: Chess without checks: A chess variant where you can take the enemy king. This engine implementation is for chess without checks. Since checks don't exist, expect the code to not ...
user avatar
  • 371
4 votes
0 answers
57 views

Testing and coding conventions for testing C with SDL

I finished my first real C project and it was Conways Game of Life. The code is working fine and the game runs. Since this was my first project though I don't know any of the real code conventions for ...
user avatar
  • 41
1 vote
1 answer
234 views

Snake game in C++17 with SDL2

I implemented a simple snake clone in C++, using SDL2 for the graphics part. Gameplay-wise, its pretty much classic snake: The player is able to control the snake with "WASD", food gets ...
user avatar
  • 390
2 votes
1 answer
111 views

C++ wrapper for font opaque pointer

I'm creating a class which has a raw pointer member which comes from a C function. In order to make it RAII approved, I just created a method free() that is called ...
user avatar
  • 33
7 votes
1 answer
312 views

Modular synthesizer framework for C++

While working on a much more complicated audio application, I was thinking about modular synthesizers, and whether it could be made simple to build a C++ application that implemented a modular ...
user avatar
  • 32.6k
1 vote
1 answer
459 views

How to use smart pointers with SDL2 (SDL_RWops)?

I want to write read savefile function with smart pointers and SDL2. I have little expirience with smart pointers and just want to ask is my code good, correct and no memory leaks. this is my code: <...
user avatar
4 votes
1 answer
137 views

C++ SDL2 Space Invader C++ questions

The whole project would be a bit much to post, but there were a couple of questions that came up while I worked on this project. This is a fully working space invader game I coded in C++ with SDL2. I ...
user avatar
  • 143
3 votes
1 answer
254 views

2D Game Framework in C++ and SDL

I'm making a simple 2D framework / engine for the first time based on two books and before the project gets too big I would like to know if I'm ordering things the right way. Maybe there are better ...
user avatar
1 vote
1 answer
287 views

Good way to structure a SDL project

I am absolutely new to c++ and am trying to learn SDL2 with c++. I am setting up my first project and I was unsure if the way I have structured the project is good or if I have over done it. Here is ...
user avatar
25 votes
1 answer
3k views

A Pong Game using C++

I wrote a simple, 2-player Pong game for a Udacity Nanodegree in C++. The program has the following class structure (relatively new to UML so any tips on here would be very much welcome too): ...
user avatar
  • 351
12 votes
4 answers
2k views

Conway's Game of Life in C

My programming background is mostly C++/C#. Lately i got interested in writing some C. So i implemented Conway's Game of Life using SDL2 for visualization. This is actually my first program written in ...
user avatar
  • 399
5 votes
2 answers
303 views

Sorting algorithm visualizer in C++ and SDL2 Improved

Original post: Sorting algorithm visualizer in C++ and SDL2 I followed the advice you gave me and improved my code. I also added two more sorting algorithms. I'm mainly looking for code readability ...
user avatar
  • 879
19 votes
1 answer
2k views

Sorting algorithm visualizer in C++ and SDL2

I finished a sorting algorithm visualizer (for now only uses bubble sort) and this is the code. I'd like some suggestions to improve the memory usage or time elapsed. Built with Cmake and Ninja on ...
user avatar
  • 879
1 vote
2 answers
136 views

Improving performance of raycaster application

Bitbucket link to repo Tutorial I have been following I decided to make a raycaster app and try to understand how it really works. So far so good, I have it up and running. If you download the ...
user avatar
5 votes
1 answer
538 views

Snake game with C and SDL using linked lists

I am total beginner in C and after reading K&R's chapter 5, I felt I was ready to at least make a simple game using C. I know linked-lists, so since I was making an implementation of Snake, why ...
user avatar
  • 267
2 votes
1 answer
404 views

SDL2 fixed framerate without VSync

My attempt at a fixed framerate using SDL2 without using VSync. Just using SDL_Delay left the fps a bit slower or faster due to the fact ...
user avatar
  • 415
5 votes
2 answers
956 views

Chip8 Emulator in C++

I wrote this chip8 emulator as practice recently since my coursework is mostly console programs. I've tested it with roms off Zophar's Domain and it appears to work with my limited testing. I'm hoping ...
user avatar
1 vote
1 answer
253 views

SDL Initialization and Management wrappers

I am using SDL2 for window management and rendering, but it can be a little verbose. And because of how SDL2 works under the hood, the SDL_Renderer is tied to image resource loading. So, I am ...
user avatar
  • 283
3 votes
0 answers
111 views

Racket macro for variadic FFI

I'm working on FFI wrapper for SDL2 library in Racket. The library includes several variadic functions (e.g. SDL_SetError, SDL_LogMessage etc); Racket FFI does not have straight way for importing ...
user avatar
8 votes
2 answers
258 views

Pausable Timer Implementation for SDL in C

Problem I've written a timer module in C for an SDL game. I'd like to get some eyeballs on. I wrote this for 2 requirements: I needed a timer that would signal on an elapsed interval, AND that was ...
user avatar
23 votes
3 answers
9k 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 ...
user avatar
6 votes
2 answers
1k 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 ...
user avatar
25 votes
3 answers
3k 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 ...
user avatar
  • 872
3 votes
0 answers
857 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 ...
user avatar
  • 193
2 votes
0 answers
339 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 ...
user avatar
  • 193
4 votes
1 answer
305 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 ...
user avatar
2 votes
0 answers
557 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 ...
user avatar
  • 193
2 votes
1 answer
135 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 ...
user avatar
2 votes
1 answer
464 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), ...
user avatar
10 votes
1 answer
1k 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'...
user avatar
5 votes
2 answers
2k 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 ...
user avatar
  • 205
7 votes
1 answer
569 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-...
user avatar
  • 193
3 votes
0 answers
126 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 ...
user avatar
  • 31
5 votes
1 answer
721 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....
user avatar
  • 193
8 votes
1 answer
6k 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: ...
user avatar
2 votes
0 answers
211 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, ...
user avatar
  • 21
5 votes
1 answer
1k 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 ...
user avatar
11 votes
2 answers
4k 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 ...
user avatar
8 votes
1 answer
842 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 ...
user avatar
  • 131
6 votes
2 answers
571 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 ...
user avatar
  • 63
2 votes
1 answer
460 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 ...
user avatar
3 votes
3 answers
3k 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 ...
user avatar
6 votes
2 answers
728 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 ...
user avatar
4 votes
1 answer
2k 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 ...
user avatar
  • 137
4 votes
0 answers
632 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 ...
user avatar
  • 454
2 votes
1 answer
206 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 ...
user avatar
4 votes
2 answers
464 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 ...
user avatar
6 votes
1 answer
2k 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 (...
user avatar