Questions tagged [sdl]

Simple DirectMedia Layer (SDL) is a cross-platform, free and open source multimedia library. Should not be confused with Security Development Lifecycle.

Simple DirectMedia Layer (SDL) is a cross-platform, free and open source multimedia library written in C that presents a simple interface to various platforms' graphics, sound, and input devices.

From SDL's home page:

Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.

SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source code.

SDL is written in C, works natively with C++, and there are bindings available for several other languages, including C# and Python.

SDL 2.0 is distributed under the zlib license. This license allows you to use SDL freely in any software.

4893 questions
1
vote
1 answer

More SDL C++ Opengl display trouble

I seem to be having the same trouble over and over again and cannot get my thick head around it. This program will not display a paddle as I want (and expected it) to do on screen :( - #include #include SDL_Event…
user969416
1
vote
1 answer

Mouse position set to (0,0) in SDL

My goal is to have a red square in the middle of a window and when I press it, it should give me my mouse position as long as I am holding the mouse button down. When I release the mouse button it should not give me the coordinates any longer. The…
1
vote
0 answers

Nim SDL2 no window appears

I'm trying to follow this blog post about using SDL2 with Nim. I've set up a project with SDL2. Using nimble build or nimble run throws no errors. When the program is running no window appears. Similar questions in C++ have a SDL_WINDOW_HIDDEN flag…
Lex
  • 4,749
  • 3
  • 45
  • 66
1
vote
1 answer

Can't see window of SDL in c

I'm just trying to test my SDL installation (I've used apt install libsdl2-dev), I've included the library and tried this code to see if it works, I even got no errors and the return of SDL_Init is successful, but I can't see any window showing up…
1
vote
1 answer

Android C++ new operator leads to "malloc(4294967295) failed, errno 12"

TD;DR I'm porting a C++ project of mine to android, but when using the new operator it actually calls malloc(4294967295) for some reason, which results in an out of memory error, even though debugging proved my classes to be of a correct size (and…
RedStoneMatt
  • 465
  • 3
  • 11
1
vote
0 answers

How to change sprite size in SDL2

I'm Remaking Galaga to learn SDL2/SDL. I managed to render a sprite and display and create the windo and game loop. Problem is, The sprite takes up the whole screen. Is there way to fix this? Here's the code: #include #include…
1
vote
1 answer

SDL2 TTF Text Not Rendering As Expected

I've been working on a program that utilizes SDL2, and I've been trying to get text on the screen using an SDL_Surface converted to a SDL_Texture then rendering with SDL_RenderCopy(). It shows only a black screen (as expected) however the red "Hello…
1
vote
0 answers

SDL window goes unresponsive when trying to close the window

I tried code that opens a simple window in C: main.c: #include #undef main #include #include int main(int argc, char* argv[]) { // returns zero on success else non-zero if…
justtab
  • 23
  • 4
1
vote
1 answer

problems with keeping content displayed with SDL in C

I try to make a game interface using SDL in C language, where the user needs to click on start after the text is displayed so that it takes him to the menu. But when the text and the button is displayed, they disapear leaving the image blank without…
hoover
  • 9
  • 3
1
vote
0 answers

SDL Surface with a menu and status bar

How can I add a menu, and a status toolbar to SDL? I can not find any reference to this online... I think it might be an SDL limitation? If so, what portable library can I use which would allow me to add an SDL surface to it, and a status bar and…
Gregorio Di Stefano
  • 1,173
  • 1
  • 15
  • 23
1
vote
0 answers

SDL2 window not showing - Ubuntu 22.04

I tried running this program that is supposed to display simple black window on Ubuntu 22.04: #include #include using namespace std; int main(int argc, char *argv[]) { if (SDL_Init(SDL_INIT_VIDEO) != 0) { cout…
user1234
  • 19
  • 3
1
vote
1 answer

Haskell OpenGL won't open in Ubuntu

This one is a bit weird, but I will start at the beginning: As far as I gathered, there are 3 ways to open up an OpenGL window in Haskell: GLUT, GLFW and SDL. I don't want to use GLUT at all, because it forces you to use IORefs and basically work in…
Lanbo
  • 15,118
  • 16
  • 70
  • 147
1
vote
1 answer

SDL2 KMSDRM starts but draws nothing on Raspberry Pi 3B

I wrote this simple test program that clear to grey, using KMSDRM support of SDL2: #include #include #include #include #include using namespace std::chrono_literals; using std::clog; using…
jiandingzhe
  • 1,881
  • 15
  • 35
1
vote
1 answer

Is it possible to get length (in seconds) of a loaded WAV file in SDL library?

I am trying to find a way to get the duration of an WAV audio file loaded in SDL library. I am using the latest official build of SDL for Windows, 64-bit, version 2.26.5. SDL provides following data about the loaded file after a call to LoadWAV…
user17471643
1
vote
1 answer

How to run SDL2 example in embedded Linux with LCD display?

I am working on an embedded Linux system (5.10.24), and there is a LCD display in it. Now I am trying to run a SDL2 example in it (from serial console), but I failed to do that. The example codes are as follows, #include "SDL2/SDL.h" int main(int…
wangt13
  • 959
  • 7
  • 17
1 2 3
99
100