[Simple DirectMedia Layer 2](https://www.libsdl.org/) (SDL2) is designed to provide platform independent access to various common multimedia devices. It is the new, current and updated version of SDL and recommended for new projects over legacy SDL1.2
0
votes
0answers
33 views
GLFW vs SDL2 for Vulkan
I'm creating a simple Vulkan game and looking into a cross platform library to handle native windows creation etc, the game will be 3d and after doing some reading it seems that while sdl offers a ...
4
votes
1answer
46 views
Drawing at floating point position
The library I am using (SDL2) only supports drawing to int positions. I am currently storing my objects positions as double, and would like to render them. Should I round the value to int, i.e. 0.5 =&...
1
vote
1answer
22 views
Is there a way how to handle multiple SDL_PollEvent loops without clearing the event queue?
Is there a way how can I handle more SDL_PollEvent() while loops for one SDL Event without taking the events off from the event queue? I mean, lets say I have something like this:
void Game::...
5
votes
1answer
124 views
Is it a good idea to use per pixel collision detection in an isometric game?
I've completed the per-pixel collision detection for a small side-scroller game, for learning purposes using a Lazyfoo.net tutorial, and I am wondering if it is a good method for detecting collision ...
0
votes
1answer
50 views
How to render an animated gif to the screen using SDL2?
So, I have an animated gif that is 5 frames (not the same as what is seen in this tutorial). Upon opening, my gif is already animating, unlike the png in the above tutorial.
How can I render it to ...
1
vote
1answer
43 views
SDL2: Why is my player's position not updating?
I've just started getting into game development, SDL in particular, so please go easy on me. I'm struggling to understand why my player's position isn't chaning when I press the left arrow button.
...
3
votes
2answers
549 views
Proper names and wordings for Real/Fake fullscreen video modes
I have an option in my game which allows Player to choose between video modes:
Fullscreen Fake
Fullscreen Real
Windowed
First and second corresponds to SDL_WINDOW_FULLSCREEN_DESKTOP and ...
0
votes
0answers
27 views
How to implement a side-scrolling background
I'm creating a side-scrolling game with sdl2 and c++, this is my first game I've ever coded and I've dived head first into it which has led me to this problem. I'd just finished coding the menu and ...
0
votes
2answers
84 views
Do I still need limit FPS when I have a variable timestep?
Lets say I have a simple game loop (variable timestep - but it applies also for other timesteps):
double lastTime = SDL_GetTicks();
while(isRunning){
double currentTime = SDL_GetTicks();
...
0
votes
1answer
95 views
Change color to an image in SDL (c ++)
I have an object in the game where its color depends on various circumstances (scenario, collisions, etc.)
The problem is that for each situation, in the sprite sheet I have to add the object with ...
0
votes
1answer
87 views
Is it possible to write a game with a HTML5+REST service architecture?
As a side project I'd like to program a board game similar to Twilight Struggle. For this pet project I'd like to satisfy several non functional requirements:
The core logic must be written in ...
4
votes
1answer
66 views
How can I render images to multiple windows without creating double textures in SDL2?
Simply put: What is the simplest way to render an image to two different sdl2 windows?
I'm pretty new to SLD2, but I have a nice little level editor working. I then decided to move the area with edit ...
3
votes
2answers
103 views
How to get SDL2 to play 32bit WAV files
I have WAV files of this format:
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 48000 Hz, 2 ch, s24le, 2304.0 kbit/100.00% (ratio: 288000->288000)
ID_AUDIO_BITRATE=2304000
...
1
vote
1answer
36 views
Is there a way to set texture wrap mode as repeat in SDL 2?
In SDL2, I would like to render a texture on the screen, but with destination rectangle greater than texture size. Instead of stretching the texture, I would like the texture to be repeated as many ...
1
vote
0answers
22 views
Default with SDL_RendererFlip Horizontal (SDL, C ++)
When I execute my sprite sheet animation and apply renderer_flip_horizontal, a line appears in the sprite.
Without the flip render, everything works fine.
Example image:
Note: The sprites are ...
4
votes
1answer
167 views
SDL2 taskbar icon notification (blinking / flashing orange)?
In steam when you get a message, or in CS:GO when you find a match the taskbar icon flashes orange and your taskbar becomes unhidden if that's how you have it setup.
In SDL2 you can set a window icon ...
0
votes
0answers
36 views
SDL: Trouble targetting window from inside of another class
I'm a beginner to SDL and also pretty new to C++ in general, so please go easy on me.
Below is a very basic game loop I've been working. I have no errors when compiling, however my grass texture in ...
1
vote
0answers
21 views
GuiSan | SDL2 - Setting colour key of render target results in having an black screen
At the moment i am experimenting with guisan within my little project. Everything is done sofar with SDL_Texture except Guisan which utilize SDL_Surfaces instead SDL_Texture for rendering itself.
Per ...
0
votes
0answers
38 views
Why do i have get the undefined reference to 'IMG_Load' for SDL2 using Eclipse?
I'm trying to load a '.png' image within an SDL window using the 'SDL_image library'.
I know this problem has been outlined multiple times online but i still have the same problem after checking all ...
0
votes
1answer
60 views
Why doesn't SDL_Surface rendering work in SDL2?
I have done the following using C++:
1) I used SDL_CreateWindow() to create an SDL window
m_window = SDL_CreateWindow("My First Side-scroller
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, ...
0
votes
1answer
71 views
OpenGL: Better Approach to Repeating Sprites (e.g. terrain)?
Preface: Linux (Ubuntu 16.04 Gnome), C++11, SDL2, GLEW 2.0, OpenGL 4.5
Hello ladies/gents,
My conundrum is this: How do I handle draw a repeated texture (sprite) as a single object, at various ...
1
vote
1answer
64 views
SDL_Image setup problems on windows / mingw 64 / eclipse
I've been a software developer for a while, but I haven't done C++ in a long time and I thought I'd try it out with some game developement. I'm following the tutorial on youtube for Remaking ...
1
vote
1answer
49 views
How do i get the drawing to loop automatically with out need for user input scrolling?
#include <iostream>
#include <time.h>
#include <iomanip>
#include <SDL.h>
#include <stdlib.h>
#include <string.h>
#include "screen.h"
#include "Stars.h"
#...
3
votes
1answer
91 views
Rotating a Row of Textures
Preface: In Linux, using C++11, SDL2, GLEW, and OpenGL.
Hello Ladies/Gents,
I am reaching out as I'm stuck on a fairly simple problem that a decade out of school has further hindered. Specifically, ...
0
votes
1answer
21 views
Tilling with SDL2 via Clipping - Some bug which is hiding quite well
right at the moment i am writting some code for demonstration purposes. unfortunatly i have an stubborn bug in my code which is invisible to me. The Problem is I am trying to draw a Map. The Map ...
0
votes
1answer
37 views
Can't figure out how to create texture from a font-surface
I can't seem to be able to render my font, it crashes and I can't figure out why. It seems to load the font correctly, but the parts relating to surface crashes.
Why does my texture crash?
Here is ...
0
votes
2answers
37 views
Reliably synchronising SDL animation with VSYNC in windowed mode
I have an SDL/OpenGL program which creates a rendering context with PRESENTVSYNC enabled, then enters an animation loop which calls SDL_GL_SwapWindow each time around. On my own machine, the animation ...
1
vote
1answer
27 views
SDL Player do something for 3 seconds then stop
I'll make my player respawn after 1 of his lives is taken, but I want him to be invincible for 2 or 3 seconds and not instadie again because he will be in the way of enemy bullets.
for (int i = 0; i &...
1
vote
1answer
28 views
SDL Detect change score
I have this in my loop , it works but I get verry low fps and game is working in slow motion :
while (!done)
{
//Check for events
done = processEvents(window, &player);
...
0
votes
1answer
40 views
SDL TTF render variable
This is the way I render the score in my main game , and I made this new project to understand how to use it... It works , the score is updated and it display on the screen but the problem is memory......
0
votes
2answers
63 views
SDL_RenderDrawLines isn't drawing complete geometry
So I am trying to draw hexagons with [SDL_RenderDrawLines][]. It looks to be working fairly well, however, it fails to draw some of the lines.
So each of the hexagons in the screen shot is a hex ...
1
vote
1answer
90 views
In SDL2 what is the fastest / most efficient way to draw pixels onto the screen? Using SDL_RenderDrawPoint or SDL_RenderCopy with a Texture?
I want to add pixel splatters and particle effects to a game. For this my options were to have a bunch of pre-made animations in the form of textures, OR create a particle engine.
For the particle ...
0
votes
1answer
27 views
SDL_Mixer Halt halted Channels?
It's not stated in the documentation, so I'd like to ask if anyone knows if it's ok to halt a channel (via Mix_HaltChannel()) that's been already halted?
I'm asking 'cause I'd like to halt every ...
0
votes
1answer
36 views
SDL_Mixer functions Mix_Quit versus Mix_CloseAudio
Could someone please explain me the differences between the SDL_Mixer functions Mix_Quit and Mix_CloseAudio? I've read the documentation but couldn't really understand it clearly. When to use them and ...
-1
votes
0answers
60 views
Why doesn't my screen size changer function properly in SDL2?
I'm creating a 2D platformer using SDL2 in C++. I've started coding the screen size changer to allow players to choose a window size based on their personal preference. However when I use the window ...
1
vote
0answers
55 views
what file architecture to follow while uploading an sdl based C++ project to Github? [closed]
I created this sdl game containing header files source files and graphics files including tilemaps .
I also have a setup file that will install a .exe file with dependencies such as dll files for sdl ....
0
votes
1answer
189 views
SDL2 and OpenGL: flickering with double buffering, what am I doing wrong?
I'm currently fiddling with SDL2 and OpenGL to get an understanding on how they work and, moreover, how shaders are done and work.
Right now, I'm following this tutorial, using SDL instead of glfw; ...
0
votes
0answers
15 views
Issues with keyboard handling SDL_Input with Directx9 for graphics
I had a pseudo-engine made with OpenGL for 3D graphics and SDL2 for the window, input, files , textures, UI, audio... And it was just for especific purposes, so it didn't had an editor integrated, ...
0
votes
1answer
46 views
Trouble with mouseover effect in SDL for square menu buttons
I have a game with a menu made up of 9 'tiles'. I want the tiles to turn white when the cursor hovers over them (and play a sound), and go back to default when the mouse moves off. My code works when ...
0
votes
1answer
46 views
SDL_RenderCopy to set location
I'm coding a game's GUI in SDL2 and c++, I'm using SDL_RenderCopy to load the buttons on to the screen, but don't know how to get buttons in specific spots eg. bottom left corner, slightly below ...
0
votes
1answer
42 views
SDL2 application occasionally refuses to close [closed]
I've been working on a sliding puzzle/game of fifteen clone in SDL recently. A problem I've had is that when I close the game the app isn't always removed from the dock and I can't force quit it. It ...
1
vote
1answer
66 views
How to render irregular sprite sheets in SDL2?
I have a sprite sheet that's 155 x 66 pixels that I use for my game's UI. I've seen many topics regarding rendering sprite sheets by using the number of pixels and dividing that by the number of ...
2
votes
1answer
105 views
How to render a PNG-file on the screen with SDL? [duplicate]
I'm coding a 2D platformer in using C++ and SDL2. I've started by coding the GUI, however I'm unsure how to get the menu buttons onto the screen and in the right positions.
How do I load the PNG ...
0
votes
1answer
49 views
Control SDL_Mix Sound Effect Volume
My game (coded in c++) uses SDL Mixer for its sound. But how do I make certain sounds louder than others. In the game's Main menu, one button is not immediately unlocked, creating a sound if you try ...
0
votes
1answer
63 views
Why doesn't SDL_Mixer play my audio file?
I'm coding a game in SDL2 and I'm implementing the audio system using SDL_Mixer. However, my music file won't play during the program and I don't know why. How do I get the music to play?
Audio ...
1
vote
3answers
92 views
How to export Visual Studio game for mass distribution
I've coded a Visual Studio 2015 game in SDL2 and ran some distribution tests, I gave a user the game's .exe (the raw game with no files) and they got the error SDL2.dll is missing. How would I export ...
4
votes
1answer
216 views
SDL2 not setting OpenGL version?
I want to use SDL2 (2.0.4) with C to create an OpenGL 3.3 (core) context. But it seems to default to whatever compatibility profile my computer supports. Works fine with LWJGL2 and Java.
Here is my C ...
0
votes
1answer
145 views
How do I clear streaming textures in SDL?
I need to clear a streaming texture before I draw into it on the next frame, because only a part is updated, and it's random enough that I can't predict which part will be clear.
I don't want to ...
1
vote
0answers
36 views
Prevent rendering queue from overflowing when using Vsync
My game loop currently looks something like this:
while (!quit) {
takeInput(); // Input is sampled however fast loop can run
time_now = get_time()
time_passed += (time_now - time_prev);
...
4
votes
1answer
220 views
How to pass PNG image data directly to SDL?
Well passing just external PNG to SDL is very easy with the SDL_image library. I have a class that does just that. The code looks like the following:
SDL_Surface* Texture::LoadImg(const char *...