You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.adoc 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. [[_5]]
  2. == Exploring the Spacewar Example
  3. _© Copyright 1997-2001 Xerox Corporation. All rights reserved._
  4. _Last updated: January 10, 2001_
  5. The code in this directory is an implementation of the classic video
  6. game Spacewar.
  7. The Spacewar game is intended to provide a modest-sized example of a
  8. program that uses aspects. The code for this example is evolving, as we
  9. add new features to AspectJ and come up with a better understanding of
  10. how to use the features.
  11. In order to compile and run this example, make sure to have the latest
  12. version of AspectJ correctly installed. If you're not sure you do, try
  13. the helloworld example first by following the instructions in
  14. xref:../doc/primer/default.html[Primer] section Getting Started.
  15. [[_5_1]]
  16. === Compiling Spacewar
  17. * Change to the `examples` directory.
  18. * Type `ajc -argfile spacewar/demo.lst` to compile the system.
  19. [[_5_2]]
  20. === Running Spacewar
  21. * In the examples directory, type `java spacewar.Game`
  22. When the game starts up you will see two different displays. These are
  23. the two built-in display aspects of the game. In each you will see a
  24. single white ship and two red ships. The white ship is yours to control;
  25. the red ships are an enemy robots. Your ship is controlled with the four
  26. arrow keys to turn, thrust and stop; the spacebar fires. As you play,
  27. the game will be displayed in both windows.
  28. When running on a 1.4 or later VM, click in the main panel to give it
  29. focus so that your keystrokes are recognized.
  30. You can quit the game with ctl-Q.
  31. [[_5_3]]
  32. === Exploring the Code
  33. There is one other built-in configurations for the Spacewar game. Try it
  34. by typing `ajc @spacewar\debug.lst`. This compiles in an elaborate
  35. debugging aspect for the game.
  36. We recommend you explore the Spacewar source code and look at the
  37. aspects that it uses. You will find several of them, of different scales
  38. and different degrees of cross-cutting. Remember that these represent
  39. our evolving understanding of how to use AspectJ to implement Spacewar.
  40. If you believe we should be doing something differently, then please let
  41. us know.