Subversion Repositories HelenOS

Rev

Rev 4537 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4537 Rev 4668
Line 60... Line 60...
60
 
60
 
61
static cell curscreen[B_SIZE];  /* non-zero => standout (or otherwise marked) */
61
static cell curscreen[B_SIZE];  /* non-zero => standout (or otherwise marked) */
62
static int curscore;
62
static int curscore;
63
static int isset;               /* true => terminal is in game mode */
63
static int isset;               /* true => terminal is in game mode */
64
 
64
 
-
 
65
static int use_color;       /* true => use colors */
-
 
66
 
65
static const struct shape *lastshape;
67
static const struct shape *lastshape;
66
 
68
 
67
 
69
 
68
/*
70
/*
69
 * putstr() is for unpadded strings (either as in termcap(5) or
71
 * putstr() is for unpadded strings (either as in termcap(5) or
Line 75... Line 77...
75
        putchar(*(s++));
77
        putchar(*(s++));
76
}
78
}
77
 
79
 
78
static void start_standout(uint32_t color)
80
static void start_standout(uint32_t color)
79
{
81
{
-
 
82
    fflush(stdout);
80
    console_set_rgb_color(fphone(stdout), 0xf0f0f0, color);
83
    console_set_rgb_color(fphone(stdout), 0xf0f0f0,
-
 
84
        use_color ? color : 0x000000);
81
}
85
}
82
 
86
 
83
static void resume_normal(void)
87
static void resume_normal(void)
84
{
88
{
-
 
89
    fflush(stdout);
85
    console_set_rgb_color(fphone(stdout), 0, 0xf0f0f0);
90
    console_set_rgb_color(fphone(stdout), 0, 0xf0f0f0);
86
}
91
}
87
 
92
 
88
void clear_screen(void)
93
void clear_screen(void)
89
{
94
{
Line 112... Line 117...
112
    scr_clear();
117
    scr_clear();
113
}
118
}
114
 
119
 
115
void moveto(int r, int c)
120
void moveto(int r, int c)
116
{
121
{
-
 
122
    fflush(stdout);
117
    console_goto(fphone(stdout), c, r);
123
    console_goto(fphone(stdout), c, r);
118
}
124
}
119
 
125
 
120
winsize_t winsize;
126
winsize_t winsize;
121
 
127
 
122
static int get_display_size(winsize_t *ws)
128
static int get_display_size(winsize_t *ws)
123
{
129
{
124
    return console_get_size(fphone(stdout), &ws->ws_col, &ws->ws_row);
130
    return console_get_size(fphone(stdout), &ws->ws_col, &ws->ws_row);
125
}
131
}
126
 
132
 
-
 
133
static int get_display_color_sup(void)
-
 
134
{
-
 
135
    int rc;
-
 
136
    int ccap;
-
 
137
 
-
 
138
    rc = console_get_color_cap(fphone(stdout), &ccap);
-
 
139
    if (rc != 0)
-
 
140
        return 0;
-
 
141
 
-
 
142
    return (ccap >= CONSOLE_CCAP_RGB);
-
 
143
}
-
 
144
 
127
/*
145
/*
128
 * Set up screen mode.
146
 * Set up screen mode.
129
 */
147
 */
130
void scr_set(void)
148
void scr_set(void)
131
{
149
{
Line 136... Line 154...
136
   
154
   
137
    if (get_display_size(&ws) == 0) {
155
    if (get_display_size(&ws) == 0) {
138
        Rows = ws.ws_row;
156
        Rows = ws.ws_row;
139
        Cols = ws.ws_col;
157
        Cols = ws.ws_col;
140
    }
158
    }
-
 
159
 
-
 
160
    use_color = get_display_color_sup();
141
   
161
   
142
    if ((Rows < MINROWS) || (Cols < MINCOLS)) {
162
    if ((Rows < MINROWS) || (Cols < MINCOLS)) {
143
        char smallscr[55];
163
        char smallscr[55];
144
       
164
       
145
        snprintf(smallscr, sizeof(smallscr),
165
        snprintf(smallscr, sizeof(smallscr),