Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sdl]

Simple DirectMedia Layer (SDL) is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.

1
vote
1answer
57 views

C++ OpenGL texture warping

I'm currently doing simple 3D drawing in OpenGL but I have hit a roadblock I just can't seem to get around. The problem is happening with trying to load .obj files. I've written my own .obj reader. I ...
1
vote
1answer
18 views

How to make texture for text displaying using SDL ttf with good performance?

In my game, there are many units and for each units there's an information widget attached next to them. I use SDL as the game rendering engine. I currently want to display their ID for debugging ...
0
votes
2answers
184 views

How can I benefit when I don't use gpu?

I am trying to make a 3D game with C++, SDL, and OpenGL. My program roughly looks like this: control function has only CPU operations. draw function has CPU and OpenGL functions operations. I just ...
0
votes
1answer
86 views

How should rendering be structured using SDL?

This question is probably well documented but I can't find any resources. Basically I'm not sure how to structure rendering with SDL in my code. I made a render class which calls the api and the ...
1
vote
1answer
642 views

Why can't this simple SDL app be closed without task manager or rapid clicking of x button?

I wrote a simple app that generates a window, a raster, and redraws the raster once every 16ms. Right now the calculations are empty, it just draws a solid color. I don't know how, but I have created ...
0
votes
1answer
131 views

SDL Sliding Collision

I'm working on a 2D SDL C++ project, and I'm having a bit of trouble with collision detection. Currently the player collides with the edges of the level and with the SDL_Rect objects in the level, ...
3
votes
1answer
149 views

SDL2 mouse motion event keeps occuring

The code I'm using is like so: ...
1
vote
1answer
205 views

OpenGL draw functions and multi-threading. How they work together?

I want to apply multi-thread in a simple way to control and draw 4000 objects. I am using SDL and OpenGL. control : locations, collisions, calculations ... etc draw : OpenGL draw functions ...
0
votes
1answer
174 views

Should I call SDL_ConvertSurface right before SDL_CreateTextureFromSurface?

Is there a significant benefit (or any benefit at all), when I convert SDL surface and create a texture from optimized surface? Here is example of what I mean: ...
1
vote
2answers
110 views

Is it possible to make desktop visible behind drawn object using SDL2?

I would like to draw an avatar over the desktop, something similar to those word 97 assistants, my idea so far is to make only the background transparent but I haven't had any luck, any suggestion? is ...
1
vote
1answer
480 views

How do I check if a window has focus in SDL2?

Is there a replacement for SDL_GetAppState function in SDL2 from older SDL versions? Why was it removed? I want to use it so I can check if the user has focused the ...
0
votes
2answers
88 views

SDL2 only renders a single image

As an attempt to learn SDL on C, I decided to try and create a simple Pong program using it. My problem now is that of the textures I've given it, two paddles and a ball, only the ball is rendered. It ...
0
votes
0answers
73 views

Inverted left & right stick axes in SDL2

I've faced a weird problem with SDL2. ...
0
votes
2answers
315 views

SDL/C++ Keyboard Input

I'm having trouble with key management. Movement works fine but the shooting does stuff that I don't want to happen. Every time I press the arrow keys to shoot it works fine but when I press a key ...
1
vote
1answer
42 views

Why do I only receive the first message I send with SDLNet?

I am sending two messages from server.exe like this: ...
1
vote
1answer
67 views

Is there a way to duplicate the windows desktop zooming in SDL to make low res pixels look like stylyzed cartoon art?

When you hit the Win key and numpad plus key at the same time it opens the desktop magnifying glass and the effect of this on low res pixel art is to make it look like super cool stylized cartoon art. ...
2
votes
1answer
618 views

Why does SDL2 blur pixel art even with SDL_HINT_RENDER_SCALE_QUALITY set to 0?

I am working on a game with SDL2 and having trouble turning off linear filtering when upscaling textures. My game has a bunch of 32x32 tiles. I used ...
0
votes
1answer
351 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 ...
-1
votes
1answer
345 views

How can I build DOOM (SDL-Version) with MinGW?

I have recently been trying to build this source code here. I am building the original port with SDL infused, not the linuxdoom port and I’m having some issues. What I have tried first: I've ...
1
vote
1answer
121 views

Change the image of sdl window with a new one

I will make a game and it has 3 buttons on its menu. Those buttons supposed to change the picture the background of the menu When i click on play, another picture should appear like so I found a ...
-1
votes
1answer
173 views

Is my frame rate being calculated correctly?

I'm having a long headache (which may not be that complicated) with this frame rate thing. I already tested several frame rate algorithms, lastly I tested this here and they all gave something strange ...
1
vote
1answer
74 views

Weird issue with Member Initializers C++

I'm making a game with C++ and SDL2. I have a class called "text" and a class called "buttonObj" The constructor of "text" is a void function that takes an SDL_Color variable. The first part of ...
0
votes
1answer
313 views

How can I read an image from a binary file?

I'm trying to put all the assets inside a binary file and then trying to read them from the file itself, without scattering all them around in separate folders to let them exposed. What I'm trying to ...
3
votes
1answer
1k views

How to properly manage memory in SDL2?

I have yet another question regarding SDL2. I have some drawSprite & drawBackround & ...
0
votes
1answer
155 views

Fading in textures at a constant rate over a controlled duration

I'm trying to fade textures onto the screen using SDL2. I've tried some different methods I've looked up, but I always encounter the same problem. It seems that the fading takes longer and longer as ...
1
vote
1answer
359 views

How to use SDL_RWops and SDL_RWseek to read text files, line by line?

I'm right now looking for alternative ways to read text files on a line-by-line basis, for cross-platform compatibility (Windows / Linux). My current solution is to go look for (or seek out) the ...
2
votes
1answer
823 views

How can SDL tell what Xbox360 controller is what player?

I init my controllers like this: ...
0
votes
2answers
70 views

SDL_TTF Manual Line Ending

With SDL TTF I've already gotten automatic line wrapping down using the built in "wrapped" function. However, now I want to do what I guess you could call manual line wrapping. Basically, at certain ...
1
vote
2answers
3k views

SDL2 GUI (same window)

I have a problem: I working on a simple game and want to use some GUI (think of simple input for player name, etc). I've googled a lot of GUIs that can be used with SDL, but: Most of them are using ...
1
vote
1answer
294 views

SDL2 dragging a sprite with mouse

I am trying to figure out how to drag a sprite. I know when the mouse is being hovered, pressed, or released over a sprite. I don't know how to tell if the mouse is being pressed and moved at the same ...
2
votes
1answer
505 views

SDL2 C++ Program Behaves Badly if FullScreen Mode

I'm making an app with SDL2. I've gotten everything to work so far, including SDL_TTF. When I run my program in a normal window, everything works great! However, now I'm trying to add fullscreen ...
1
vote
1answer
390 views

SDL Mixer Strange Error Message

I have a Visual Studio C++ project. I've just started out with SDL, and I've already rendered images, text, and now I'm trying to play audio. This will be done with the SDL_Mixer extension library. ...
2
votes
1answer
77 views

Why am I hitting a small character limit when rendering with SDL_TTF?

I'm making a text based game using SDL2 and SDL_TTF. I just started working with TTF, and I've noticed there is some kind of character limit regarding how much text you can render at a time! I can ...
0
votes
2answers
419 views

Multiple Object Collision SDL

I figured this is would be the correct place to ask the following ... 1) How would I go about making multiple object collision detection (Bullets For Example)? 2) How would I make it efficient ...
2
votes
1answer
109 views

Creating a scrollable area

I am trying to create a ListBox where each ListItem is just some text. I can make it so if a ListItem goes off the ListBox's height then don't show it. This is just a simple if statement in my render ...
1
vote
1answer
112 views

Loading texture from constructor doesn't work but does from function call

I am trying to load a SDL texture through my class's constructor. All I'm doing is calling a function from the constructor to load the texture. As mentioned in the title, this does not seem to work. ...
0
votes
1answer
288 views

C++ SDL Bullet shooting problems

I'm coding a C++ SDL game and now I got a problem with my bullets. If I shoot, bullets should fly away in a straight line according to the player's angle. That's ok but how can I copy multiple bullets ...
1
vote
1answer
387 views

SDL 2.0 OpenGL not drawing anything except background

My 'hello triangle' compiles well, no errors, but doesn't drawing anything. Here's my code: main.cpp ...
2
votes
0answers
710 views

Using SDL instead of Allegro? [closed]

While looking for a cross platform library for game development, I came across both SDL and Allegro. After extensive research on fora, it seems SDL it way more widely used than Allegro is. I got the ...
0
votes
1answer
104 views

C++ — How could I create a list that contains functions, and would either run the top or iterate through and run all?

I'm not sure how to phrase this to be perfectly accurate to my goal implementation I need a dynamic scene/menu system. I'm going to create a base class and inherit in two other classes specific to ...
0
votes
2answers
95 views

How can I fix the vibration in my Player movement?

Edit: solved my issue, but look at the other answer I am stuck with a problem that I cant quite figure out. When I move my Player to a new point, it does get there, but it vibrates. I can't seem to ...
-1
votes
1answer
69 views

How can I replicate jQuery's slideDown animation in SDL?

I'd like to know how I could make a slideDown animation in C++ using SDL. How would I implement the animation in SDL?
1
vote
1answer
333 views

How to properly setup unit testing for my c++ game project? [closed]

I'm currently creating a 2d game in C++ using visual studio and utilizing gtest/gmock for my testing framework. The problem I'm having is I'm not sure what my best option is for testing. I'm using SDL ...
1
vote
1answer
600 views

SDL_RenderPresent is writing over the previous frame

Whenever I call SDL_RenderPresent, the previous frame is replaced with black before the new frame is displayed. It's almost like when I call ...
1
vote
2answers
277 views

C++ SDL Vector of Textures Storing NULL Objects

I'm attempting to (re)learn C++ by making a top-down shooter game using SDL. In my game, I have created a Graphics class that handles all of the drawing, textures, ...
1
vote
0answers
227 views

SDL C++ Flood Fill Performance

I'm using SDL and I need to quickly fill a lot of polygons (fake 3D walls, made linking calculated points with the SDL_RenderDrawLine() function, that I need to ...
0
votes
1answer
78 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
0
votes
1answer
264 views

OpenGL 2D Origin in Upper Left Corner

I got an OpenGL Context Working in SDL, and I'm trying to set it up so I can render with pixel coordinates of the screen. I got this trying to fill the entire screen with a white rectangle: ...
1
vote
1answer
94 views

Proper way to load assets with a FSM transition between menus and actual game

So far I am making a game in C++ and SDL, and the way to switch between the different menus and the actual game is via a Finite State Machine, AKA a stack where I put each state (MenuState, GameState.....
0
votes
1answer
269 views

How do I handle resolution change in OpenGL and SDL2, in combination? [duplicate]

How do I handle resolution change in OpenGL and SDL2, in combination? Let´s assume I have a GUI window with a fixed position, so it will be on the right corner of the window, and after resolution ...