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
0 votes
1 answer
85 views

Object Collision in Breakout game using SDL library [closed]

Im trying to make a retro game of Breakout using an SDL library. Im still trying to learn developing and OOP. I got to the part where i want to check for collision between paddle and the ball, and ...
bboyMinato's user avatar
6 votes
2 answers
234 views

SDL Simple Wrapper Library

I wrote a little library to generate wrappers for SDL2 in C++20 with the idea to build a simple video game with it afterwards, and was looking for some feedback on the code! The idea is not to create ...
Alex's user avatar
  • 255
1 vote
0 answers
142 views

Haskell SDL2 Yellow Snow Game. My first program [closed]

I have been working hard trying to learn Haskell, or at least understand it enough to make simple programs. This is my first program. I have been working on it for about a month now. I had already ...
Jeremiah C's user avatar
2 votes
1 answer
56 views

SDL Stream for C++ follow up

Initial review requested here: The big thing I had missed was that read/write either work successfully (and all requested data is read/written) or it fails the flags are set appropriately. For write ...
Martin York's user avatar
  • 94.3k
4 votes
1 answer
95 views

SDL Stream for C++

Looking at the SDL library. Looking to load images from file into an SDL_Surface using the SDL2 Image API to do this I need to implement the SDL_RWops object class in terms of a C++ stream. The reason ...
Martin York's user avatar
  • 94.3k
6 votes
1 answer
161 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 ...
Kegan's user avatar
  • 63
4 votes
1 answer
241 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 ...
Tornado547's 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 ...
Offtkp's user avatar
  • 371
4 votes
1 answer
318 views

C++, SDL, and RAII

Learning Modern C++ patterns and this ended up being the direction I went to to create an encapsulation of SDL's window management, while trying to stay with RAII practices. This is meant to be a ...
KallDrexx's user avatar
  • 211
4 votes
0 answers
91 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 ...
Philipp's user avatar
  • 41
1 vote
1 answer
561 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 ...
Tom Gebel's user avatar
  • 390
2 votes
1 answer
156 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 ...
Alex CB's user avatar
  • 175
7 votes
1 answer
639 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 ...
G. Sliepen's user avatar
  • 50.7k
1 vote
1 answer
887 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: <...
JustOneMan's user avatar
4 votes
1 answer
236 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 ...
t0rb's user avatar
  • 143
3 votes
1 answer
422 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 ...
Graziano Bolla's user avatar
1 vote
1 answer
805 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 ...
Apple_Banana's user avatar
25 votes
1 answer
4k 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): ...
Eon's user avatar
  • 351
12 votes
4 answers
3k 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 ...
Eric's user avatar
  • 389
6 votes
2 answers
527 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 ...
Nadpher's user avatar
  • 889
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 ...
Nadpher's user avatar
  • 889
1 vote
2 answers
284 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 ...
smuggledPancakes's user avatar
5 votes
1 answer
806 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 ...
kibe's user avatar
  • 277
2 votes
1 answer
628 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 ...
swaltek's user avatar
  • 415
5 votes
2 answers
1k 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 ...
CygnusDawn's user avatar
1 vote
1 answer
346 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 ...
Acorn's user avatar
  • 283
3 votes
0 answers
124 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 ...
Andrew Kravchuk's user avatar
8 votes
2 answers
434 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 ...
Mark Benningfield's user avatar
23 votes
3 answers
11k 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 ...
Afonso Matos's user avatar
6 votes
2 answers
2k 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 ...
Jason Mills's 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 ...
Gnik's user avatar
  • 882
3 votes
0 answers
1k 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 ...
Nick's user avatar
  • 193
2 votes
0 answers
388 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 ...
Nick's user avatar
  • 193
5 votes
1 answer
444 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 ...
Rokas Višinskas's user avatar
2 votes
0 answers
665 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 ...
Nick's user avatar
  • 193
2 votes
1 answer
154 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 ...
Noah Haasis's user avatar
2 votes
1 answer
572 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), ...
Marko Petričević's 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'...
Benjamin Crew's user avatar
5 votes
2 answers
3k 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 ...
Joe's user avatar
  • 205
7 votes
1 answer
753 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-...
Nick's user avatar
  • 193
3 votes
0 answers
140 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 ...
Nick's user avatar
  • 31
5 votes
1 answer
909 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....
Nick's user avatar
  • 193
8 votes
1 answer
7k 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
5 votes
1 answer
2k 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 ...
atmostmediocre's 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 ...
Hagartinger's user avatar
8 votes
1 answer
938 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 ...
NickH's user avatar
  • 131
6 votes
2 answers
602 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 ...
Colin's user avatar
  • 107
2 votes
1 answer
598 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 ...
Pseudonym Patel's 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 ...
Michal Przybylowicz's user avatar
6 votes
2 answers
849 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 ...
carefulnow1's user avatar