/* * $Id: console.h,v 1.3 2002/09/19 00:18:43 aeneas Exp $ * Copyright (c) 2002, Dominik Schnitzer * * JFK - JFK Fucking Killerz, a massive multiplayer 2d shoot'em-up game * http://relax.ath.cx/jfk/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef JFK_CONSOLE_H #define JFK_CONSOLE_H #include #include #include #include "font.h" #include "clock.h" #include "objects_c.h" using namespace std; namespace JFK { namespace client { enum console_t { CONSOLE_INPUTNORM, CONSOLE_INPUTEXT, CONSOLE_INPUTDONE, CONSOLE_MAX }; class compare_score { public: int operator() (object* o1, object* o2) const { person* h1 = dynamic_cast(o1); person* h2 = dynamic_cast(o2); if (h1->score == h2->score) return h1->deaths < h2->deaths; return h1->score > h2->score; } }; class console { public: /* Constructor. maxlines specifies the maximum number of log lines * displayed */ console(output *outp, int maxlines); ~console(); /* Display the given text on the console */ void add_log(string text); /* Set the status and content of the keyboard input types */ void set_input(string text, console_t where); /* Set the players to be evaluated for the highscore */ void set_players(vector* players); /* Draw our messages */ void draw(); private: font fnt_g, fnt_r, fnt_y; output* out; vector plys; JFK::clock timer; deque log; deque log_time; static const unsigned long DISPLAY_TIME = 4000000; static const unsigned long FPS_TIME = 3000000; image highscore; JFK::clock cl; unsigned long fpscount, fpstime; string fpsstr; unsigned int lines; int input_mode; string input_text; }; } } #endif /* JFK_CONSOLE_H */