Changeset 50cfa6c in mainline for uspace/app/tetris/screen.c


Ignore:
Timestamp:
2009-07-14T21:25:13Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bf5443d
Parents:
7d88587
Message:

Method for getting console color capabilities. Use to fix invisible tetris pieces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tetris/screen.c

    r7d88587 r50cfa6c  
    6363static int isset;               /* true => terminal is in game mode */
    6464
     65static int use_color;           /* true => use colors */
     66
    6567static const struct shape *lastshape;
    6668
     
    7981{
    8082        fflush(stdout);
    81         console_set_rgb_color(fphone(stdout), 0xf0f0f0, color);
     83        console_set_rgb_color(fphone(stdout), 0xf0f0f0,
     84            use_color ? color : 0x000000);
    8285}
    8386
     
    128131}
    129132
     133static 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
    130145/*
    131146 * Set up screen mode.
     
    142157                Cols = ws.ws_col;
    143158        }
     159
     160        use_color = get_display_color_sup();
    144161       
    145162        if ((Rows < MINROWS) || (Cols < MINCOLS)) {
Note: See TracChangeset for help on using the changeset viewer.