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
2 answers

Bazel cc_library linkopts relative file path

I have a Bazel BUILD file that involves linking the SDL2 library. I was wondering if I there is a way to replace the file path for the -L flag to a relative file path instead of an absolute file path. The BUILD file that uses the absolute file path…
0
votes
0 answers

Undefined Reference To SDL Errors

I coded some block of code that I display down below. I am trying to use SDL2 for game development with C++ but I get some undefined reference to SDL errors. I am going to display those errors down below. First, I downloaded SDL2 and I copied the…
emir
  • 1
  • 4
0
votes
1 answer

Render Text using SDL2 TTF and glDrawPixels

I am currently adding support for a SDL2 windowing system to a library, that currently uses GLUT. This includes rendering text. The problematic part is that I don't have access to the Window or Renderer at the position where text rendering happens.…
Jhonny007
  • 1,698
  • 1
  • 13
  • 33
0
votes
1 answer

How do I utilize the pygame._sdl2.controller module? Does it even exist?

I'm in the throes of producing a game, and with my keyboard controls going well, I decided to start expanding into controller support. Following the documentation, I thought I had initialized pygame.controller and created two controller objects, but…
Dan Brown
  • 13
  • 3
0
votes
0 answers

How to make a smooth transition from a frequency to another in SDL2?

I am working on a beeper that makes simple wave sounds in order to use it in sorting visualizer program. The beeper can make simple waves. The problem is that I want to eliminate the clicking sound when stopping the sound or changing the…
Grumpy
  • 1
  • 1
0
votes
1 answer

SDL2 Framework Linking in Xcode failing due to different team id's

I'm trying to compile a very basic C++ app in XCode using SDL2 - and I'm running into a frustrating code signing issue that is not apparently solvable without disabling hardened validations (not really an option if you want to distribute your app).…
whitehawk
  • 2,429
  • 29
  • 33
0
votes
1 answer

Compiling sdl-based crates with Cargo causes linker errors (sdl2, pix-engine)

I'm running Ubuntu 20.04.6, with cargo 1.70.0 installed via the rustup installer script (rustup 1.26.0) running cargo run with the the pix-engine example program pasted into main.rs gave me this error error: linking with `cc` failed: exit status: 1 …
joeman
  • 1
  • 2
0
votes
1 answer

How to have different size textures on SDL2?

There's quite a bit of code, so I put it all on my github. (cpp files are on /src, hpp files are on /include) This is probably really simple, but since I'm new to C++ I'm not realizing how to get there. So I have a few textures on my project…
Martim
  • 1
  • 1
0
votes
0 answers

SDL code question : Switch between two images

I want to make a game like chrome://dino using SDL, but i don't know how to make dino run. I think it has something to do with switching between the two photos, but i can't find any SDL tutorials about this situation. Can someone help me?
Boris5581
  • 1
  • 2
0
votes
0 answers

How do I compile a C program with SDL2_TTF on Windows 11?

I have a C project, with multiple files and headers, that all use SDL2. I am using Windows 11, so I compile all the files like this, with mingw64 installed: set CFLAGS=-IC:/path/to/SDL2/include -Wall -lmingw32 -lSDL2main -lSDL2…
Priff13
  • 29
  • 6
0
votes
0 answers

undefined reference to `SDL_CreateWindow' when setting up SDL2

I recently wanted to start learning SDL2 and followed codergophers installation tutorial on youtube. However I ran into this error for some reason (.text+0x49): undefined reference to `SDL_CreateWindow' (.text+0x9b): undefined reference to…
Recondit
  • 114
  • 9
0
votes
0 answers

Trying to use #version 330 core glsl shader files mac 13.1

I am trying to write a simple vertex shader and fragment shader. I am using SDL2 as my window manager and I am following this tutorial: https://learnopengl.com/Getting-started/Hello-Triangle I've gotten to the part after writing the vertex shader to…
0
votes
0 answers

SDL_PollEvent cannot get the correct event

I'm adding support for the fbneo emulator to the retrobat emulator frontend. I'm running into a really tricky problem right now. The method for the retrobat front end to exit the game is to use SDL2 to monitor the key event of the controller. If the…
0
votes
1 answer

How can I implement 3d graphics rendering in C with the SDL2?

I tried implementing a C program which draws a 3d cube using SDL2. Im sorry if it is just a stupid small mistake I'm very new to C/C++. I followed this tutorial: https://youtu.be/ih20l3pJoeU. The guy from the tutorial coded everything in C++ but I…
Slykapar
  • 17
  • 4
0
votes
1 answer

Alpha channel have no effect when drawn to texture and pasted to window

Using SDL2, I want to draw some graphics on texture and paste it on window for speed enhancement. When I paste it I want my alpha channel preserved. This code is supposed to show a white rotating transparent rectangle. But it shows opaque white…
Zeta
  • 913
  • 10
  • 24