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 ...
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
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
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
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 ...
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
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....
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 ...
0
votes
3
answers
154
views
How to stop scenes from running before switching between them?
So, I've been working on a game dev library using C++ and SDL2 (to test the library out I'm making a Pong clone). And now I'm writing a Scene Manager which is going good, I can switch between scenes ...
0
votes
1
answer
332
views
How to deploy SDL2 game on Steam/Windows — what do I do with the dll?
I'm currently developing a game on Windows using the MSYS2 environment and mingw64. I've successfully installed SDL2 using the msys package manager (pacman) and using CMake, was able to get it up and ...
0
votes
2
answers
252
views
How to setup a loading screen using SDL_Threads?
I am trying to set up a basic toy example of how a loading screen would work in SDL. Here is my code below.
...
0
votes
3
answers
953
views
What is the best way to implement a scene manager?
I'm trying to create a scene manager system for a small framework I'm writing on top of SDL2. I have implemented a scene management system that works, but I am not sure if it is structured how it ...
1
vote
0
answers
382
views
Selecting tiles with mouse on isometric map with height and slopes
I want to implement an isometric map with rectangular tiles similar to how it was in simcity 2000, where tiles could have different heights and tiles with different heights were connected by slopes. ...
1
vote
2
answers
263
views
Would it be practical if I used composition for everything?
I've been learning C++ and SDL2 and I'm trying to improve at using composition and for the longest time I thought it was only useful for making things like players, enemies, coins, etc, and I think ...
0
votes
1
answer
557
views
How to copy the Renderer Present screen result into a surface or texture?
Is it possible to copy into a SDL_Surface what is displayed in the screen from a SDL_RendererPresent?
using ...
0
votes
1
answer
440
views
Rendering Infinite 2D chunks?
I'm working on a top-down 2D RTS with C++ and SDL2, and have implemented the biome/terrain generation, tile rendering and a rudimentary camera system. I already have the skeleton code in place that ...
0
votes
1
answer
352
views
rotating a sprite with mouse cursor
i am learning how to make a 2d game using sdl and c++ and am currently trying to rotate the sprite so that is always facing the cursor, my game is set up with an entity component system, i have a ...
0
votes
1
answer
234
views
Why might performance of a Rust-sdl2 project be better while profiling?
I'm making a simple SDL2-based Rust game, on an OSX laptop. Graphics mostly involves drawing lots of colored squares to the screen. Performance is really slow for what I'm doing, so I decided to ...
0
votes
1
answer
239
views
How to handle UI when logical and screen sizes are different?
I am programming a game in SDL2 and I am looking for advice on how to handle interactivity of UI components when the screen resolution and logical resolutions are different. Up to now I have been ...
1
vote
0
answers
81
views
Garbled text and music - due to Steam Linux runtime change?
My team and I released our game on Steam last year for Windows, Mac, and Linux. The game is written in C++ and uses SDL2, including SDL2_image, SDL2_ttf, and OpenGL for graphics. Around the middle of ...
1
vote
0
answers
128
views
Odd SDL VSYNC behaviour when monitor is set to 50 Hz
I am observing strange behaviour with VSync in SDL. I have this code:
...
0
votes
0
answers
1k
views
how do I chage pixel color? (SDL2)
After a long time away, I'm coming back to SDL, using version SDL2.
I have some example code that does pretty much exactly what I want it to do, but I want to change the pixel color. Ive tried ...
0
votes
1
answer
785
views
SDL2 and TmxLite (Tiled) (Reading the actual TILE data from the layer)
I am trying to make use of the Tiled Map Editor for my SDL2 projects. (By using the TMXLITE parser from Fallahn on Github) https://github.com/fallahn/tmxlite
...
0
votes
0
answers
160
views
SDL_BlitSurface() 'dstrect' - Not working as I expected
I am new to SDL but have used C++ a fair bit over the years. I'm struggling with displaying sprites with a scale. EG. Here I am trying to draw a grid of squares (ie. Tetris) but the source BMP is ...
0
votes
0
answers
1k
views
OpenGL Multisampling doesn't work
I am trying to get the Antialiasing (multisampling) in OpenGL with SDL to work(as shown here), but the result doesn't change and I still get jaggy edges.
Before rendering I call the following ...