SDL 2.0.22 arrives with Wayland improvements and new features

SDL_Logo

The release of the new version of SDL 2.0.22, version in which various compatibility improvements with Wayland have been made, as well as various improvements and more.

For those who are not familiar with the SDL library, you should know that it, provides tools such as hardware accelerated 2D and 3D graphics output, input processing, audio playback, 3D output via OpenGL / OpenGL ES and many other related operations.

SDL is analogous to DirectX, to which one could argue that the analog of DirectX is OpenGL. DirectX also works with input devices and sound. When Loki Software started porting AAA games on Linux, they replaced Direct3D with OpenGL and there was no replacement for anything else and since it's hard to write "X" applications these days even with WinAPI on API X11, but with DirectDraw on WinAPI which is already a problem, it's how SDL was born.

Main new features of SDL 2.0.22

In this new version that is presented, the Wayland protocol compatibility improvements, so initially, it was planned to switch to using the Wayland protocol by defaultda in environments that provide simultaneous support for Wayland and X11, but due to problems related to Wayland in NVIDIA games and drivers, it was decided to postpone the transition (In Wayland environments with the XWayland component, the output is still used using the X11 protocol.)

To use Wayland, environment variable must be set "SDL_VIDEODRIVER=wayland" before starting the application, or add the function 'SDL_SetHint(SDL_HINT_VIDEODRIVER, "wayland,x11")' to the code before calling SDL_Init(). Compiling with Wayland requires at least libwayland-client 1.18.0.

Another change that stands out is that added a set of functions to manipulate rectangular areas (determine the occurrence of points, delete, compare, merge, etc.), operating with coordinates and sizes based on floating point numbers.

For Linux, added SDL_HINT_X11_WINDOW_TYPE flag to set the _NET_WM_WINDOW_TYPE parameter on Windows, and also added the SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR flag for Linux to use libdecor with composite servers that support xdg-decoration.

For Android, the SDL_AndroidSendMessage() function is implemented to send an arbitrary command to the Java SDL controller.

Of the other changes that stand out:

  • Added SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE flag to enable delivery of the SDL_QUIT event when the last application window is closed.
  • Added SDL_HINT_JOYSTICK_ROG_CHAKRAM trait to handle ROG Chakram mouse like a joystick.
    Added the SDL_RenderGetWindow() function to get the window associated with the SDL Renderer.
  • Added SDL_IsTextInputShown() function to check if the text input area is shown.
  • Added SDL_ClearComposition() function to clear the text input area without disabling the input method (IME).
  • Added SDL_TEXTEDITING_EXT event to handle long text input areas and SDL_HINT_IME_SUPPORT_EXTENDED_TEXT flag to enable this event.
  • Added SDL_HINT_MOUSE_RELATIVE_MODE_CENTER flag to enable mouse restriction to only the center of the window instead of the entire window when relative mode is enabled.
  • Enabled automatic mouse capture when clicking mouse buttons. The SDL_HINT_MOUSE_AUTO_CAPTURE attribute is proposed to be disabled.

Finally if you are interested in knowing more about it of this new version, you can check the details in the following link.

How to install Simple DirectMedia Layer on Linux?

Installing this library on Linux is quite simple since most Linux distributions have it within their repositories.

In the case of Debian, Ubuntu and distributions derived from these, you will only have to run the following commands in a terminal:

sudo apt-get install libsdl2-2.0
sudo apt-get install libsdl2-dev

While for the case of those who are uArch Linux suarios we just have to run the following:

sudo pacman -S sdl2

In the case of those who are users of Fedora, Centos, RHEL or any distribution based on them, they just have to run the following command:

sudo yum install SDL2
sudo yum install SDL2-devel

For all other Linux distributions, they can search for the package "sdl" or "libsdl" for installation or download and compile the source code.

They do this with:

git clone https://hg.libsdl.org/SDL SDL
cd SDL
mkdir build
cd build
./configure
make
sudo make install

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published.

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.