1 /* display.h -- Defines for modular display 2 * $Id: display.h,v 1.2 2005/06/29 03:20:34 kvance Exp $ 3 * Copyright (C) 2000 Kev Vance <kvance@kvance.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place Suite 330; Boston, MA 02111-1307, USA. 18 */ 19 20 #ifdef SDL 21 /* The OS X port of SDL requires this to be included in the file containing 22 * main(). Be sure to include display.h in said file whether you need 23 * the display there or not. */ 24 #include "SDL.h" 25 #endif 26 27 #include "keys.h" 28 29 30 #ifndef DISPLAY_H 31 #define DISPLAY_H 1 32 33 typedef struct displaymethod { 34 /* Next display method, if more than one is available */ 35 struct displaymethod *next; 36 37 /* Descriptive name of the display driver */ 38 char *name; 39 40 /* Version number of the display driver */ 41 char *version; 42 43 /* Initialize the display */ 44 int (*init) (void); 45 46 /* Close the display. The display may be initialized again later. */ 47 void (*end) (void); 48 49 /* Put ch[ar] of co[lour] at x,y */ 50 void (*putch) (int x, int y, int ch, int co); 51 52 /* Wait for an input event and return the key value */ 53 int (*getch) (void); 54 55 /* Non-blocking getch() 56 * Returns DKEY_NONE when there are no pending events */ 57 int (*getkey) (void); 58 59 /* Move the cursor to a given position */ 60 void (*cursorgo) (int x, int y); 61 62 /* Print a line of text */ 63 void (*print) (int x, int y, int c, char *s); 64 65 /* Set a descriptive string for the titlebar if available */ 66 void (*titlebar) (char *); 67 68 /* Check state of shift key 69 * Returns true if shift is depressed, otherwise false */ 70 int (*shift) (void); 71 72 /* Put a character without necessarily updating the screen */ 73 void (*putch_discrete) (int x, int y, int ch, int co); 74 75 /* Print a line without necessarily updating the screen */ 76 void (*print_discrete) (int x, int y, int c, char *s); 77 78 /* Update a region of the screen after a discrete write */ 79 void (*update) (int x, int y, int w, int h); 80 81 } displaymethod; 82 83 /* The main display method. Set by RegisterDisplays() */ 84 extern displaymethod display; 85 86 /* Find available displays */ 87 extern void RegisterDisplays(); 88 89 90 #endif /* DISPLAY_H */ 91