NCCA 
 
Entertainment Systems

Home
Lecture Notes
Tutorials
Downloads
Useful Links

Workshop 9:

This is an extension of exercise 4.1:
  • better collision detection (determines which side of the object the collision occurred)

Code Listing 1 (downloadable source)

Assets:


Workshop 8:

Please do the following:

Code Listing 1 (downloadable source)

Assets:

  • hit.wav (many thanks to Steffen Engel for this)

Workshop 7:

Please do the following:

Code Listing 1 (downloadable source)

Assets:


Workshop 6:

Code Listing 1 (downloadable source)
Java Setup

Assets:


Workshop 5:

Code Listing 1 (downloadable source)


Workshop 4:

Your task is to complete the code:
  • Finish the vector class
  • Start the ball moving at the correct angle (in the ball class constructor)
  • Load and use an image for the ball
  • Make the ball start moving at a random angle between - pi/2 and + pi/2

If you finish that, extend the code:
  • Try adding another ball
  • Create a new 'block' class, and add one in the middle of the screen for the ball to bounce off of
  • Use the keyboard input to add a second player!

Code Listing 1 (downloadable source, solution)


Workshop 3:

Code Listing 1 (downloadable source)
Code Listing 2 (downloadable source)


Workshop 2:

// Workshop 2 part 1

Your challenge: to demonstrate the processes involved in the transfer of data from print, through the computer, to broadcast.

To do this, write a simple program that takes a single CMYK value (e.g. from the command line) and converts it to RGB, and then from RGB to YUV, outputting the result


Recall from your lecture notes:

CMYK:
RGB = { (1-C)(1-K), (1-M)(1-K), (1-Y)(1-K) }

YUV:
Y = 0.299 * R + 0.587 * G + 0.114 * B
U = 0.436 * (B - Y) / (1 - 0.144)
V = 0.615 * (R - Y) / (1 - 0.299)

Code Listing 2 (downloadable source)


Workshop 1:

ES Development Files (right click + Save Target As...)

Code Listing 1
Code Listing 2
Code Listing 3


 


Getting SDL to work at home

Disclaimer: The University cannot support students who chose to work from home. If you suffer from data loss or other such problems, there is NOTHING that we can do, and extensions due to this CANNOT be granted.

If you still want to use SDL at home, perhaps to run programs you wrote at University, the following should help you:

Windows

Everything you need should be available in the files on the workshop tutorials page. You will, however, most likely need to adjust the ESSetup batch file. This file basically just sets various global variables to point to where your SDL files are kept. Where it says 'H:\ESDev\', you will need to change to point to the directory where you put the files.

32-bit Linux

This is a little more involved. (Note, I am assuming that you already have java installed and working).
You need to download the linux version of SDLJava and the linux version of SDL, and then make sure they can be found by the right software.
SDLJava is found here: http://sourceforge.net/project/showfiles.php?group_id=124821 and is called something like sdljava-0.9.1-linux-2.6-bin.tar.gz
Extract this. You will find it contains a load of stuff, but the only thing you need is the lib directory. Copy (or move) all the .jar and .so files to somewhere sensible. (personally, I like to have a lib folder off my home directory for this sort of thing)
Next, download and install the linux version of SDL. It is in RPM format, and is found here: http://www.libsdl.org/download-1.2.php and it is called something like SDL-1.2.11-1.i386.rpm
Lastly, you need to set the system variables to allow java to actually find SDLJava. Depending on where you put the SDLJava files, you will probably need to add a couple of lines to your startup script. I generally use BASH, so I've added the following two lines to my .bashrc file: export LD_LIBRARY_PATH=~/lib:$LD_LIBRARY_PATH export CLASSPATH=~/lib/sdljava.jar:. (You will need to replace ~/lib with where you put your files)

A note on 64-bit Linux

Some people have identified issues with getting SDL to work on 64bit Linux. As I don't have 64bit Linux, it's difficult for me to comment. *In theory* all you should have to do is download the source for SDL and SDLJava and recompile. You may also find the following links useful: SDL-1.2.9-5.2.1 RPM for x86_64: http://rpmfind.net/linux/rpm2html/search.php?query=libSDL-1.2.so.0()(64bit)

www.libsdl.org


© 2006 by Eike Anderson & Leigh McLoughlin, NCCA, Bournemouth University