Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 9f1362d4 in mainline for uspace/app/tetris/screen.c


Ignore:
Timestamp:
2010-04-19T19:58:18Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
369a5f8
Parents:
caad59a
Message:

console output improvements

  • define new generic styles (STYLE_INVERTED for inverted print and STYLE_SELECTION for selections), use them primarily instead of specifying colors or RGBs
  • use console_set_style(fphone(stdout), STYLE_NORMAL) as the correct mean for reseting console settings (instead of specifying conrete hardcoded colors)
  • rename console_goto() to console_set_pos() (consistency with console_get_pos())
  • use semantically correct unsigned types for console sizes and cursor positions (instead of signed types)
  • use unsigned types for sizes and positions in libclui
  • top: nicer screen redrawing (do not use console_clear() which causes flickering, but repaint the screen properly — not entirely finished yet)
  • initialize mouse pointer coordinates (so the mouse cursor does not behave erratic after boot, unfortunatelly this does not solve ticket #223)
File:
1 edited

Legend:

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

    rcaad59a r9f1362d4  
    5353#include <vfs/vfs.h>
    5454#include <async.h>
     55#include <bool.h>
     56#include <io/console.h>
     57#include <io/style.h>
    5558#include "screen.h"
    5659#include "tetris.h"
    57 #include <io/console.h>
    5860
    5961#define STOP  (B_COLS - 3)
     
    6365static int isset;               /* true => terminal is in game mode */
    6466
    65 static int use_color;           /* true => use colors */
     67static bool use_color;          /* true => use colors */
    6668
    6769static const struct shape *lastshape;
     
    8183{
    8284        fflush(stdout);
    83         console_set_rgb_color(fphone(stdout), 0xf0f0f0,
     85        console_set_rgb_color(fphone(stdout), 0xffffff,
    8486            use_color ? color : 0x000000);
    8587}
     
    8890{
    8991        fflush(stdout);
    90         console_set_rgb_color(fphone(stdout), 0, 0xf0f0f0);
     92        console_set_style(fphone(stdout), STYLE_NORMAL);
    9193}
    9294
     
    118120}
    119121
    120 void moveto(int r, int c)
     122void moveto(ipcarg_t r, ipcarg_t c)
    121123{
    122124        fflush(stdout);
    123         console_goto(fphone(stdout), c, r);
     125        console_set_pos(fphone(stdout), c, r);
    124126}
    125127
     
    131133}
    132134
    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);
     135static bool get_display_color_sup(void)
     136{
     137        ipcarg_t ccap;
     138        int rc = console_get_color_cap(fphone(stdout), &ccap);
     139       
    139140        if (rc != 0)
    140                 return 0;
    141 
     141                return false;
     142       
    142143        return (ccap >= CONSOLE_CCAP_RGB);
    143144}
     
    308309 * (We need its length in case we have to overwrite with blanks.)
    309310 */
    310 void scr_msg(char *s, int set)
     311void scr_msg(char *s, bool set)
    311312{
    312313        int l = str_size(s);
Note: See TracChangeset for help on using the changeset viewer.