xref: /netbsd/games/dab/gamescreen.h (revision 97d5545f)
1 /*	$NetBSD: gamescreen.h,v 1.4 2021/12/05 09:22:45 rillig Exp $	*/
2 
3 /*-
4  * Copyright (c) 2003 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Christos Zoulas.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * Screen base class
34  */
35 
36 #ifndef _H_GAMESCREEN
37 #define _H_GAMESCREEN
38 
39 #include <stdlib.h>
40 
41 class PLAYER;
42 
43 class GAMESCREEN {
44   public:
45     enum EDGE {
46 	GS_HLINE,
47 	GS_VLINE,
48 	GS_ULCORNER,
49 	GS_URCORNER,
50 	GS_LLCORNER,
51 	GS_LRCORNER,
52 	GS_LTEE,
53 	GS_RTEE,
54 	GS_TTEE,
55 	GS_BTEE,
56 	GS_PLUS
57     };
58     virtual ~GAMESCREEN();
59     virtual void clean(void) = 0;			// Clear screen
60     virtual void moveto(size_t y, size_t x) = 0;	// Move to x, y
61     virtual void addsym(const int sym) = 0;		// Add character symbol
62     virtual void addedge(const int sym) = 0;		// Add character symbol
63     virtual void redraw(void) = 0;			// Refresh
64     virtual int getinput(void) = 0;			// Get user input
65     virtual void bell(void) = 0;			// Beep
66     virtual void score(size_t l, const PLAYER& p) = 0;	// Post current score
67     virtual void games(size_t l, const PLAYER& p) = 0;	// Post games won
68     virtual void total(size_t l, const PLAYER& p) = 0;	// Post total score
69     virtual void ties(const PLAYER& p) = 0;		// Post tie games
70 };
71 
72 #endif
73