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.

0
votes
2answers
161 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
70 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
623 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
95 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, ...
1
vote
1answer
73 views

SDL2 mouse motion event keeps occuring

The code I'm using is like so: ...
1
vote
1answer
113 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
103 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
69 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
361 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
78 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
65 views

Inverted left & right stick axes in SDL2

I've faced a weird problem with SDL2. ...
0
votes
2answers
252 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 ...
0
votes
0answers
42 views

data is losing with sdl_net and tcp. please help me

im sending data from server.exe like this ...
1
vote
1answer
41 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
61 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
461 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
0answers
102 views

Newer version of OpenGL slower on older hardware (SDL + Mac)?

I have a test program that runs basically exactly the same code between a OpenGL 2.1 compatibility and 3.3 core context (from SDL 2) which I was using for testing migration of a code base (there's no ...
0
votes
1answer
298 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
321 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 ...
0
votes
0answers
886 views

corrupted size vs. prev_size: 0x09584448

im working on a menu which has 3 buttons(play,story,quit) and i want to make effects for the buttons. I tried to use SDL_mousemotionn but the program goes wrong like for example when i enter the zone ...
1
vote
1answer
89 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
171 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
72 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
253 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
128 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
304 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
692 views

How can SDL tell what Xbox360 controller is what player?

I init my controllers like this: ...
0
votes
2answers
61 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
2k 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
221 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
440 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
364 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
67 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
377 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
95 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
103 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
271 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
295 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
650 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
94 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
287 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
499 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
247 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
201 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
67 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
229 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: ...
2
votes
1answer
91 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.....