***
PONG ON SDL ON SIXEL ON YAFT ON KOBO CLARA
(You know we had to at least give it a shot.)
saitoha/SDL1.2-SIXEL
https://github.com/saitoha/SDL1.2-SIXEL
$ wget
https://github.com/saitoha/SDL1.2-SI...eads/sixel.zip
$ unzip SDL1.2-SIXEL.zip
$ cd SDL1.2-SIXEL-sixel/
Prepare build system as was done in Post #4 above:
$ source ~/koxtoolchain/refs/x-compile.sh kobo env bare
$ ./configure --help
$ ./configure --disable-audio --disable-video-x11 --disable-video-fbcon --enable-video-sixel --host=arm-kobo-linux-gnueabihf
$ cp ../libsixel-1.8.6/include/sixel.h .
$ cp ../libsixel-1.8.6/src/.libs/libsixel.a .
$ cp ../libsixel-1.8.6/src/.libs/libsixel.so.1.0.6 libsixel.so.1
$ nano -l Makefile
Code:
...
25 EXTRA_CFLAGS = -I. -I./include -D_GNU_SOURCE=1 -fvisibility=hidden -D_REENTRANT -DHAVE_LINUX_VERSION_H -Wall -mword-relocation
...
27 EXTRA_LDFLAGS = -lm -ldl -lpthread -L. -lsixel
...
36 SOURCES = ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/events/*.c ./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c ./src/joystick/*.c ./src/video/dummy/*.c ./src/loadso/dlopen/*.c ./src/video/sixel/*.c ./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c ./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c ./src/joystick/linux/*.c ./src/cdrom/linux/*.c ./src/timer/unix/*.c
...
37 OBJECTS = $(objects)/SDL.lo $(objects)/SDL_error.lo $(objects)/SDL_fatal.lo $(objects)/SDL_audio.lo $(objects)/SDL_audiocvt.lo $(objects)/SDL_audiodev.lo $(objects)/SDL_mixer.lo $(objects)/SDL_mixer_MMX.lo $(objects)/SDL_mixer_MMX_VC.lo $(objects)/SDL_mixer_m68k.lo $(objects)/SDL_wave.lo $(objects)/SDL_cdrom.lo $(objects)/SDL_cpuinfo.lo $(objects)/SDL_active.lo $(objects)/SDL_events.lo $(objects)/SDL_expose.lo $(objects)/SDL_keyboard.lo $(objects)/SDL_mouse.lo $(objects)/SDL_quit.lo $(objects)/SDL_resize.lo $(objects)/SDL_rwops.lo $(objects)/SDL_getenv.lo $(objects)/SDL_iconv.lo $(objects)/SDL_malloc.lo $(objects)/SDL_qsort.lo $(objects)/SDL_stdlib.lo $(objects)/SDL_string.lo $(objects)/SDL_thread.lo $(objects)/SDL_timer.lo $(objects)/SDL_RLEaccel.lo $(objects)/SDL_blit.lo $(objects)/SDL_blit_0.lo $(objects)/SDL_blit_1.lo $(objects)/SDL_blit_A.lo $(objects)/SDL_blit_N.lo $(objects)/SDL_bmp.lo $(objects)/SDL_cursor.lo $(objects)/SDL_gamma.lo $(objects)/SDL_pixels.lo $(objects)/SDL_stretch.lo $(objects)/SDL_surface.lo $(objects)/SDL_video.lo $(objects)/SDL_yuv.lo $(objects)/SDL_yuv_mmx.lo $(objects)/SDL_yuv_sw.lo $(objects)/SDL_joystick.lo $(objects)/SDL_nullevents.lo $(objects)/SDL_nullmouse.lo $(objects)/SDL_nullvideo.lo $(objects)/SDL_sysloadso.lo $(objects)/SDL_sixelevents.lo $(objects)/SDL_sixelvideo.lo $(objects)/SDL_systhread.lo $(objects)/SDL_syssem.lo $(objects)/SDL_sysmutex.lo $(objects)/SDL_syscond.lo $(objects)/SDL_sysjoystick.lo $(objects)/SDL_syscdrom.lo $(objects)/SDL_systimer.lo
...
$ nano -l build-deps
Code:
...
982 $(objects)/SDL_sixelevents.lo: ./src/video/sixel/SDL_sixelevents.c \
983 ./include/SDL.h \
984 ./include/SDL_active.h \
985 ./include/SDL_audio.h \
986 ./include/SDL_cdrom.h \
987 ./include/SDL_config.h \
988 ./include/SDL_cpuinfo.h \
989 ./include/SDL_endian.h \
990 ./include/SDL_error.h \
991 ./include/SDL_events.h \
992 ./include/SDL_joystick.h \
993 ./include/SDL_keyboard.h \
994 ./include/SDL_keysym.h \
995 ./include/SDL_loadso.h \
996 ./include/SDL_main.h \
997 ./include/SDL_mouse.h \
998 ./include/SDL_mutex.h \
999 ./include/SDL_opengl.h \
1000 ./include/SDL_platform.h \
1001 ./include/SDL_quit.h \
1002 ./include/SDL_rwops.h \
1003 ./include/SDL_stdinc.h \
1004 ./include/SDL_syswm.h \
1005 ./include/SDL_thread.h \
1006 ./include/SDL_timer.h \
1007 ./include/SDL_version.h \
1008 ./include/SDL_video.h \
1009 ./include/begin_code.h \
1010 ./include/close_code.h \
1011 ./src/events/../video/../video/SDL_sysvideo.h \
1012 ./src/events/SDL_events_c.h \
1013 ./src/video/sixel/SDL_sixelevents_c.h \
1014 ./src/video/sixel/SDL_sixelvideo.h \
1015
1016 $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c ./src/video/sixel/SDL_sixelevents.c -o $@
1017
1018
1019 $(objects)/SDL_sixelvideo.lo: ./src/video/sixel/SDL_sixelvideo.c \
1020 ./include/SDL.h \
1021 ./include/SDL_active.h \
1022 ./include/SDL_audio.h \
1023 ./include/SDL_cdrom.h \
1024 ./include/SDL_config.h \
1025 ./include/SDL_cpuinfo.h \
1026 ./include/SDL_endian.h \
1027 ./include/SDL_error.h \
1028 ./include/SDL_events.h \
1029 ./include/SDL_joystick.h \
1030 ./include/SDL_keyboard.h \
1031 ./include/SDL_keysym.h \
1032 ./include/SDL_loadso.h \
1033 ./include/SDL_main.h \
1034 ./include/SDL_mouse.h \
1035 ./include/SDL_mutex.h \
1036 ./include/SDL_opengl.h \
1037 ./include/SDL_platform.h \
1038 ./include/SDL_quit.h \
1039 ./include/SDL_rwops.h \
1040 ./include/SDL_stdinc.h \
1041 ./include/SDL_syswm.h \
1042 ./include/SDL_thread.h \
1043 ./include/SDL_timer.h \
1044 ./include/SDL_version.h \
1045 ./include/SDL_video.h \
1046 ./include/begin_code.h \
1047 ./include/close_code.h \
1048 ./src/events/../video/../video/SDL_sysvideo.h \
1049 ./src/events/SDL_events_c.h \
1050 ./src/video/SDL_blit.h \
1051 ./src/video/SDL_pixels_c.h \
1052 ./src/video/sixel/SDL_sixelevents_c.h \
1053 ./src/video/sixel/SDL_sixelvideo.h \
1054
1055 $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c ./src/video/sixel/SDL_sixelvideo.c -o $@
1056
...
$ nano -l include/SDL_config.h
Code:
...
260 #define SDL_VIDEO_DRIVER_SIXEL 1
...
...
$ nano -l src/video/SDL_video.c
Code:
...
171 /* #ifdef DEBUG_VIDEO */
172 fprintf(stderr,
173 "SDL_video.c: SDL_VideoInit: Start\n");
174 /* #endif */
175
176 /* Check to make sure we don't overwrite 'current_video' */
...
198 } else {
199 for ( i=0; bootstrap[i]; ++i ) {
200 /* #ifdef DEBUG_VIDEO */
201 fprintf(stderr,
202 "SDL_video.c: SDL_VideoInit: i=%d bootstrap[i]->available()= %d\n", i, bootstrap[i]->a$
203 /* #endif */
204 if ( bootstrap[i]->available() ) {
...
$ make
OK, let's test it:
$ cd test/
$ mkdir include
$ cp ../../libsixel-1.8.6/include/sixel.h include/
$ mkdir include/SDL
$ cp ../include/*.h include/SDL/
$ mkdir lib
$ cp ../../libsixel-1.8.6/src/.libs/libsixel.a lib/
$ cp ../../libsixel-1.8.6/src/.libs/libsixel.so.1.0.6 lib/libsixel.so.1
$ cp ../build/.libs/libSDL.a lib/
$ cp ../build/.libs/libSDL-1.2.so.0.11.4 lib/libSDL.so
$ cp ../build/.libs/libSDL-1.2.so.0.11.4 lib/libSDL-1.2.so.0
$ arm-kobo-linux-gnueabihf-gcc -o testplatform testplatform.c -Iinclude -Iinclude/SDL -Llib -lSDL
$ arm-kobo-linux-gnueabihf-gcc -o testvidinfo testvidinfo.c -Iinclude -Iinclude/SDL -Llib -lSDL
$ arm-kobo-linux-gnueabihf-gcc -o testwm testwm.c -Iinclude -Iinclude/SDL -Llib -lSDL
$ arm-kobo-linux-gnueabihf-gcc -o testsprite testsprite.c -Iinclude -Iinclude/SDL -Llib -lSDL -lm
$ arm-kobo-linux-gnueabihf-gcc -o testfile testfile.c -Iinclude -Iinclude/SDL -Llib -lSDL -lpthread
Now, copy the following binaries and image to the /mnt/onboard/.adds/kordir/ folder on the Kobo:
testplatform
testvidinfo
testwm
testsprite
icon.bmp
Copy the libsixel.a, libsixel.so.1, libSDL.a, and libSDL-1.2.so.0 libs to the /mnt/onboard/.adds/kordir/libs/ folder of your kobo.
# YAFT_PERCENT=58 yaft
# . /korenv.sh
From a YAFT terminal:
# . /korenv.sh
# ./testplatform
This system is running Linux
All data types are the expected size.
Detected a little endian machine.
Value 16 = 0xCDAB, swapped = 0xABCD
Value 32 = 0xEFBEADDE, swapped = 0xDEADBEEF
Value 64 = 0xEFBEADDECDAB3412, swapped = 0x1234ABCDDEADBEEF
RDTSC not detected
MMX not detected
MMX Ext not detected
3DNow not detected
3DNow Ext not detected
SSE not detected
SSE2 not detected
AltiVec not detected
# ./testvidinfo
driver: sixel
Current display: 0x0, 24 bits-per-pixel
Red Mask = 0x00ff0000
Green Mask = 0x0000ff00
Blue Mask = 0x000000ff
Fullscreen video modes:
1024x768x24
800x600x24
640x480x24
320x400x24
320x240x24
320x200x24
# ./testwm
(Try hitting UP, DOWN, RIGHT, LEFT, ESC RET keys to exit.)
Key pressed: 273-up modifiers: (none)
Key released: 273-up modifiers: (none)
Key pressed: 274-down modifiers: (none)
Key released: 274-down modifiers: (none)
Key pressed: 275-right modifiers: (none)
Key released: 275-right modifiers: (none)
Key pressed: 276-left modifiers: (none)
Key released: 276-left modifiers: (none)
Key pressed: 27-escape modifiers: (none)
Posting internal quit request
Key released: 27-escape modifiers: (none)
Key pressed: 13-return modifiers: (none)
Key released: 13-return modifiers: (none)
Handling internal quit request
Bye bye..
# ./testsprite
(See the pretty sprites.)
***
Now, back on the desktop, we add more SDL libraries:
https://www.libsdl.org/projects/
$ wget
https://www.libsdl.org/projects/SDL_...-1.2.12.tar.gz
$ wget
https://downloads.sourceforge.net/pr...tf-1.4-src.zip
$ wget
https://www.libsdl.org/projects/SDL_...f-1.2.2.tar.gz
$ wget
https://www.libsdl.org/projects/SDL_...t-1.2.8.tar.gz
$ wget
https://www.libsdl.org/projects/SDL_...-1.2.12.tar.gz
Prepare build system as was done in Post #4 above:
$ source ~/koxtoolchain/refs/x-compile.sh kobo env bare
$ tar zxvf SDL_image-1.2.12.tar.gz
$ cd SDL_image-1.2.12/
(Use a similar dependency setup, relying on the koreader crosscompile libs and headers in $HOME/x-tools/ folder, as for imlib2 in POST #18 above.)
$ ./configure --host=arm-kobo-linux-gnueabihf CPPFLAGS=" -I$HOME/x-tools/usr/include/ -I$HOME/websw/giflib-5.2.2/ " LDFLAGS=" -L$HOME/x-tools/usr/lib/ -L$HOME/websw/giflib-5.2.2/ -lgif -ljpeg -lz " LIBPNG_CFLAGS=" -I$HOME/x-tools/usr/include/ " LIBPNG_LIBS=" -L$HOME/x-tools/usr/lib/ -lpng " SDL_CFLAGS=" -I../SDL1.2-SIXEL-sixel/include/ " SDL_LIBS=" -L../SDL1.2-SIXEL-sixel/build/.libs/ -lSDL "
$ make
Copy the showimage binary from the .libs/ folder to the /mnt/onboard/.adds/kordir/scripts/ folder on the Kobo:
$ cd ..
***
$ mkdir libttf
$ cd libttf/
$ unzip libttf-1.4-src.zip
$ cd src/
$ chmod 755 configure
$ nano -l configure
Code:
...
3701 ac_cv_sizeof_int=4
3702 echo $ac_n "checking size of int""... $ac_c" 1>&6
...
3740 ac_cv_sizeof_long=4
3741 echo $ac_n "checking size of long""... $ac_c" 1>&6
...
$ CC=arm-kobo-linux-gnueabihf-gcc ./configure --host=arm-kobo-linux-gnueabihf
$ make
$ cd ..
$ cd ..
***
$ tar zxvf SDL_ttf-1.2.2.tar.gz
$ cd SDL_ttf-1.2.2/
$ CC=arm-kobo-linux-gnueabihf-gcc ./configure --host=arm-kobo-linux-gnueabihf
$ nano -l configure
Code:
...
2139 if test "$SDL_CONFIG" = "no" ; then
2140 # no_sdl=yes
2141 # else
2142 SDL_CFLAGS="$SDL_CFLAGS"
2143 SDL_LIBS="$SDL_LIBS"
...
$ CC=arm-kobo-linux-gnueabihf-gcc CFLAGS=" -I$HOME/x-tools/usr/include/ -I../libttf/src/lib/ " LIBS=" -L$HOME/x-tools/usr/lib/ -L../libttf/src/lib/.libs/ -lttf " SDL_CFLAGS=" -I../SDL1.2-SIXEL-sixel/include/ " SDL_LIBS=" -L../SDL1.2-SIXEL-sixel/build/.libs/ -lSDL " ./configure --host=arm-kobo-linux-gnueabihf
$ nano -l SDL_ttf.c
Code:
...
21 /*static int round(float x)
...
33 }*/
...
$ make
Copy the showfont binary from the .libs/ folder to the /mnt/onboard/.adds/kordir/scripts/ folder on the Kobo:
$ cd ..
***
$ tar zxvf SDL_net-1.2.8.tar.gz
$ cd SDL_net-1.2.8/
$ ./configure --host=arm-kobo-linux-gnueabihf SDL_CFLAGS=" -I../SDL1.2-SIXEL-sixel/include/ " SDL_LIBS=" -L../SDL1.2-SIXEL-sixel/build/.libs/ -lSDL "
$ make
Copy the showinterfaces binary from the .libs/ folder to the /mnt/onboard/.adds/kordir/scripts/ folder on the Kobo:
$ cd ..
***
$ tar zxvf SDL_mixer-1.2.12.tar.gz
$ cd SDL_mixer-1.2.12/
$ ./configure --host=arm-kobo-linux-gnueabihf SDL_CFLAGS=" -I../SDL1.2-SIXEL-sixel/include/ " SDL_LIBS=" -L../SDL1.2-SIXEL-sixel/build/.libs/ -lSDL "
$ make
$ cd ..
***
Here is a PONG game to try out our SDL:
nathan242/SDL-pong
https://github.com/nathan242/sdl-pong
$ cd ..
$ wget
https://github.com/nathan242/SDL-pon...ads/master.zip
$ mv master.zip SDL-pong-master.zip
$ unzip SDL-pong-master.zip
$ cd SDL-pong-master/
$ source ~/koxtoolchain/refs/x-compile.sh kobo env bare
$ mkdir include
(Use headers as for imlib2 in POST #18 above.)
$ cp ~/websw/giflib-5.2.2/gif*.h include/
$ cp ~/x-tools/usr/include/png*.h include/
$ cp ~/x-tools/usr/include/j*.h include/
$ cp ~/x-tools/usr/include/z*.h include/
$ cp ../libsixel-1.8.6/include/sixel.h include/
$ mkdir include/SDL
$ cp ../SDL1.2-SIXEL-sixel/include/*.h include/SDL/
$ cp ../SDL_image-1.2.12/SDL_image.h include/SDL/
$ cp ../SDL_ttf-1.2.2/SDL_ttf.h include/SDL/
$ cp ../SDL_net-1.2.8/*.h include/SDL/
$ cp ../SDL_mixer-1.2.12/*.h include/SDL/
$ mkdir lib
(Use libs as for imlib2 in POST #18 above.)
$ cp ~/websw/giflib-5.2.2/libgif.so lib/
$ cp ~/x-tools/usr/lib/libpng16.so.16 lib/libpng16.so
$ cp ~/x-tools/usr/lib/libjpeg.so.62 lib/libjpeg.so
$ cp ~/x-tools/usr/lib/libz.so.1 lib/libz.so
$ cp ../libsixel-1.8.6/src/.libs/libsixel.a lib/
$ cp ../libsixel-1.8.6/src/.libs/libsixel.so.1.0.6 lib/libsixel.so.1
$ cp ../SDL1.2-SIXEL-sixel/build/.libs/libSDL.a lib/
$ cp ../SDL1.2-SIXEL-sixel/build/.libs/libSDL-1.2.so.0.11.4 lib/libSDL.so
$ cp ../SDL1.2-SIXEL-sixel/build/.libs/libSDL-1.2.so.0.11.4 lib/libSDL-1.2.so.0
$ cp ../SDL_image-1.2.12/.libs/libSDL_image.a lib/
$ cp ../SDL_image-1.2.12/.libs/libSDL_image-1.2.so.0.8.4 lib/libSDL_image.so
$ cp ../SDL_image-1.2.12/.libs/libSDL_image-1.2.so.0.8.4 lib/libSDL_image-1.2.so.0
The following are optional, for possible future use:
$ cp ../libttf/src/lib/.libs/libttf.so.2.3.0 lib/libttf.so
$ cp ../libttf/src/lib/.libs/libttf.so.2.3.0 lib/libttf.so.2
$ cp ../SDL_ttf-1.2.2/.libs/libSDL_ttf.a lib/
$ cp ../SDL_ttf-1.2.2/.libs/libSDL_ttf-1.2.so.0.2.0 lib/libSDL_ttf.so
$ cp ../SDL_ttf-1.2.2/.libs/libSDL_ttf-1.2.so.0.2.0 lib/libSDL_ttf-1.2.so.0
$ cp ../SDL_net-1.2.8/.libs/libSDL_net.a lib/
$ cp ../SDL_net-1.2.8/.libs/libSDL_net-1.2.so.0.8.0 lib/libSDL_net.so
$ cp ../SDL_net-1.2.8/.libs/libSDL_net-1.2.so.0.8.0 lib/libSDL_net-1.2.so.0
$ cp ../SDL_mixer-1.2.12/build/.libs/libSDL_mixer.a lib/
$ cp ../SDL_mixer-1.2.12/build/.libs/libSDL_mixer-1.2.so.0.12.0 lib/libSDL_mixer.so
$ cp ../SDL_mixer-1.2.12/build/.libs/libSDL_mixer-1.2.so.0.12.0 lib/libSDL_mixer-1.2.so.0
Now compile PONG:
$ nano -l makefile
Code:
1 CXX = arm-kobo-linux-gnueabihf-g++
2
3 pong: pong.o physics.o
4 $(CXX) -o pong -Llib -lgif -ljpeg -lz -lSDL -lSDL_image pong.o physics.o
5
6 pong.o: pong.cpp
7 $(CXX) -g -Iinclude -c pong.cpp
8
9 physics.o: physics.cpp physics.h
10 $(CXX) -g -c physics.cpp
$ nano -l pong.cpp
Code:
...
5 #define CLARA_UP 273
6 #define CLARA_DOWN 274
7 #define CLARA_RIGHT 275
8 #define CLARA_LEFT 276
9 #define CLARA_XSTEP 30
...
44 if (obj->step_y > 0) { obj->step_y = 1 * CLARA_XSTEP; } else { obj->step_y = -1 * CLARA_XSTEP; }
45 } else if (obj->pos_x+obj->size_x >= area_x) {
46 scoreplayer1++;
47 obj->pos_x = 300;
48 obj->pos_y = 100;
49 if (obj->step_y > 0) { obj->step_y = 1 * CLARA_XSTEP; } else { obj->step_y = -1 * CLARA_XSTEP; }
...
61 obj->step_y = -2 * CLARA_XSTEP;
62 } else if (obj->pos_y <= y2) {
63 if (obj->step_y > 0) { obj->step_y = 1 * CLARA_XSTEP; } else { obj->step_y = -1 * CLARA_XSTEP; }
64 } else if (obj->pos_y <= y3) {
65 obj->step_y = 2 * CLARA_XSTEP;
...
75 // Constant variables
76 const int resX = 800;
77 const int resY = 600;
...
188 // Right paddle
189 paddle_right->sprite = SDL_DisplayFormat(IMG_Load("paddle.png"));
190 paddle_right->phys = new phys_obj;
191 paddle_right->phys->pos_x = 730;
192 paddle_right->phys->pos_y = 350;
...
206 // Ball
207 ball->sprite = SDL_DisplayFormat(IMG_Load("ball.png"));
208 ball->phys = new phys_obj;
209 ball->phys->pos_x = 300;
210 ball->phys->pos_y = 100;
211 ball->phys->size_x = 20;
212 ball->phys->size_y = 20;
213 ball->phys->step_x = 1 * CLARA_XSTEP;
214 ball->phys->step_y = 1 * CLARA_XSTEP;
...
245 while (quit==false) {
246 // SDL_Delay(20);
...
283 // Read inputs
284 while (SDL_PollEvent(&input))
285 {
286 switch (input.type)
287 {
288 case SDL_KEYDOWN:
289 switch (input.key.keysym.sym)
290 {
291 case CLARA_UP:
292 down = false;
293 up = true;
294 break;
295 case CLARA_DOWN:
296 up = false;
297 down = true;
298 break;
299 case SDLK_b:
300 down = false;
301 up = true;
302 break;
303 case SDLK_SPACE:
304 up = false;
305 down = true;
306 break;
307 case SDLK_q:
308 quit = true;
309 break;
310 }
311 break;
312 case SDL_KEYUP:
313 switch (input.key.keysym.sym)
314 {
315 case CLARA_RIGHT:
316 up = false;
317 down = false;
318 break;
319 case CLARA_LEFT:
320 up = false;
321 down = false;
322 break;
323 case SDLK_n:
324 up = false;
325 down = false;
326 break;
327 case SDLK_v:
328 up = false;
329 down = false;
330 break;
331 }
...
335 // Move left paddle
336 paddle_left->phys->step_y = 0;
337 if (up) { paddle_left->phys->step_y = -1 * CLARA_XSTEP; }
338 if (down) { paddle_left->phys->step_y = 1 * CLARA_XSTEP; }
339
340 // Move right paddle
341 if (ball->phys->pos_y > paddle_right->phys->pos_y+paddle_mid) {
342 paddle_right->phys->step_y = 1 * CLARA_XSTEP;
343 } else {
344 paddle_right->phys->step_y = -1 * CLARA_XSTEP;
345 }
...
359 // Second number
360 offset.x = 550;
361 offset.y = 0;
362 SDL_BlitSurface(numbers, &num[scoreplayer2], screen, &offset );
...
379 // Flip screen
380 SDL_Flip(screen);
381 // SDL_Delay(20);
...
$ rm *.o
$ rm pong
$ make
Copy the libsixel.a, libsixel.so.1, libSDL.a, libSDL-1.2.so.0, libSDL_image.a, and libSDL_image-1.2.so.0 libs to the /mnt/onboard/.adds/kordir/libs/ folder of your kobo.
Also copy the following libs for possible future use:
libSDL_mixer.so
libttf.so.2
libSDL_ttf.a
libSDL_ttf-1.2.so.0
libSDL_net.a
libSDL_net-1.2.so.0
libSDL_mixer.a
libSDL_mixer-1.2.so.0
Copy the pong binary and ball.png, numbers.png, paddle.png, p1win.png, and p2win.png images to the /mnt/onboard/.adds/kordir/ folder on the Kobo:
# . /korenv.sh
# YAFT_PERCENT=58 yaft
# . /korenv.sh
From a YAFT terminal:
# showimage tux.jpg
# ./pong
As you can see, it is kind of slow despite the changes I made to pong.cpp.
Anyway, that is PONG on Kobo Clara HD.
***
RUN PONG ON DESKTOP IN KOBO SSH TERMINAL
(SECURITY WARNING: DO NOT SSH TO CRITICAL DESKTOP FROM INSECURE SSH CLIENT, E.G. KOBO)
Create ssh firewall rule on desktop:
$ sudo ufw allow proto tcp from 192.168.2.2 to 192.168.2.1 port 22
Rule added
$ sudo ufw reload
$ sudo ufw status numbered
Install and run sshd server:
$ sudo apk add openssh-server
$ sudo ssh-keygen -A
$ sudo /usr/sbin/sshd
$ ps ax | grep sshd
3093 ? Ss 0:00 /usr/sbin/sshd
19580 pts/3 S+ 0:00 grep sshd
$ netstat -tulpn
Get an ssh client for kobo:
https://pkgs.alpinelinux.org/package...7/dropbear-ssh
The dropbear-ssh client has only the following dependencies:
Depends (1)
dropbear-dbclient
Depends (2)
musl*
zlib*
*already got these from elinks install.
Download and extract the required packages:
$ wget
https://dl-cdn.alpinelinux.org/alpin...2022.83-r1.apk
$ wget
https://dl-cdn.alpinelinux.org/alpin...2022.83-r1.apk
$ cd myalpine/
$ tar zxvf dropbear-dbclient-2022.83-r1.apk
$ mv usr/bin/dbclient scripts/ssh
NOW CONNECT YOUR KOBO TO YOUR PC:
Copy your ssh binary from the scripts/ folder on the PC to the /mnt/onboard/.adds/kordir/scripts/ folder on the kobo.
On your kobo, connect to your (now insecure) desktop:
# . /korenv.sh
# ssh kobo@192.168.2.1
$ cat tux.six
$ cd
$ cd SDL1.2-SIXEL-sixel/test/
$ ./testsprite
1010 frames per second on desktop becomes 62 on Kobo over SSH connection(compared to 4.44 natively on Kobo)
$ cd
$ cd SDL-pong-master/
$ ./pong
(have to fix the keydefs)
RUNS AT "DESKTOP SPEED" (4.7 seconds paddle to paddle on original source code over SSH, admittedly with ghosting, compared to 2 seconds on desktop)!
$ exit
***
***
***