Odamex
Setting the Standard in Multiplayer Doom
textscreen/txt_main.h
Go to the documentation of this file.
00001 // Emacs style mode select   -*- C++ -*-
00002 //-----------------------------------------------------------------------------
00003 //
00004 // Copyright(C) 2005,2006 Simon Howard
00005 //
00006 // This program is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU General Public License
00008 // as published by the Free Software Foundation; either version 2
00009 // of the License, or (at your option) any later version.
00010 //
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU General Public License
00017 // along with this program; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00019 // 02111-1307, USA.
00020 //
00021 //-----------------------------------------------------------------------------
00022 //
00023 // Base interface that abstracts the text mode screen.
00024 //
00025 //-----------------------------------------------------------------------------
00026 
00027 #ifndef TXT_MAIN_H
00028 #define TXT_MAIN_H
00029 
00030 // For the moment, txt_sdl.c is the only implementation of the base
00031 // text mode screen API:
00032 
00033 #include "txt_sdl.h"
00034 
00035 // Special keypress values that correspond to mouse button clicks
00036 
00037 #define TXT_MOUSE_BASE   0x10000
00038 #define TXT_MOUSE_LEFT   (TXT_MOUSE_BASE + 0)
00039 #define TXT_MOUSE_RIGHT  (TXT_MOUSE_BASE + 1)
00040 #define TXT_MOUSE_MIDDLE (TXT_MOUSE_BASE + 2)
00041 #define TXT_MAX_MOUSE_BUTTONS  16
00042 
00043 // Screen size
00044 
00045 #define TXT_SCREEN_W 80
00046 #define TXT_SCREEN_H 25
00047 
00048 #define TXT_COLOR_BLINKING (1 << 3)
00049 
00050 typedef enum
00051 {
00052     TXT_COLOR_BLACK,
00053     TXT_COLOR_BLUE,
00054     TXT_COLOR_GREEN,
00055     TXT_COLOR_CYAN,
00056     TXT_COLOR_RED,
00057     TXT_COLOR_MAGENTA,
00058     TXT_COLOR_BROWN,
00059     TXT_COLOR_GREY,
00060     TXT_COLOR_DARK_GREY,
00061     TXT_COLOR_BRIGHT_BLUE,
00062     TXT_COLOR_BRIGHT_GREEN,
00063     TXT_COLOR_BRIGHT_CYAN,
00064     TXT_COLOR_BRIGHT_RED,
00065     TXT_COLOR_BRIGHT_MAGENTA,
00066     TXT_COLOR_YELLOW,
00067     TXT_COLOR_BRIGHT_WHITE
00068 } txt_color_t;
00069 
00070 // Initialize the screen
00071 // Returns 1 if successful, 0 if failed.
00072 
00073 int TXT_Init(void);
00074 
00075 // Shut down text mode emulation
00076 
00077 void TXT_Shutdown(void);
00078 
00079 // Get a pointer to the buffer containing the raw screen data.
00080 
00081 unsigned char *TXT_GetScreenData(void);
00082 
00083 // Update an area of the screen
00084 
00085 void TXT_UpdateScreenArea(int x, int y, int w, int h);
00086 
00087 // Update the whole screen
00088 
00089 void TXT_UpdateScreen(void);
00090 
00091 // Read a character from the keyboard
00092 
00093 int TXT_GetChar(void);
00094 
00095 // Provides a short description of a key code, placing into the
00096 // provided buffer.
00097 
00098 void TXT_GetKeyDescription(int key, char *buf);
00099 
00100 // Retrieve the current position of the mouse
00101 
00102 void TXT_GetMousePosition(int *x, int *y);
00103 
00104 // Sleep until an event is received or the screen needs updating
00105 // Optional timeout in ms (timeout == 0 : sleep forever)
00106 
00107 void TXT_Sleep(int timeout);
00108 
00109 // Controls whether keys are returned from TXT_GetChar based on keyboard
00110 // mapping, or raw key code.
00111 
00112 void TXT_EnableKeyMapping(int enable);
00113 
00114 // Set the window title of the window containing the text mode screen
00115 
00116 void TXT_SetWindowTitle(char *title);
00117 
00118 #endif /* #ifndef TXT_MAIN_H */
00119 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends