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
31 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
36 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 ...
3
votes
1answer
140 views

Passing an SDL KeyboardState(Uint8*) to Lua

I'm working on my first big project and I've decided to integrate Lua with my C++ framework. Everything's worked out so far, but the only way I've managed to pass the SDL_GetKeyboardState(NULL) array ...
2
votes
1answer
101 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
40 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; ...
1
vote
1answer
77 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
3answers
6k views

Altering pixel value in an SDL2 texture

Alright, I have spent a lot of time on this one, so I need some help. I like the ability to draw pixels directly to the screen, sometimes I do this to trace the path of objects for debugging etc. In ...
1
vote
1answer
23 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> #...
3
votes
3answers
16k views

SDL for 3D game programming? [closed]

I have been studying SDL for a few weeks and I have succeeded in making a 2D Ping-Pong game, but I want to get started in 3D development, and I'd like to know if SDL is capable (and suitable) for 3D ...
3
votes
1answer
26 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 ...
1
vote
2answers
365 views

Multiple keys being pressed, some being ignored SDL

I'm making a two player pong clone and my problem is that when the second player presses both of his/her buttons at once, the first player locks up and cannot move, even though this does not happen ...
0
votes
1answer
50 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 ...
1
vote
1answer
88 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
3answers
415 views

Moving one object from one point to another with acceleration

How would someone implement moving an object from one point in 2D space to another using these formulae to update objects: m_position.setX/Y( m_position.X/Y() + m_velocity.X/Y() * dt + 0.5 * m_acc * ...
4
votes
2answers
343 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 ...
0
votes
0answers
210 views

Artifacts rendering high-poly procedural meshes with OpenGL

I am having some issues when rendering some procedural generated meshes. There are some really wierd artifacts when rendering high-poly count meshes (not that much actualy). I have been able to ...
-1
votes
2answers
3k views

making a game in 2D(C++). SDL or openGL? Or, why not both? [closed]

I'm trying to make a platform game in 2D and I want to know what tool should I use to make it happen. I understand that I can use SDL with openGL. However, if I want to make a solid 2D platform game, ...
0
votes
1answer
39 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
38 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
178 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
52 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
64 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
27 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 ...
3
votes
1answer
177 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 ...
0
votes
4answers
82 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 ...
0
votes
2answers
268 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 ...
0
votes
2answers
178 views

Redefining the SDL rect struct

Upon checking the docs of SDL (1.2) I saw that the SDL_Rect struct defines the x and y as Sint16. I'm making a bitmap font text scroller and I need those specifically to be unsigned ints because the ...
0
votes
1answer
59 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
87 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
3answers
454 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 ...
1
vote
1answer
157 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
129 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 ...
1
vote
3answers
2k views

My SDL Game executable cannot run outside codeblocks

After compiling and running SDL programs successfully inside CodeBlocks, when I run them outside CodeBlocks (by clicking .exe file) my program does not run. Instead, it says that libstdc++6.dll is ...
0
votes
1answer
66 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
96 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
44 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 ...
5
votes
0answers
91 views

OpenGL: Frame partially jumps back and forth

I'm working on a project with SDL and OpenGL. The game works great on Windows, Linux, OS X and iOS. However, the Android version is showing a problem on my phone in particular. I have tested another ...
-4
votes
1answer
124 views
0
votes
1answer
62 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
414 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
270 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
86 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
129 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->...
2
votes
0answers
224 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 ...
11
votes
2answers
4k views

What should I worry about when changing OpenGL origin to upper left of screen?

For self education, I'm writing a 2D platformer engine in C++ using SDL / OpenGL. I initially began with pure SDL using the tutorials on sdltutorials.com and lazyfoo.net, but I'm now using SDL to ...
1
vote
2answers
215 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? ...
2
votes
1answer
118 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 ...
2
votes
4answers
3k views

SDL zooming/upscaling without images becoming blurry?

I'm working on a game with 32px tiles and I have one question regarding this and scaling. When I try to see my game fullscreen my image just becomes blurry. I remember playing NES games and when the ...
2
votes
2answers
88 views

Unable to move character to right position using SDL?

I am currently having problem moving a character right and showing him like he's running but after i press right key it moves right for one time and then when i enter left it goes left again but ...
0
votes
1answer
394 views

How do I modify textures in SDL with direct pixel access?

I'm trying to use SDL_LockTexture and SDL_UnlockTexture for directly editing pixels in a texture. I'm using SDL 2.0. Setting the pixel value using the following code doesn't modify the texture: void *...