|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#######
#
# E-scripts on sdl.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
# (find-eev-quick-intro)
# http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/sdl.e>
# or at <http://angg.twu.net/e/sdl.e.html>.
# See also <http://angg.twu.net/emacs.html>,
# <http://angg.twu.net/.emacs[.html]>,
# <http://angg.twu.net/.zshrc[.html]>,
# <http://angg.twu.net/escripts.html>,
# and <http://angg.twu.net/>.
#
#######
# (find-es "love" "love")
# «.load81» (to "load81")
# «.lazy-foo-tutorial» (to "lazy-foo-tutorial")
# «.cga-tron» (to "cga-tron")
# «.sdl-ttf» (to "sdl-ttf")
#####
#
# load81
# 2012mar08
#
#####
# «load81» (to ".load81")
# https://github.com/antirez/load81/
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv ~/usrc/load81/
mkdir ~/usrc/load81/
cd ~/usrc/
git clone https://github.com/antirez/load81
cd ~/usrc/load81/
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/usrc/load81/
make |& tee om
cd ~/usrc/load81/
./load81 examples/lines.lua
./load81 examples/asteroids.lua
# (find-fline "~/usrc/load81/")
(code-c-d "load81" "~/usrc/load81/")
;; (find-load81file "")
#####
#
# Lazy Foo SDL tutorial
# 2012may16
#
#####
# «lazy-foo-tutorial» (to ".lazy-foo-tutorial")
# http://www.lazyfoo.net/SDL_tutorials/
# http://www.lazyfoo.net/SDL_tutorials/lesson31/index.php pixels
# http://www.lazyfoo.net/SDL_tutorials/lesson31/index.php
# http://www.lazyfoo.net/SDL_tutorials/lesson01/linux/index.php setup
apti install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
# http://www.lazyfoo.net/SDL_tutorials/lesson01/linux/cli/index.php
# http://www.lazyfoo.net/SDL_tutorials/lesson02/index.php
# (find-angg "SDL/1.c")
# (find-angg "SDL/2.c")
# (find-zsh "dmissing sdl-config")
# (find-status "libsdl1.2-dev")
# (find-vldifile "libsdl1.2-dev.list")
# (find-udfile "libsdl1.2-dev/")
# (find-man "3 SDL_BlitSurface")
# http://www.lazyfoo.net/SDL_tutorials/lesson08/index.php
//If there's an event to handle
if( SDL_PollEvent( &event ) )
{
//If a key was pressed
if( event.type == SDL_KEYDOWN )
{
Now when we want to check when a key is pressed, we check for event type SDL_KEYDOWN.
//Set the proper message surface
switch( event.key.keysym.sym )
{
case SDLK_UP: message = upMessage; break;
case SDLK_DOWN: message = downMessage; break;
case SDLK_LEFT: message = leftMessage; break;
case SDLK_RIGHT: message = rightMessage; break;
}
}
//If the user has Xed out the window
else if( event.type == SDL_QUIT )
{
//Quit the program
quit = true;
}
}
Now if a key was pressed, we need
# (find-fline "~/tmp/lesson08.zip")
#####
#
# CGA Tron
# 2012may29
#
#####
# «cga-tron» (to ".cga-tron")
# (find-angg "SDL/2.c")
# (find-angg "SDL/cga-tron.c")
# (find-vtutil4file "vtfontlib.lua" "vcsa_colors =")
# http://en.wikipedia.org/wiki/Color_Graphics_Adapter
# (find-sh "locate -i sdl.h")
#####
#
# SDL-TTF
# 2012jun20
#
#####
# «sdl-ttf» (to ".sdl-ttf")
# http://aaroncox.net/tutorials/2dtutorials/sdl_text.pdf
# (find-status "libsdl-ttf2.0-dev")
# (find-vldifile "libsdl-ttf2.0-dev.list")
# (find-udfile "libsdl-ttf2.0-dev/")
# (find-udfile "libsdl-ttf2.0-dev/examples/")
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/sdl-ttf/
mkdir /tmp/sdl-ttf/
cd /tmp/sdl-ttf/
cp -v /usr/share/doc/libsdl-ttf2.0-dev/examples/* .
gunzip *
make |& tee om
# (find-fline "/tmp/sdl-ttf/")
# (find-sh "xlsfonts")
# http://stackoverflow.com/questions/203257/how-to-get-a-list-of-installed-true-type-fonts-on-linux-using-c-or-c
# http://www.freedesktop.org/wiki/Software/fontconfig
# Local Variables:
# coding: utf-8-unix
# End: