/examples/CuiTetris/app.d

http://github.com/wilkie/djehuty · D · 39 lines · 26 code · 12 blank · 1 comment · 0 complexity · 88921df4e73f176ead6e90b6c14cc9da MD5 · raw file

  1. import cui.application;
  2. import djehuty;
  3. import io.console;
  4. import gamewindow;
  5. import binding.c;
  6. class TermTetris : CuiApplication {
  7. // Start an application instance
  8. static this() { printf("HELLO!\n"); new TermTetris(); }
  9. override void onApplicationStart() {
  10. Console.putln("foo");
  11. Console.hideCaret();
  12. gameWindow = new GameWindow();
  13. push(gameWindow);
  14. }
  15. override void onApplicationEnd() {
  16. Console.clear();
  17. Console.forecolor = Color.White;
  18. Console.put("Your Score was: ");
  19. Console.forecolor = Color.Yellow;
  20. Console.putln(gameWindow.getScore());
  21. Console.putln("");
  22. Console.forecolor = Color.Gray;
  23. Console.putln("Thank you for playing!");
  24. }
  25. protected:
  26. GameWindow gameWindow;
  27. }