site  contact  subhomenews

Agar GUI toolkit with SDL 1.2 on Linux framebuffer

February 25, 2019 — BarryK

I want to run simple GUI apps directly on the framebuffer, no X, and with UTF-8 support. This is to run in the initrd, before switch_root to the main filesystem. I was playing with 'fbterm', as reported earlier:

http://bkhome.org/news/201902/great-things-happening-at-early-bootup.html

But then, why not go the extra step, and have proper graphics-mode GUIs, rather than text-mode? There are some very nice GUI toolkits, but most require SDL version 2, which does not work with the framebuffer. LittleVGL is extra nice, and I have posted many times about it -- it can work directly with the framebuffer, however, mouse input only, no keyboard.

Then I discovered Agar, which uses SDL 1.2. I compiled it, but SDL seems unable to work with the Linux framebuffer:

SDL_Init: no suitable video device

So, decided to recompile SDL, version 1.2.15, narrowed it right down, so only works on the framebuffer:

# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --build=x86_64-pc-linux-gnu --without-x --disable-input-tslib --disable-screensaver --disable-osmesa-shared --disable-video-opengl --disable-video-dummy --disable-video-gem --disable-video-wscons --disable-video-vgl --disable-video-svga --disable-video-ggi --disable-video-cocoa --disable-video-carbon --disable-video-photon --disable-video-x11 --enable-video-fbcon --disable-mintaudio --disable-diskaudio --disable-nas --disable-arts --disable-pulseaudio --disable-esd --disable-alsa --disable-oss

...that did the trick!

Then recompiled Agar:

# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-sdl --without-x --without-glx --without-xinerama --with-png --with-jpeg --without-gl --with-fontconfig --with-freetype --without-portaudio --without-sndfile --without-sse --with-single-fp --without-db4 --disable-network --enable-gui
# make depend all
# new2dir make install

# cd test
# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
# make

...that last operation generated 'agartest', and these are it's deps:

# ldd ./agartest
    linux-vdso.so.1 (0x00007ffe9edb8000)
    libag_math.so.5 => /usr/lib/libag_math.so.5 (0x00007f2b306b2000)
    libm.so.6 => /lib/libm.so.6 (0x00007f2b303a5000)
    libag_dev.so.5 => /usr/lib/libag_dev.so.5 (0x00007f2b30197000)
    libag_gui.so.5 => /usr/lib/libag_gui.so.5 (0x00007f2b2fe6b000)
    libag_core.so.5 => /usr/lib/libag_core.so.5 (0x00007f2b2fc05000)
    libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x00007f2b2f99b000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f2b2f77e000)
    libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f2b2f4df000)
    libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f2b2f29d000)
    libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00007f2b2f033000)
    libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f2b2ee02000)
    libz.so.1 => /lib/libz.so.1 (0x00007f2b2ebec000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f2b2e9e8000)
    libc.so.6 => /lib/libc.so.6 (0x00007f2b2e655000)
    /lib/ld-linux-x86-64.so.2 (0x00007f2b308f4000)
    libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f2b2e42d000)
#

...good. Copied 'agartest' to '/', exited from X, ran it, great, it works, lots of widgets and they look nice. Yep, this is what I want!

Here is the Agar home page:

http://libagar.org/

A snapshot of 'agartest':

img1

Next up, will revisit the Agar configuration, see if can be cut down any more. 

Tags: easy