File: io.h

package info (click to toggle)
tetrinet 0.11%2BCVS20070911-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 332 kB
  • sloc: ansic: 4,410; makefile: 41
file content (94 lines) | stat: -rw-r--r-- 2,567 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* Tetrinet for Linux, by Andrew Church <achurch@achurch.org>
 * This program is public domain.
 *
 * Input/output interface declaration and constant definitions.
 */

#ifndef IO_H
#define IO_H

/* Text buffers: */
#define BUFFER_PLINE	0
#define BUFFER_GMSG	1
#define BUFFER_ATTDEF	2

typedef struct {

    /**** Input routine. ****/

    /* Wait for input and return either an ASCII code, a K_* value, -1 if
     * server input is waiting, or -2 if we time out. */
    int (*wait_for_input)(int msec);

    /**** Output routines. ****/

    /* Initialize for output. */
    void (*screen_setup)(void);
    /* Redraw the screen. */
    void (*screen_refresh)(void);
    /* Redraw the screen after clearing it. */
    void (*screen_redraw)(void);

    /* Draw text into the given buffer (@s can contain enum tattr fields;
     * these are the ones with < TATTR_MAX). */
    void (*draw_text)(int bufnum, const char *s);
    /* Clear the given text buffer. */
    void (*clear_text)(int bufnum);

    /* Set up the fields display. */
    void (*setup_fields)(void);
    /* Draw our own field. */
    void (*draw_own_field)(void);
    /* Draw someone else's field. */
    void (*draw_other_field)(int player);
    /* Draw the game status information. */
    void (*draw_status)(void);
    /* Draw specials stuff */
    void (*draw_specials)(void);
    /* Write a text string for usage of a special. */
    void (*draw_attdef)(const char *type, int from, int to);
    /* Draw the game message input window. */
    void (*draw_gmsg_input)(const char *s, int pos);
    /* Clear the game message input window. */
    void (*clear_gmsg_input)(void);

    /* Set up the partyline display. */
    void (*setup_partyline)(void);
    /* Draw the partyline input string with the cursor at the given position. */
    void (*draw_partyline_input)(const char *s, int pos);

    /* Set up the winlist display. */
    void (*setup_winlist)(void);

} Interface;

extern Interface tty_interface, xwin_interface;


/* Text attributes; note that in strings, they are always encoded with +1 to
 * avoid black terminating the string. */

enum tattr {
    /* Note that TATTR_CBLACK text should be visible on a black background, too. */
    TATTR_CBLACK,
    TATTR_CRED,
    TATTR_CGREEN,
    TATTR_CBROWN,
    TATTR_CBLUE,
    TATTR_CMAGENTA,
    TATTR_CCYAN,
    TATTR_CGREY,
    TATTR_CXBRIGHT, /* | this with the colors above to get the bright variant. */
    TATTR_CMAX = 16,

    TATTR_BOLD,
    TATTR_ITALIC,
    TATTR_UNDERLINE,

    TATTR_RESET,

    TATTR_MAX
};


#endif	/* IO_H */