[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
47 views
Is SDL2 the wrong solution for this problem? [closed]
I am trying to make a prototype of a game. With my current experience and the amount of tutorials online, I can take it further from there, but I can't even seem to get the prototype working to my ...
0
votes
0answers
33 views
SDL2 and OpenGLES2 cross-platform issue?
I am writing a game using SDL2 and OpenGLES2 and it works great on my Gentoo/x86_64 boxes.
I move the game over to an Ubuntu/armv7f box and it fails any time I make a call to GL.
SDL2 provides a ...
-4
votes
1answer
107 views
else if statements not working!
I'm coding a test-system in my game to test graphics, but the else-if statements aren't working, I've laid them out like this:
if (condition)
{
//do something
}
else if (condition)
{
// do something
...
0
votes
0answers
41 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 ...
0
votes
0answers
84 views
How to create a bordered fullscreen SDL window (like Terraria's)
I'm coding a 2D platformer in SDL and c++ with visual studio and am wondering how to create an SDL window (with a border), that covers every part of the screen except the taskbar.
1
vote
0answers
42 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
54 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
8 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
37 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
29 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
36 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
50 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
1answer
55 views
How to render a PNG-file on the screen with SDL?
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
23 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
32 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
68 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
117 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
57 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
30 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);
...
3
votes
1answer
105 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 *...
1
vote
2answers
84 views
How should I use this 1D perlin noise function?
I'm trying to create a terraria like terrain with SDL2 and C++. For generating the terrain I'm trying to use the 1D noise function from here:
https://github.com/SRombauts/SimplexNoise
It's pretty ...
1
vote
0answers
56 views
2D Voxel isometric rendering with non grid-aligned objects
I'm currently working on making a simple SDL2 game (written in C++) where the maps are comprised of sprite voxels (essentially just a png of an isometric cube). Game entities move in 3D space. The ...
0
votes
1answer
40 views
C & SDL: Unexpected Behaviour with Renderer
I'm creating a clone of the memory testing game SIMON. My program is simply four differently colored squares that light up one at a time in a random order. I wrote some code that lights up one square, ...
0
votes
1answer
60 views
Fast texture pixel access using SDL2
People have asked questions on fast pixel manipulation, but I'm looking to read the RGB color values of each pixel.
I've heard of SDL_RenderReadPixels but in the docs it says:
WARNING: This is a ...
1
vote
1answer
56 views
How do I perform an Iris Wipe transition, using C++ in SDL 2.0?
How do I perform image masking/clipping using an arbitrary shape like a circle?
I want to do an Iris Wipe transition, similar to in the movies. By Iris transition, I mean the circle transition ...
-1
votes
1answer
62 views
Rendering with sdl_gfx is so slow, any alternative?
I have been using sdl_gfx ( sdl2 extension library https://github.com/ferzkopp/SDL_gfx ) to make Android games, I have always noticed that rendering primitives is so slow.
So I was rendering it once ...
1
vote
0answers
34 views
Get modified key with SDL2
If I poll keyboard events with SDL2 all I get is the pressed key and the modifiers. But I am using Neo and have some keys like Esc and arrow keys on a different layer which means that e.g. Mod4+i is ...
0
votes
1answer
21 views
How to get rid of an image upon collision detection in SDL?
I am fairly new to SDL in C, but I have written a simple game whereby a character has to reach the end of a level and avoid bad stars on the way. If he hits a star, he dies. There are also good stars ...
0
votes
1answer
39 views
Using an SDL_Renderer within a texture wrapper class in SDL2
I have a CTexture class which needs a renderer to create and show textures. I don't know the scope I should put the renderer in. I´ve got it to work as a global variable, but I don't know if it´s a ...
1
vote
1answer
71 views
Premake a texture in SDL (C++) and save it
I am new with SDL, and am making a Conway Game of Life.
I want to make a grid appear on the screen, so of course I could make one manually with SDL_RenderDrawLine and two loops. But I don't want to ...
0
votes
0answers
112 views
C++ - Is this a good way to handle GUI events?
I am developing a UI framework for my game (SDL2, C++).
I have a ScreenManager class which manages a list of UI widgets on the screen (text, buttons, etc.).
The function below builds the main menu ...
3
votes
2answers
312 views
Smooth character movement
I want my character to move smooth not instant stopping etc. I want it to decrease velocity slower not instant. I tried with keystates but that doesn't work for 2 keys at once. I tried using key....
1
vote
1answer
279 views
How to stop SDL from freezing the rendering while resizing the window?
I have a simple SDL application with a re-sizeable window. If I minimize it and then maximize the window the rendering freezes. I've included a simple code example below which makes the screen flash ...
1
vote
1answer
125 views
How to handle different resolutions in SDL2?
What is the easiest way to set different resolutions with SDL2?
I was trying to use the SDL_RenderSetScale() function first, but for some reason it alters the physics of the game (jumps are higher or ...
3
votes
1answer
60 views
Can I offset all rendering in SDL2?
I know about SDL_RenderSetScale, but I need also horizontal/vertical shift of the renderer's origin. At the moment, I manually modify positions of all screen objects with the shift. Is there a way to ...
0
votes
1answer
200 views
Is 3d game development advantageous/possible in SDL2? [duplicate]
I think this is not appropriate, but as the given video in the link, the youtuber name Bisqwit creates his own 3d engine from scratch in C and SDL2. How much is this advantageous is real 3d game ...
4
votes
1answer
74 views
How do I create 4 rows of SDL_Rects with each row being a different color?
So using a class i've created a vector and managed to make one row of SDL_rects(with collision detection and destroy on collision). But when I make a second row(and obviously 2 or more rows):
1) it ...
1
vote
1answer
88 views
SDL2: Texture not rendering to screen
I'm trying to render a BMP image, but nothing is showing up other than the draw color. I have most of my code in a header file.
[game.h]
#ifndef __Game__
#define __Game__
#include <string>
#...
-1
votes
1answer
67 views
SDL2 graphics will draw in main process but not in separate thread
I'm having an issue that I'm absolutely stuck on and my ability to debug this issue has been exhausted.
I am implementing a base for a 2D game where I am handling my keyboard input, logic, and ...
0
votes
1answer
62 views
SDL2 in a VS2015/C++ panel
I'm trying to use SDL2 in a panel (VS2015/C++) and cannot find solid examples of how to connect the two. Anyone know how this is done?
I've tried some code found in various places, but no luck yet. ...
4
votes
1answer
240 views
How can I resize SDL2 windows efficiently?
I guess resizable windows are not being optimized for in game development but still... The following piece of code demonstrates a problem I'm having: resizing the window is very slow. Basically the ...
2
votes
1answer
164 views
Monitor external window events with SDL2
I'm trying to render my game (SDL2, C++) in a Windows Form application (C#) using C++/CLI to interface with my underlying C++ code. The purpose of the form is to create an editor which can monitor/...
0
votes
0answers
25 views
rendering moving terrain using midpoint displacement algorithm in sdl
This is in addition to the question I asked over here.
midpoint displacement algorithm in sdl.
The answer there helped me but I am facing another problem regarding the moving part. The terrain ...
1
vote
1answer
57 views
midpoint displacement algorithm in sdl
I am trying to implement moving random hills in SDL. I am using midpoint displacement algorithm to create some random terrain and I have also accomplished to move the terrain too. But the problem is ...
1
vote
2answers
93 views
Bullets Stop Working Error
I've made a vector which is used by a universally accessible namespace called 'BULLET_HANDLER'. This vector stores and updates all bullets that are produced from the 'shootBullet' function. The ...
11
votes
2answers
1k views
Removing delay at start of a key press
I'm making a simple game, and one of the problems I encountered is the annoying delay when pressing a key continuously.
So basically, when I press (for a very long time) for example Up, my object ...
2
votes
1answer
124 views
glGenBuffers is NULL
I'm using GLEW 1.13.0, (GLUT), SDL2 and OpenGL 3.3 core.
#include <GL/glew.h>
#include <GL/glut.h>
int main(int argc, char* args[]){
Engine::init(); // Initializes SDL_GL_* attributes
...
0
votes
0answers
65 views
Can't alt tab back to SDL2 window with SDL_WINDOW_FULLSCREEN_DESKTOP flag set in Ubuntu
Good evening. I'm trying to build a fullscreen borderless game to run on Ubuntu using SDL2. I'm currently at a loss as to why I can't ALT+TAB back into my SDL2 program after I switch out of it. The ...
2
votes
2answers
96 views
Input before or after update/draw?
This is how I understood the game loop, and I wanted to know if I'm correct or not:
1) Draw/render -> input
CPU | GPU
------------------
Update |
Draw |
Input | Rendering
2) Input -> ...
0
votes
2answers
332 views
How to use the SDL viewport properly?
I'm very confused about the SDL2 viewport, I did some googling to find out how to implement it but people keep mentioning things like "world coordinates" which I don't have in my game.
Question : Do ...