Questions tagged [sdl-2]

For questions and issues regarding Simple DirectMedia Layer 2 (SDL2). If you're using SDL 1.2, use tag [sdl-1.2]. If you're questioning the library in general, use tag [sdl].

Simple DirectMedia Layer 2.0 (SDL2) is the second generation of a popular open source cross-platform library that provides a simple interface to graphics, sound, and input devices. The new version comes with lots of new features such as full 3D hardware acceleration and the less restrictive zlib license.

Resources:

2910 questions
1
vote
3 answers

SDL2 Key repeat delay

I'm trying to develop a robust game input system with SDL 2.0.1. I want there to be no input lag at all. I used to do this with SDL_GetKeyboardState(), but I switched over to using SDL_Event and SDL_PollEvent() to have a uniform interface for…
RaptorDotCpp
  • 1,425
  • 14
  • 26
1
vote
1 answer

SDL2 - RenderPresent taking 20-30+ms randomly (in a Node.JS FFI call)

I've been updating a Node.JS FFI to SDL to use SDL2. (https://github.com/Freezerburn/node-sdl/tree/sdl2) And so far, it's been going well and I can successfully render 1600+ colored textures without too much issue. However, I just started running…
Freezerburn
  • 1,013
  • 3
  • 11
  • 29
1
vote
1 answer

SDL 2 C# - Opening a joystick device

I'm trying to port an old project of mine from DirectX to SDL2. I'm using SDL2-CS because the only other binding I was available to find is C# SDL2, which seems to be outdated (last unstable version is 6.1.1beta in 2010, last stable - 6.1.0 in…
rbaleksandar
  • 8,713
  • 7
  • 76
  • 161
1
vote
1 answer

Create a 1x1 texture in SDL 2.0

In C# and XNA, you can create a 1x1 texture like this: Texture2D white_pixel; white_pixel = new Texture2D(GraphicsDevice, 1, 1); white_pixel.SetData(new Color{ Color.White }); // Sorry if I got the syntax wrong, it's been a while Then…
user1508519
1
vote
1 answer

SDL2 memory leaks on SDL_DestroyRenderer

This code will explain the plot: // on init: m_mainWindow = SDL_CreateWindow("title", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 480, 640, SDL_WINDOW_SHOWN); m_mainRenderer = SDL_CreateRenderer(m_mainWindow, -1, 0); // + 8 Mb of memory // on…
1
vote
2 answers

SDL2 cross-platform OpenGL 3+ and OpenGL ES 2.0 or 3.0

Is there some super-easy basic hello world cube project (with setup tutorial) for SDL2 that builds and runs easily across (Windows, Linux eg Ubuntu, Mac OS X, Android, iOS), using modern OpenGL as in OpenGL 3.x or 4.x and OpenGLES 2.0 or 3.0? I…
user3077082
  • 31
  • 1
  • 2
1
vote
1 answer

Why does mingw give an undefined reference to `glUseProgram'?

The program is written in C using SDL2 and openGL. So long as I comment out //glUseProgram(0); the program compiles and runs and displays the glCleared color. Including the gl version checks: const char* renderer = (const char*)…
ste3e
  • 995
  • 1
  • 9
  • 18
1
vote
1 answer

How to Avoid Motion Blur in SDL 2 Games?

I'm making a game in SDL 2 and whenever something moves on the screen, it becomes blurry. I tried to catch it on a screen shot but I don't seem to be able to. My question is: is it because of the game or because of my monitor. The blur appears both…
Mihai
  • 307
  • 2
  • 6
  • 14
1
vote
1 answer

exc_bad_access error xcode5 c++ sdl2

I've been toying with this code a guy on youtube attached to one of his tutorial videos... I've run into a few problems that I cant seem to get past... The current one is this 'EXC_BAD_ACCESS' error... From what I've researched briefly online these…
1
vote
1 answer

SDL Image page on xcode5

so i've been trying out some super basic stuff with SDL 2 in Xcode. I can't quite figure out how to get the image file path correct. I've done some searching on the subject that led to advice for telling the build phase what files to copy over. That…
agmcleod
  • 13,321
  • 13
  • 57
  • 96
1
vote
0 answers

Apple Mach-O link (Id) Error in Xcode 5 C ++ sdl2 framework

I seriously think I might have checked every mach-o link id error post on stackOverFlow and couldn't find a solution to my problem... I dont fully understand how the linker works yet so I can't always figure out how to fix these bugs when they come…
1
vote
1 answer

Can't see my text using SDL TTF for SDL 2

I guess I do all right, but anyway I don't see my text. Official docs are poor (or obsolete for SDL 2). if (TTF_Init()) printf("%s\n", TTF_GetError()); font = TTF_OpenFont("Fonts/DinCompRegular.ttf", 24); if (!font) printf("%s\n",…
Necronomicron
  • 1,150
  • 4
  • 24
  • 47
1
vote
0 answers

Opengl 3 and sdl2 project has random results

Ok Im trying to learn OpenGL 3.x, I used to use the old interface, and its not really going to well. Im using SDL2 for windowing and input. What I would think the code should do is draw a red triangle on a blue background. The Problem is that it…
Jbear
  • 11
  • 1
1
vote
1 answer

Setting up SDL2 with MinGW and Sublime Text

I keep getting the error "undefined reference to WInMain@16" when I include SDL2/SDL.h in my C file. It's a simple "Hello" program with the SDL include, and if I remove the SDL include it compiles just fine (as expected). The problem is I'm new with…
user1021726
  • 638
  • 10
  • 23
1
vote
2 answers

Why SDL_Window is an incomplete type?

I am porting to SDL2 and the Android platform a C++ game that uses SDL 1.2. Everything went well so far except for one thing: when I try to access the fields of SDL_Window, the compiler tells me error: invalid use of incomplete type 'SDL_Window {aka…
Julien
  • 2,139
  • 1
  • 19
  • 32