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
1 answer
141 views
Problem with SDL2 optimization (tree structure)
while I was trying to optimize SDL2 rendering phase as much as possible, I reached a wall. I tried to search on the internet but I could not find any solution. So, I need help. Let me explain the ...
0 votes
0 answers
104 views
How can I accurately calculate deltatime in SDL2/3?
I have looked up ways to calculate DeltaTime in the past, but the 'solutions' seem to have my program be slightly jittery or not move things correctly. As far as I know, you would calculate it by ...
1 vote
0 answers
179 views
Resolution-independent rendering of crisp 2D graphics (non-pixel-art)
I’m a beginner developing a 2D game in SDL2 using C with a visual style that uses crisp high resolution graphics (like geometry dash and Hollow Knight -- not pixel art). I want the game to scale ...
0 votes
2 answers
159 views
Linked list in C
I only know C, no other language. How do I use a linked list to store projectiles in sdl2? My bullet currently has an sdl_image, has been queried and has the following properties: ...
0 votes
0 answers
45 views
Collision detection for a newbie [duplicate]
I am a freshman cs major with an interest in game dev. I know next to nothing and am very new to this so please bare with me. TLDR; Should I use BSP for detection between moving and static objects as ...
0 votes
1 answer
151 views
Fixing the player movement with SDL2
Whenever I create a project with SDL2, I always encounter the same issue: when I hold down a key (for example, W for upward movement), it moves on the first frame, doesn’t move on the second frame, ...
0 votes
1 answer
115 views
Trouble with Transparent Pixel Blending in PNG
When drawing transparent PNG data on to the renderer, pixel data of any previous drawing (layer beneath) is replaced with the renderer's drawing color (green). I have tried setting blend mode in the ...
0 votes
0 answers
69 views
Invalid Pixel Offset Calculation Fix?
I am currently using a SDL_Texture *texture as a chunk in my world that is being Perlin noised onto to make terrain. Using a 2d array of these I tile the plane. But ...
0 votes
0 answers
80 views
Is there more efficient method of terrain rendering in 2D plane than redrawing millions of SDL_FRect each frame
I want to render terrain efficently using perlin nosie and a lots of rects. Should I use rects or is there another way. Following is my implementation. I use rect size = 1 which is not really ...
3 votes
2 answers
194 views
SDL hello-world program on ArkOS runs without error, but shows no output
I recently bought a R36S retro handheld linux based game console. The system runs ArkOS which is a Ubuntu based OS. On boot, the system launches the program EmulatorStation, but it is possible to exit ...
0 votes
1 answer
98 views
How to get X and Y pixels of a Image in SDL2?
I am trying to create a Voxel Space Engine In SDL2 C++. However the tutorial I am following reads the X and Y pixels of the heightmap image. I can't find a way to do this. I am following this tutorial:...
0 votes
1 answer
145 views
SDL2 oversized pixels
I pulled my SDL2 game out of cold storage and am working to get it running again. I found a curious thing: graphics primitives based on SDL2_gfx and text based on SDL_ttf are displaying way too big, ...
0 votes
1 answer
214 views
How to render a texture in a unique color using SDL2?
(I apologize in advance for my awful English) I'm writing a personal UI library in C++ using SDL2, and when came the moment to implement icons, I struggled to find how to render them in a unique color....
1 vote
1 answer
121 views
Reading steering wheel events has 180 degree dead zone. How to remove/reduce dead zone?
I'm making a GUI that can be controlled by a steering wheel. It need only run on Windows. It works as expected with exception of the fact that the first 90 degrees in either direction seems to be ...
0 votes
1 answer
173 views
Regarding with pixel arrays and textures in SDL2
Currently, the way I render my frames is as follows. I have two arrays of pixels (in SDL_PIXELFORMAT_ABGR8888) called ...