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.

learn more… | top users | synonyms

0
votes
0answers
66 views

How to create a bordered fullscreen SDL window (like Terraria's)

I'm coding a 2D platformer in SDL and c++ with visual studio and am wondering how to create an SDL window (with a border), that covers every part of the screen except the taskbar.
0
votes
0answers
30 views

Merging multiple vertices into one (OpenGL)

I have a class where it crates a cube, load a shader, and render it, but i would like to know, how do I create two cubes, with two different vertices, two different matrices, and then merge these ...
0
votes
0answers
33 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
30 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
43 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
0answers
46 views

Deferred rendering black screen

UPDATE: I have discovered something. If i change the final display to be respect the, for example, normal map it is showed for a instant before disappear and become all black again. Could it be a ...
0
votes
1answer
81 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
21 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
46 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 docs it says: WARNING: This is a ...
1
vote
2answers
153 views

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

Here's my game loop: uint64 target_fps = 60; uint64 ticks_per_s = SDL_GetPerformanceFrequency(); uint64 target_ticks_per_f = ticks_per_s/target_fps - (ticks_per_s/1000); //aim for (target - ...
0
votes
1answer
221 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
20 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
105 views

C++ - Is this a good way to handle GUI events?

I am developing a UI framework for my game (SDL2, C++). I have a ScreenManager class which manages a list of UI widgets on the screen (text, buttons, etc.). The function below builds the main menu ...
1
vote
0answers
151 views

sdl-based open source game that works on android? [closed]

I'd like to create a game that uses SDL2 and that works on many platform, at least on Android. I'd like to see some open source code of some other small video game before starting.. especially how ...
0
votes
0answers
33 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
1answer
80 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
73 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] #ifndef __Game__ #define __Game__ #include <string> #...
2
votes
1answer
148 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
1answer
69 views

SDL: Certain bitmap not displaying

I have come across a very wierd problem. Here is my code: #include <iostream> #include "SDL.h" using namespace std; class MyGame { public: SDL_Surface* image; SDL_Surface* window; ...
3
votes
1answer
34 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 value then setting SDL_Delay(200). So ...
0
votes
1answer
80 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 ...
0
votes
1answer
40 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 : const Uint8 * keystates = SDL_GetKeyboardState(NULL); ...
-1
votes
1answer
42 views

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

Here's the code that supposed to display the texture: SDL_RenderClear(renderer); SDL_RenderCopy(renderer, mainRaster.getOutput,null,null); SDL_RenderPresent(renderer); The code that runs the update ...
3
votes
1answer
207 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 : glShaderSource( fragshader, 0, fragfilebuff, NULL )...
3
votes
1answer
80 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 ...
0
votes
2answers
114 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
0answers
45 views

Box2d capsule stumbles on ground

I am working on a game with box2d and sdl. I Created a character and some boxes as ground, but faced the problem where the character would run a few meters, and stumble on one of the boxes' edge. I ...
0
votes
4answers
83 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
93 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
94 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
90 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
475 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
144 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
272 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
186 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
740 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 ...
0
votes
1answer
103 views

SDL Combining text and Geometry Rendering to one texture

Basically I'm trying to end up with a Texture class that can take in text and have it be drawn over simple geometry (such as a letter 'A' over a filled rectangle). However I'm running into issues when ...
1
vote
1answer
110 views

Fixed-Timestep still updating too fast

I'm trying to figure out if I'm approaching my simple fixed-timestep implementation correctly, following examples such as: Gaffer (without RK4), and DeWitters Currently, I have a game object which ...
0
votes
0answers
50 views

How to parse a and displat TMX map object in SDL using tmxparser ?/How to make a platform game using tiled editor and SDL?

I am newbie in this field getting too much trouble in simple platform game for one of my project module if you guys could help or share some code. This is what I have done till now. I could parse a ...
-4
votes
1answer
173 views

Can we port any game written in C++ with SDL to Android platform or we would need to change some codes too? [closed]

Just wanted to lean a cross-platform library!! Since SDL library supports iOS too..
0
votes
1answer
74 views

SDL2 and density-independent pixel

I'm currently using SDL2 on Android and that's my first experience with that library (to be honest, mainly chosen because I'd like to learn it). What is puzzling me is how to deal with different ...
2
votes
1answer
707 views

Why does SDL_RenderCopy result in a blank screen?

I'm trying to render a texture(picture), but SDL_RenderCopy keeps the window's background black. Here's the relevant code: SDL_Rect rect; rect.x = 0, rect.y = 0; while(!quit) { SDL_RenderCopy(...
1
vote
1answer
417 views

Version 320 is not supported, SDL C++

I have the following four lines before I create the window. SDL_Init(SDL_INIT_VIDEO); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_SetAttribute(...
1
vote
0answers
98 views

SDL-2.0 library not working with codeblocks-13.12-mingw-tdm [closed]

I started following lazyfoo's sdl 2.0 tutorials. This is the very first tutorial that explains how to set up SDL 2.0 with code::blocks - SDL 2.0 with code::blocks setup. I am doing exactly what it ...
2
votes
1answer
247 views

OpenGL not rendering textures

i'm using OpenGL 2.1 with SDL2.0 and i'm trying to render a texture, using this steps: load the image: Image* image = new Image(); image->image = SDL_LoadBMP(path.c_str()); if (!image->...
3
votes
1answer
223 views

How can I separate processing input and update?

I know that game loop is broken up into three distinct phases: processing inputs, update, and render, but I just can't see how I can make processing input and update independent of each other. Let's ...
2
votes
0answers
284 views

OpenGL textures make very low fps

I loaded some textures just one time before I go to my mainloop(glutMainLoop). I am using SDL for the texture loading. However, when I compile, my game is running at 6-10 fps. When I don't load the ...
4
votes
2answers
761 views

How to calculate delta time with SDL?

I have heard that you can calculate delta time with two functions called SDL_GetPerformanceCounter and SDL_GetPerformanceFrequency. I'm not sure how they work completely, but I heard it is a bit ...
1
vote
2answers
336 views

OpenGL SDL Texture doing really weird things

I am trying to render a .png image to the screen using C++, SDL and glut. This the texture I made using paint This is what I get on the screen: Does anyone have an idea what could cause this? How ...
2
votes
1answer
143 views

Texture Not Rendering in C++ SDL OpenGL(glut)

I don't understand why my texture("texture.bmp"), is not showing on the screen. Please help me. The whole drawing function: ///HERE EVERYTHING IS BEING RENDERED void Main::display(){ int ...