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.

Filter by
Sorted by
Tagged with
1
vote
1answer
769 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
342 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
257 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
80 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
311 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
100 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
303 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 ...
0
votes
1answer
704 views

Is there a way how to handle multiple SDL_PollEvent loops without clearing the event queue?

Is there a way how can I handle more SDL_PollEvent while loops for one SDL Event, without taking the events off from the event ...
1
vote
1answer
478 views

SDL2: Why is my player's position not updating?

I've just started getting into game development, SDL in particular, so please go easy on me. I'm struggling to understand why my player's position isn't chaning when I press the left arrow button. ...
1
vote
1answer
61 views
1
vote
1answer
145 views

SDL Player do something for 3 seconds then stop

I'll make my player respawn after 1 of his lives is taken, but I want him to be invincible for 2 or 3 seconds and not instadie again because he will be in the way of enemy bullets. ...
1
vote
1answer
132 views

SDL Detect change score

I have this in my loop , it works but I get verry low fps and game is working in slow motion : ...
0
votes
1answer
766 views

SDL TTF render variable

This is the way I render the score in my main game , and I made this new project to understand how to use it... It works , the score is updated and it display on the screen but the problem is memory......
2
votes
2answers
534 views

SDL_RenderDrawLines isn't drawing complete geometry

So I am trying to draw hexagons with [SDL_RenderDrawLines][]. It looks to be working fairly well, however, it fails to draw some of the lines. So each of the ...
0
votes
1answer
707 views

C SDL render text?

I'm making a game in C using SDL library and I want to display a score. I have 9 photos with numbers from 0-9 and I want to know if I can use them somehow to display score, if my score is 2679 the ...
0
votes
2answers
388 views

How do I handle a lot of big textures for a visual novel?

I am writing a visual novel on my desktop, using SDL and C++. I'm having trouble handling my sprites, in SDL. I am getting the "not enough video memory" error when I create all of my sprites to ...
-1
votes
1answer
760 views

What is the difference between OpenGL, SDL, DirectX, GLFW, GLUE?

I have not work with graphics yet but I'd like to know its concepts at some high level overview. I was told that OpenGL and DirectX are somehow programmed into my graphics card, and I can use GLFW, ...
0
votes
1answer
137 views

Errors in Xcode using SDL

I am using Lazy Foo's Production tutorials for making an SDL game in C in Xcode 6.1 - http://lazyfoo.net/tutorials/SDL/index.php#Hello%20SDL. I'm using Xcode 7 but I don't think they are very ...
0
votes
2answers
128 views

Build SDL_Surface before blitting it

I have a function in which I'm looping y and x over my array of sprites. That's a lot of loops, and it is very slow; I'd like to ...
2
votes
1answer
828 views

Check if SDL Window is open

I need to check if the game's SDL Window is open before I can start rendering graphics, normally I would know how to this, but the problem is the window is created in the main class, and I need to ...
0
votes
1answer
93 views

SDL2 application occasionally refuses to close [closed]

I've been working on a sliding puzzle/game of fifteen clone in SDL recently. A problem I've had is that when I close the game the app isn't always removed from the dock and I can't force quit it. It ...
0
votes
2answers
1k views

My C++/OpenGL “Hello Triangle” Code Does Not Draw A Triangle When Using SDL As A Window Library

I have been using the website Learn OpenGL but I am using SDL as a window Library. My code seems to builds the window correctly but no triangle appears. I am compiling my code using Visual Studio ...
0
votes
1answer
2k views

Is it possible to use C++ in SDL for Android?

I have successfully compiled SDL for Android using the example, which uses C. Is it possible to use C++ too? I am trying to port a C++ game which uses SDL 2 to Android. If it is possible, how can I ...
0
votes
1answer
22 views

Setting Square to Dim in Color on MOUSEUP

I'm trying to create a simple recreation of the popular memory game "Simon" using C and SDL2. The idea is that the game is a small window with four squares of different colors that are purposefully ...
0
votes
1answer
1k views

Fast texture pixel access using SDL2

People have asked questions on fast pixel manipulation, but I'm looking to read the RGB color values of each pixel. I've heard of SDL_RenderReadPixels but in the ...
2
votes
2answers
1k views

Game Loop getting 58-62 FPS. Why not exactly 60FPS? (SDL/C++/OSX)

Here's my game loop: ...
1
vote
1answer
10k views

How to set up OpenGL for CLion on Windows [closed]

Can someone give me a simple step-by-step on how to set up and compile a simple "Hello World!" program on CLion using OpenGl/SDL/Freeglut . I see a lot of tutorials on Visual Studio, but CLion uses ...
0
votes
1answer
44 views

How to get rid of an image upon collision detection in SDL?

I am fairly new to SDL in C, but I have written a simple game whereby a character has to reach the end of a level and avoid bad stars on the way. If he hits a star, he dies. There are also good stars ...
0
votes
0answers
36 views

Hidden textures [duplicate]

How do the developers of games "hide" textures from editing. For example in game called Faster Than Light which is made in c++ using SDL. There is no directory with graphic files. How to "hide" ...
1
vote
2answers
1k views

SDL Memory leak with TTF_Font and surface

I am creating 2D game with SDL2, and I have a problem with my label class. Every time I construct new label I have a memory leak, and I don't know what I do wrong! For example, I want to refresh ...
1
vote
1answer
1k 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] ...
4
votes
1answer
862 views

C++ SDL OpenGL minimise / restore window issue

I'm partway through developing a 2D game in C++ using SDL and OpenGL; my IDE of choice is CodeBlocks. I've hit an issue that I can't seem to get around. Basically, if I minimise and then restore the ...
0
votes
2answers
386 views

SDL: Certain bitmap not displaying

I have come across a very wierd problem. Here is my code: ...
2
votes
1answer
99 views

Control Entity Moving Speed Without Using a Delay Function

In a Tetris game I'm trying to make (using C++/SDL), I need to control the falling speed of, say, one block. I have successfully done this by incramenting its y ...
0
votes
1answer
244 views

C++/SDL Snake Game: Drawing Tail Crashes Game

I"ve been making a snake game in C++ using SDL (first game and first time using SDL), and I've run into a bug. As the tail of the snake gets longer, the game slows down (snake gets slower), and ...
24
votes
8answers
9k views

What advantage do OpenGL, SFML and SDL have over software rendering?

I started watching the Handmade Hero stream, where Casey Muratori creates a game engine without using frameworks or such. Yesterday I got to the part where he showed how an image is drawn onto the ...
0
votes
1answer
52 views

Can't read input from keyboard

I'm new to game dev,and I just trying to create my first game,a simple pong game.But i can't handle the keyboard input. This is what i got : ...
-1
votes
1answer
55 views

Why I'm not getting any kind of output in SDL?

Here's the code that supposed to display the texture: ...
2
votes
1answer
480 views

Having issue's with a confusing access violation? - C , OpenGL 3.3+ , SDL 2.0+

Hello this code seems so well done and yet I'm getting this weird access violation error when I use anything but 0 in glShaderSources 2nd argument : ...
5
votes
2answers
1k views

How to use SDL_TTF's outlines

This might be a basic question but googling isn't turning out anything useful: How are we supposed to use TTF_SetFontOutline ? I know we're able to create an outline (and it looks alright) but since ...
1
vote
2answers
2k views

Resolution scaling

I'm currently working on a project and I'm happy with the UI design: Being the fool that I am, I decided to only design my UI for one resolution, and now that I want to have the user be able to ...
0
votes
4answers
94 views

Issue translating objects by one unit in the y direction

I'm currently making space invaders (in OpenGL/SDL) and I'm running into an issue with the movement of the aliens. I have a 2-d vector of aliens (5 rows of 11) and I'm translating each in the x ...
1
vote
1answer
181 views

Sprite quickly disappears after rendering

I'm currently making space invaders and I'm using the game loop pattern as described here. I have an entity class from which there is a spaceship derived class. The base entity class contains all of ...
0
votes
1answer
459 views

Simulate Keyboard Button Press [SDL Library]

I am trying to simulate an SDL keyboard button press (using C). I have looked up the SDL info pages online but I still don't have anything that consistently works. I have the following (removed the ...
1
vote
1answer
147 views

Sprite Sheet Texture not being rendered

I'm making space invaders (in OpenGL/SDL) and I've run into a problem when trying to draw the sprite for the spaceship from the spritesheet. In my entity class, I have a pointer for the sprite that ...
1
vote
2answers
2k views

SDL or SFML: which is the best option if I only want to use OpenGL for my graphics? [closed]

I've read a lot about creating graphics with OpenGL in SDL and SFML over the past few days, and I want to know which one I should pick. As mentioned in most of the things that I've read, both allow ...
1
vote
2answers
239 views

Issue with detecting collisions in Pong

I've been working on making Pong in OpenGL and SDL and currently have both paddles and the game ball set up properly. I have an Object (or Entity) class which is used to instantiate each of the ...
1
vote
1answer
1k views

How can I render a texture to a polygon in SDL2? A fake 3D problem

I am working on a fake 3D game recently. The game is based on the perspective principle and using angular perspective. Here is a screen shot: But the problem is that the walls and floor displayed ...
4
votes
0answers
690 views

Windows vs OSX Performance with SDL, OpenGL [closed]

I have been writing an SDL OpenGL game in c++ for a couple of years now, writing my own engine for the most part (using Box2d for physics). I'm primarily a mac user, so I've been using xCode to write ...
0
votes
3answers
3k views

Cannot load png images to textures with SDL2 in Visual Studio 2015

I'm learning SDL2 with Visual Studio 2015 and I'm trying to draw a 16x16 level with a .map file and 32x32 .png images for tiles (that's 256 tiles) on a 512x512 window. I have both SDL2 and SDL2 Image ...