home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / xenon / source / viewscoresstate.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-10  |  1.8 KB  |  89 lines

  1. //-------------------------------------------------------------
  2. //
  3. // Class:    CViewScoresState
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    06/05/00
  8. //
  9. // Base:    CGameState
  10. //
  11. // Derived:    None
  12. //
  13. //-------------------------------------------------------------
  14.  
  15. #include "game.h"
  16.  
  17. //-------------------------------------------------------------
  18.  
  19. CViewScoresState *CViewScoresState::m_instance = 0;
  20.  
  21. //-------------------------------------------------------------
  22.  
  23. CViewScoresState::CViewScoresState()
  24. {
  25. }
  26.  
  27. //-------------------------------------------------------------
  28.  
  29. CViewScoresState::~CViewScoresState()
  30. {
  31. }
  32.  
  33. //-------------------------------------------------------------
  34.  
  35. CGameState *CViewScoresState::instance()
  36. {
  37.     if (!m_instance)
  38.         m_instance = new CViewScoresState;
  39.  
  40.     return m_instance;
  41. }
  42.  
  43. //-------------------------------------------------------------
  44.  
  45. bool CViewScoresState::create()
  46. {
  47.     m_score_table.setCurrentItem(-1);
  48.  
  49.     return true;
  50. }
  51.  
  52. //-------------------------------------------------------------
  53.  
  54. bool CViewScoresState::update()
  55. {
  56.     if (!CGameState::update())
  57.         return false;
  58.  
  59.     if (Options.getOption(OPTION_BACKDROP))
  60.         m_backdrop.draw(gsCPoint(0,0));
  61.     else
  62.         m_screen.clear(gsCColour(gsBLACK));
  63.  
  64.     m_starfield.move(4);
  65.     m_starfield.draw();
  66.  
  67.     m_medium_font.setTextCursor(gsCPoint(0,50));
  68.     m_medium_font.justifyString("Xenon 2000 High Scores");
  69.  
  70.     m_score_table.draw();
  71.  
  72.     m_medium_font.setTextCursor(gsCPoint(0,450));
  73.     m_medium_font.justifyString("Press Fire For Main Menu");
  74.  
  75.     m_screen.flip();
  76.  
  77.     switch (getKey()) {
  78.         case gsKEY_RETURN:
  79.         case gsKEY_ENTER:
  80.         case gsKEY_LCONTROL:
  81.             CGameState::playSample(SAMPLE_MENU_BACK);
  82.             return changeState(CMainMenuState::instance());
  83.         }
  84.  
  85.     return true;
  86. }
  87.  
  88. //-------------------------------------------------------------
  89.