02 - Linux Programming - Xlib Window - Non Accelerated Alpha blending - Sprite Animation - Github

Subscribers:
317
Published on ● Video Link: https://www.youtube.com/watch?v=NwKwuvp-60Q



Category:
Let's Play
Duration: 8:28
1,357 views
11


A basic example of how to load a PNG file using LodePNG and alpha blending the image onto a window using basic (in RAM / non accelerated) pixel alpha blending.

0:00 Edit .nanorc for better tab indentation
0:04 Clone git repository to work it locally
0:07 Get LodePNG files from the web using wget -c URL
0:11 Start X11 session with a custom xterm console
0:13 Create file main.cpp
0:15 Create file display.h
0:19 Create file window.h
2:01 Create file color.h
2:20 Alphablend two pixels
2:35 Create file image.h
3:43 Create file bitmap.h
4:23 Load PNG file with LodePNG
5:30 Donwload PNG images for testing with wget
6:15 Write routine to get "ticks" in milliseconds
7:39 It works!
7:40 Add files to git repository and commit to GitHub
8:22 Resulting application

# Repository and files
#:~$ git clone https://github.com/DamianReloaded/LinuxProgramming.git
#:~$ wget -c https://raw.githubusercontent.com/lvandeve/lodepng/master/lodepng.h
#:~$ wget -c https://raw.githubusercontent.com/lvandeve/lodepng/master/lodepng.cpp
#:~$ wget -c https://sites.google.com/site/owlrepository/home/yingyang2.png
#:~$ wget -c https://sites.google.com/site/owlrepository/home/mrain.png
#:~$ wget -c https://sites.google.com/site/owlrepository/home/mushy.png

#Edit ~/.nanorc file (or create it) and add:
#set tabsize 4
#set tabstospaces

# X session with custom xterm
#:~$ xinit /usr/bin/xterm -geometry 120x42+510+128 -bg black -fg white -fa 'Monospace' -fs 11 -- vt1

Song: Movin - MK2







Tags:
Linux
Programming
X11
Xlib
PNG Image Format
Alpha Blending
Sprite Animation