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
1 answer

How to display a counter for a 2D video game using SDL2?

I'm making a 2D RPG-type video game in C++ ver.17 using the SDL2 libraries for my own pleasure (I don't intend to sell the game yet, at most to make it public for free). I've reached a point where I want to display in the GUI window of the game a…
user20420531
0
votes
1 answer

How many times can C++ pass by reference?

I am writing a small game on my phone in SDL2. In main I have a while loop and basic game control conditions which are bools. I pass 'initialise', 'update', 'quit' and the 'renderer' to a game function by reference that deals with the game logic.…
0
votes
0 answers

undefined reference to `SDL_Init'

I started using SDL today and had some trouble before, now I got it running but it won't let me init it. # **Code -->** #include #include #undef main using namespace std; int main(){ …
0
votes
1 answer

Getting keyboard input in SDL2 outside of the main game loop

This is my main game loop. while (running) { window.Clear(); sceneManager.Update(&event); window.SetColor(23, 23, 23, 255); while (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) …
Kesh S
  • 5
  • 2
0
votes
1 answer

How to compile this dll using SDL with MinGW?

Okay so I have been working on this fork for over a year now and this thing doesn't want to compile as dll on x86-64 mingw running on Windows 10. I am following the original instructions:…
LTVA
  • 11
  • 5
0
votes
1 answer

SDL (Button)Text Varish after sometime (actually mutilple executings)

As said My button text gets lost. It happens after many renderings iterations (1399 times approx) Since I am calling the SAME class function. there is no chance that the function is culpurit. I checked its value before text varnishing and after…
0
votes
1 answer

Where have SDL2 wiki examples gone?

In this video (https://www.youtube.com/watch?v=qPHKWsZK2Jc&list=PLvv0ScY6vfd-p1gSnbQhY7vMe2rng0IL0&index=10) from about a year ago, there is example code on the SDL_CreateWindow function documentation page. I have seen other posts talking about the…
user486185
  • 55
  • 4
0
votes
1 answer

Is it possible to connect SDL2_net client to Node.js server using WebSockets?

When I start the client: const char *host = "ws://localhost"; IPaddress ip; if(SDLNet_ResolveHost(&ip, host, 3000) == -1) { std::cout << "ER: SDLNet_ResolveHost: " << SDLNet_GetError() << std::endl; } I see…
8Observer8
  • 868
  • 10
  • 17
0
votes
0 answers

How do I change the SubSystem to a window in SDL2 without the symbols failing to load?

I've been using SDL2/c++ for a while and now that some of my projects are finished I started trying to find a way to run them without the console showing up. I was told to go to Project > Properties > Linker > System > SubSystem (change to…
user20816101
0
votes
0 answers

Failed Error : Failed loading libpng16.dll: The specified module could not be found. when using sld2-image with c++

I am trying to use sdl2-image, but I get the following error: Failed Error: Failed loading libpng16.dll: The specified module could not be found. Using: #include #include "SDL2/SDL_image.h" int main(int argc, char* args[]) { if…
Rohit
  • 1
  • 3
0
votes
0 answers

Problem with playing the next song automatically with SDL_Mixer

I have this c program which used to search for the mp3 files of given directory and add the files data to linked list.i use SDL2 for audio handling. so much far i would be able to get the playing of mp3 file and what i'm facing here is that i don't…
devMe
  • 126
  • 10
0
votes
0 answers

I don't know how to combine SDL2 and pygame on android

I'm currently trying to create a game on my phone using the Pydroid IDE. I'm using Pygame and I would like to use the pygame._sdl2.touch function to detect multi touch on my phone. Learning from the official Pygame website, I apparently need to…
Grieljis
  • 1
  • 1
0
votes
0 answers

Ubuntu 22.04.1 LTS SDL2 wl_proxy_marshal_flags error

I'm a beginner at using Linux, so I'm following a couple of forum threads I've read so far. I'm trying to compile a C++ program using g++ version 11.3.1, where I have installed SDL2 using the command sudo apt-get install libsdl2-dev and am using the…
spaL
  • 604
  • 7
  • 21
0
votes
0 answers

"Undefined Reference to IMG_Load" SDL_Image/SDL2

I have set up a development environment in VSCode with SDL2, SDL2_Image and MinGW. I am using this command to compile the program. g++ -Isrc/include -Lsrc/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_image I have SDL2_image.h in…
0
votes
1 answer

Mix_PlayMusic() not playing music

I have this program which used to load mp3 file from cmd argument but when i use the Mix_PlayMusic the audio isn't playing: #include #include #include #include #include #include…
devMe
  • 126
  • 10
1 2 3
99
100