Questions tagged [sdl2]
SDL2 (Simple DirectMedia Layer 2) 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
373 questions
1
vote
2
answers
2k
views
Handling keyboard input in SDL2
I'm using SDL2 with .NET bindings. Keyboard handling is encapsulated in static class, and keyboard handling code part looks like this:
...
3
votes
2
answers
4k
views
What is the most efficient way to render a textbox in C++ SDL2?
I'm a beginner in sdl2 and I'm trying to make a window, with a gui (where you can move a sprite around) and a CLI (a textbox where the game can return some text and the user can insert commands).
Let'...
0
votes
2
answers
1k
views
SDL2 MOUSEBUTTONUP triggers more than once
I've been trying to figure this out all day. I'm trying to make a simple check box. But my MOUSEBUTTONUP event keeps firing until I trigger another event like moving the mouse or clicking again.
<...
5
votes
3
answers
7k
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 ...
4
votes
1
answer
711
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 ...
1
vote
1
answer
1k
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.
...
0
votes
2
answers
423
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):
...
3
votes
1
answer
4k
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 ...
1
vote
1
answer
2k
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 ...
2
votes
1
answer
783
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 ...
2
votes
1
answer
11k
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
...
2
votes
1
answer
3k
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 ...
2
votes
1
answer
358
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
1
answer
191
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 ...
2
votes
1
answer
879
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.
...
0
votes
1
answer
2k
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......
3
votes
2
answers
12k
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
1
answer
440
views
SDL_Mixer functions Mix_Quit versus Mix_CloseAudio
Could someone please explain me the differences between the SDL_Mixer functions Mix_Quit and ...
0
votes
1
answer
3k
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
1
answer
600
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
1
answer
411
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 ...
1
vote
2
answers
3k
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 ...
1
vote
3
answers
800
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 ...
0
votes
1
answer
3k
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 ...
4
votes
2
answers
6k
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:
...