All Questions
23
questions
0
votes
0
answers
48
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 ...
2
votes
0
answers
833
views
Manual per-glyph rendering with SDL_TTF
I'm trying to create a font atlas with SDL_TTF. My idea was to create an SDL_Surface for every character using ...
1
vote
1
answer
1k
views
C++ SDL2:2D tilemap with every tile has its own behavior
I am working on 2D tile based game.
I want to render the tilemap from a file but every tile has its own behavior
for example:
magmablock : poorlava();
slimeblock : knockback();
I have this ...
0
votes
1
answer
2k
views
How to pass renderer through classes?
I am making a game with SDL and C++. I am trying to render simple image to the screen but I can't. I am not getting any error but I see only black screen.
I think because the renderer in ...
1
vote
1
answer
2k
views
SDL2 doesn't render a window
A tutorial's code from LazyFoo wonderful place's 01_hello_SDL page doesn't show a white form, but a desktop's screen, like a screenshot. Something like:
The code:
...
3
votes
3
answers
4k
views
How to render top-down perspective in a tile-based RPG?
My question is specifically about the type of perspective that GBA Pokemon games like Fire Red/Leaf Green have:
I'm not sure of the correct terms for what I'm trying to achieve.
I am using SDL2 and ...
5
votes
1
answer
5k
views
SDL render surface from byte array efficiently
In my current project I need to fill a 256x224 screen with the pixel values from an array. The array is declared this way:
uint8_t *vram = new uint8_t[7168];
So as ...
0
votes
0
answers
35
views
SetColorMod() with mini delay when the texture is rendered for the first time
I have one image.png that I load using SDL_IMG. I load by creating a surface. Then I create a texture using CreateTextureFromSurface() and I free the original surface. I repeat the same process but ...
0
votes
1
answer
1k
views
How to draw geometric shapes to a texture?
How can I create a texture containing a geometric figure using SDL2?
I saw there is a way to convert Surface to Texture, and I also saw that there is a way to draw directly to the screen using ...
0
votes
1
answer
545
views
How do I render to a texture loaded from a PNG file using SDL2
I'm trying to create a simple 2D game using C++ and SDL2.
I thought it would be a good idea to go for a "layered" rendering model.
I would render my background first, then the world, then the ...
1
vote
0
answers
733
views
Drawing realistic 2d waves with SDL2 and Rust [closed]
I am making a very simple 2d topdown sailing simulator with Rust and rust-sdl2. I am having a very hard time figuring out how I should implement wave rendering. My current idea is to use a ...
2
votes
2
answers
1k
views
SDL2 Textures bleeding / 1px border around tile maps - SDL_RenderCopyEx taking integer arguments
https://forums.libsdl.org/viewtopic.php?t=9486 This post gives a good indication of my question.
Basically if you set SDL2 logicalScale or otherwise and render textures at native window resolution ...
0
votes
1
answer
114
views
SDL2 Rendering based on frames
Is it possible to render a particular object on the screen for a certain number of frames without having to delay the rendering? Thanks
5
votes
3
answers
6k
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 ...
0
votes
1
answer
6k
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 ...
3
votes
1
answer
3k
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 ...
3
votes
2
answers
10k
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
947
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
1
answer
3k
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]
...
1
vote
0
answers
2k
views
How to draw 2D pixel data with OpenGL
I am fairly new to OpenGL. I have a 2D game in SDL2 that uses currently works by creating a SDL_Surface from the pixel data, copying it into a ...
3
votes
1
answer
7k
views
Fastest way to render image data from buffer
Currently I am doing my rendering by using a 3D array window_width x window_height x rgb as a buffer, then looping through the buffer and plotting pixels on screen using SDL2 (SDL_RenderDrawPoint). I ...
0
votes
2
answers
1k
views
Kerning between glyphs using SDL2_ttf
I'm loading a number of characters (using SDL2_ttf) into a texture atlas to improve performance.
The glyphs can be separately rendered correctly, however, how can you find the kerning distance ...