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
24
votes
0 answers

SDL2, gpg::GameServices and multi windows

I'm using the C++ SDK for Google Play Game Services in a native application built on top of SDL2. The native part is a .so file loaded at runtime. Everything works just fine as long as I use the application in a standard manner. On the other hand,…
skypjack
  • 49,335
  • 19
  • 95
  • 187
24
votes
5 answers

How to draw circles, arcs and vector graphics in SDL?

I'm using SDL2. The only way I can find to draw a shape is with the line, rect and pixel functions, as explained here. Apart from using trig or the "equation of a circle", how could I draw a curve? How about general vector graphics? Is SDL an…
effbiae
  • 1,087
  • 1
  • 7
  • 22
23
votes
3 answers

Getting Continuous Window Resize Event in SDL 2

I use the following structure to get new width and height of the resized SDL window: if (sdl_set->GetMainEvent()->type == SDL_WINDOWEVENT) { if (sdl_set->GetMainEvent()->window.event == SDL_WINDOWEVENT_RESIZED) { ScreenWidth =…
bfkjohns
  • 353
  • 1
  • 2
  • 7
21
votes
7 answers

sdl2 - ImportError: DLL load failed: The specified module could not be found and [CRITICAL] [App] Unable to get a Window, abort

Python: 3.6.4 OS: Windows 10 Kivy: 1.10.0 Kivy Installation Method python -m pip install --upgrade pip wheel setuptools python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew python -m pip install…
Jaimie Dodd
  • 221
  • 1
  • 2
  • 4
21
votes
3 answers

How to disable key repeat in SDL2?

There used to be a function named SDL_EnableKeyRepeat() in SDL, but not anymore in SDL2. I searched around in SDL2-wiki but failed to locate anything relevant. Any ideas?
Diaz
  • 957
  • 2
  • 13
  • 22
21
votes
1 answer

Static-linking of SDL2 libraries

I am using Windows 7, Code::Blocks and MinGW. I have little to no experience when it comes to compiling/building anything, especially when Code::Blocks doesn't use makefiles. I downloaded SDL2-devel-2.0.0-mingw.tar.gz (SDL Development Libraries)…
DispEd
  • 219
  • 1
  • 2
  • 5
20
votes
2 answers

cmake: leading or trailing whitespace (policy CMP0004)

I am following this question. However my cmake faces with error: -- Configuring done CMake Error at CMakeLists.txt:18 (add_executable): Target "main" links to item "-L/usr/lib/x86_64-linux-gnu -lSDL2 " which has leading or trailing whitespace. …
ar2015
  • 5,558
  • 8
  • 53
  • 110
20
votes
1 answer

SDL2: Fast Pixel Manipulation

I want to draw pixels on the monitor which change frequently after certain parameters. E.G. if a Red and Green Pixel collide, they would both vanish, etc. In every frame I have to manipulate about 100 - 1000 pixels. I have a multi-threaded approach…
Nidhoegger
  • 4,973
  • 4
  • 36
  • 81
20
votes
2 answers

SDL2 C++ Taking a screenshot

Hi I would like to know if it is possible to simply take a screenshot with SDL2. I tried SDL_GetWindowSurface but I get an error saying: No hardware accelerated renderers available. I took the code from here. Another solution I thought about is…
user3371807
  • 239
  • 1
  • 2
  • 9
19
votes
1 answer

What is SDL_Joystick and what is SDL_GameController? What are the relationships between the two?

What is the relationship between SDL_Joystick and SDL_GameController? These are the only things I know of right now: SDL_GameController and related functions are all part of a new API introduced in SDL2. SDL_GameController and related functions…
tom_mai78101
  • 2,383
  • 2
  • 32
  • 59
19
votes
2 answers

How to get screen size in SDL

I'm trying to make a program using SDL and C++. How can I get screen's width and height in pixels in SDL?I'm trying to get screen's width not the window's width. …
tam bakaka
  • 433
  • 1
  • 3
  • 8
19
votes
1 answer

Are there good tutorials for SDL2.0 for C programming? (not C++)

I'm a student learning C programming (at the moment). In the subject I was given, I have to create some kind of Wolfenstein3d clone (hence the name of the project, "wolf3d"). To do this project, I'm allowed to use either the graphic library created…
MrChwepsy
  • 239
  • 1
  • 2
  • 4
19
votes
1 answer

Drawing a rectangle with SDL2

I just started using SDL2 and I already have a problem. I want to create a window and paint it in red. But it remains white, and I don't understand why. Here is the code : int main (int argc, char** argv) { SDL_Window* pWindow = NULL; …
Utundu
  • 371
  • 1
  • 2
  • 11
18
votes
1 answer

SDL2 on Raspberry Pi without X?

I'm hoping to develop some code that uses SDL2 to display graphics on the 7" RPi touchscreen, but I'd rather not install a full desktop OS. I've got Raspbian Buster Lite installed. Some simple test code gets an error when I try to run…
Rick
  • 3,298
  • 3
  • 29
  • 47
18
votes
2 answers

Porting an SDL 2.0 game to Android

I have a game written in C/C++ with SDL 2.0, I would like to port it to mobile platforms (specifically Android and maybe other platforms too). I read SDL has a native support for Android but the game itself is written for Windows at first, although…
UnTraDe
  • 3,747
  • 10
  • 36
  • 60