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

Python SDL2 Animation Frame Doesn't Have Time To Render

My goal is to be able to drag polygons around a screen when I click and hold somewhere on the screen. I have created some polygons in Python SDL2. I added some basic animation, so when I drag my mouse, the polygons move too. This results in…
0
votes
0 answers

Can I use try{} catch{} in SDL2 on Android, at all? (C++)

I've not understood any way to report errors on Android. I use Cxxdroid which comes packaged with SDL2. I could use the terminal and compile the program using clang++; that way I'd have debug text output, but the libraries and includes are hidden…
0
votes
0 answers

Pop up but no window shown (SDL2 on m1 Ventura)

I am trying to setup sdl2 on my mac and all headers get detected in my test code. When I compile and run the code it should open a fully red window but the only thing that I get is a pop up on my task bar that I can't click on. I had similar…
Luven
  • 13
  • 3
0
votes
1 answer

When i try to make a textured rectangle my SDL program just goes into black screen

I've tried to create a textured rectangle but when i trying to run the program it's just goes into a black screen: #include #include "dinoHeader.h" int main(int argc, const char * argv[]) { if(SDL_Init(SDL_INIT_EVERYTHING) <…
0
votes
1 answer

How to update the screen without clearing the renderer in SDL2

I am trying to render a square after SDL_RenderPresent() as I want to render the rectangle to the screen without disturbing other stuff or clearing the screen. SDL_Event event; SDL_RenderClear(renderer); SDL_Rect rect; rect.x = 10; rect.y…
0
votes
0 answers

Clang finds library, Mingw32 cannot find library to import

I have some C++ code to render some polygons to a window. It uses the SDL2 and the SDL2 gfx libraries. When I run make in the folder, it works. It doesn't work when I switch the compiler from clang to mingw32 My env setup on Ubuntu I ran: sudo…
0
votes
0 answers

VSCode SDL2 "undefined reference to `WinMain@16'" Error

I am trying to make a simple window with SDL2 in VSCode. I just can't seem to find a working solution anywhere. Every time I run my makefile or just run the command, I get the error"undefined reference to `WinMain@16'". I can't figure out why. My…
0
votes
0 answers

Dev C++ SDL2, multiple definition of 'main'

I'm trying to get SDL2 working in Dev-C++. I DLed the 2.26.4 version from GitHub which is the latest stable release. I only have one .cpp file in my project but the linker is complaining that multiple definitions of 'main' have been…
DrZ214
  • 486
  • 5
  • 19
0
votes
0 answers

SDL2 Window is created but not shown

Here's my code #include #include #include int main(){ if(SDL_Init(SDL_INIT_VIDEO) != 0){ return -1; } SDL_Window *window = SDL_CreateWindow("test", SDL_WINDOWPOS_UNDEFINED,…
0
votes
1 answer

Draw nothing for an OpenGL ES 3 + SDL2 + ANGLE + MSVC

I've got a problem following a tutorial aiming to teach how to use OpenGL ES 3.x on desktop environment primarily on Windows. As stated in the title of my question I'm coding using MSVC, SDL2 and I link my program against ANGLE's libraries to…
Troctsch
  • 21
  • 5
0
votes
0 answers

How to center mouse without triggering mouse event in SDL2

I am using SDL2 in C# to make a first person game. I want to center the mouse in the window and still collect mouse input to move the camera. I tried SDL_WarpMouseInWindow(window, WIDTH / 2, HEIGHT / 2);, but the movement caused by this function is…
nico_qwer
  • 112
  • 10
0
votes
1 answer

Very laggy program

I was tying to write my first SDL2 program, I wanted to make movement possible, but it is very laggy #include #include #include SDL_Window* window = SDL_CreateWindow("Dominiks window", SDL_WINDOWPOS_CENTERED,…
DDominik
  • 1
  • 2
0
votes
0 answers

Why are the particles in my gravity simulation not working correctly even though i used the correct formula?

i have been trying to make a particle gravity simulation thing using sdl2 and c++ but even though i used the correct formula its the same. the particles are getting attracted to the top right corner of the screen, it seems to fix itself if i…
riyan
  • 1
  • 1
0
votes
0 answers

CMake cannot find SDL2 no matter what I try

NOTE This is not a compile time issue this is a cmake generation-time issue. I've been trying to setup my environment so that cmake can find SDL2. I am on windows 11, with the latest versions of SDL2 (found here), SDL_image (found here) and SDL_ttf…
Nosh Ware
  • 11
  • 5
0
votes
1 answer

SDL2 library on macOS Ventura

I have installed SDL with the command: brew install sdl2 However, I don't know what to include in my .c file. Can anyone help me? I tried to #include , , , and compile with the command: gcc `sdl-config…
pintel
  • 1
  • 1