96 lines
2.3 KiB
C++
96 lines
2.3 KiB
C++
/*
|
|
* PVVMUD a 3D MUD
|
|
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
|
*
|
|
* 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 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 CCONSOLE_H
|
|
#define CCONSOLE_H
|
|
|
|
#include <string>
|
|
|
|
class CPvvmudClient;
|
|
|
|
//class CConsoleCursor {
|
|
|
|
|
|
class CConsole {
|
|
int m_cols; // Number of columns
|
|
int m_rows; // Number of rows
|
|
int m_state; // State variable
|
|
int m_visible;
|
|
int num_msgs; // Number of messages printed on console
|
|
BOOL m_echo;
|
|
BOOL m_dataReady;
|
|
CPvvmudClient * m_client;
|
|
|
|
protected:
|
|
char * m_console;
|
|
string m_inputBuffer;
|
|
int m_numInputChars;
|
|
int m_bufStart;
|
|
double * m_charColor;
|
|
int m_screen_x; // Startpoint (in screen coordinates)
|
|
int m_screen_y;
|
|
int m_print_x; // Position for writing
|
|
int m_print_y;
|
|
int m_input_x; // Position for echo
|
|
int m_input_y;
|
|
void setDataReady(BOOL d=TRUE);
|
|
void scrollMsgs();
|
|
|
|
public:
|
|
const int INPUTSIZE = 80;
|
|
CConsole(CPvvmudClient * cli);
|
|
CConsole(CPvvmudClient * cli, int cols, int rows);
|
|
virtual ~CConsole();
|
|
|
|
|
|
virtual void drawText();
|
|
virtual void addMsg(char * msg);
|
|
int printLine(char * string);
|
|
int print(char * string);
|
|
int printChar(char c);
|
|
void printMsg(char * msg);
|
|
void echoChar(char c);
|
|
void clear();
|
|
void scroll(int lines);
|
|
virtual void keyboardInput(char k);
|
|
|
|
const char * getLine();
|
|
void setCursorPos(int x, int y);
|
|
int getRows();
|
|
int getCols();
|
|
double * getColor();
|
|
void setColor(double red, double green, double blue);
|
|
CPvvmudClient * getClient();
|
|
int changeInputMode();
|
|
int getInputMode();
|
|
int setVisible();
|
|
int isVisible();
|
|
void setEcho(BOOL e);
|
|
BOOL getEcho();
|
|
BOOL getDataReady();
|
|
};
|
|
|
|
#endif // CCONSOLE_H
|
|
|
|
|
|
|
|
|
|
|
|
|