Esempio n. 1
0
//-------------------------------------------------------------------
static void gui_batt_draw_charge(){
    int perc = get_batt_perc();
    color cl = (perc<=10)?conf.osd_color_warn:conf.osd_color;
    sprintf(osd_buf, "%3d%%", perc);
    osd_buf[5]=0;
    draw_string(conf.batt_txt_pos.x, conf.batt_txt_pos.y, osd_buf, cl);
}
Esempio n. 2
0
//-------------------------------------------------------------------
static void gui_batt_draw_icon () {
    coord x;
    int perc = get_batt_perc();
    color cl = (perc<=10)?conf.osd_color_warn:(conf.batt_icon_color&0xFF);

    // battery icon
    draw_rect(conf.batt_icon_pos.x+3-1,    conf.batt_icon_pos.y+1,     conf.batt_icon_pos.x+3+25+1, conf.batt_icon_pos.y+1+10,  cl);
    draw_rect(conf.batt_icon_pos.x+3-3,    conf.batt_icon_pos.y+1+2,   conf.batt_icon_pos.x+3-2,    conf.batt_icon_pos.y+1+8,   cl);
    draw_line(conf.batt_icon_pos.x+3-4,    conf.batt_icon_pos.y+1+2-1, conf.batt_icon_pos.x+3-4,    conf.batt_icon_pos.y+1+8+1, COLOR_BLACK);  // l
    draw_line(conf.batt_icon_pos.x+3-2,    conf.batt_icon_pos.y+1-1,   conf.batt_icon_pos.x+3+25+2, conf.batt_icon_pos.y+1-1,   COLOR_BLACK);  // t
    draw_line(conf.batt_icon_pos.x+3-2,    conf.batt_icon_pos.y+1+11,  conf.batt_icon_pos.x+3+25+2, conf.batt_icon_pos.y+1+11,  COLOR_BLACK);  // b
    draw_line(conf.batt_icon_pos.x+3+25+2, conf.batt_icon_pos.y+1-1,   conf.batt_icon_pos.x+3+25+2, conf.batt_icon_pos.y+1+10,  COLOR_BLACK);  // r
    
    // battery fill
    x=conf.batt_icon_pos.x+3+1+25-(perc/4);
    if (x<=conf.batt_icon_pos.x+3) x=conf.batt_icon_pos.x+3+1;
    if (x>conf.batt_icon_pos.x+3+25+1) x=conf.batt_icon_pos.x+3+25+1;
    draw_filled_rect(conf.batt_icon_pos.x+3, conf.batt_icon_pos.y+1+1, x-1, conf.batt_icon_pos.y+1+9, MAKE_COLOR(COLOR_TRANSPARENT, COLOR_BLACK));
    draw_filled_rect(x, conf.batt_icon_pos.y+1+1, conf.batt_icon_pos.x+3+25, conf.batt_icon_pos.y+1+9, MAKE_COLOR(cl, cl));
}
Esempio n. 3
0
//-------------------------------------------------------------------
static void gui_read_draw_batt() {
    sprintf(buffer, "Batt:%3d%%", get_batt_perc());
    draw_txt_string((camera_screen.width-camera_screen.ts_button_border)/FONT_WIDTH-2-1-1-9, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
}
Esempio n. 4
0
//-------------------------------------------------------------------
static void gui_read_draw_batt() {
    sprintf(buffer, "Batt:%3d%%", get_batt_perc());
    draw_string(camera_screen.disp_right-11*FONT_WIDTH, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
}
Esempio n. 5
0
void platformRenderGame(StcGame *gameInstance){
    int i, j;

    for(i = 0; i < BOARD_WIDTH; ++i) {
        for (j = 0; j < BOARD_HEIGHT; ++j){
          tmp[i][j] = EMPTY_CELL;
          tmp2[i][j] = EMPTY_CELL;
        }
    }

    /* Draw preview block */
    if(game->nextBlock.type != prevNextBlockType){
        prevNextBlockType = game->nextBlock.type;
        for (i = 0; i < 4; ++i) {
            for (j = 0; j < 4; ++j) {
                if (game->nextBlock.cells[i][j] != EMPTY_CELL) {
                    draw_filled_rect(camera_screen.ts_button_border+PREVIEW_X + (TILE_SIZE * i),
                            PREVIEW_Y + (TILE_SIZE * j),
                            camera_screen.ts_button_border+PREVIEW_X + (TILE_SIZE * i)+TILE_SIZE-1,
                            PREVIEW_Y + (TILE_SIZE * j)+TILE_SIZE-1,
                             MAKE_COLOR(game->nextBlock.cells[i][j], game->nextBlock.cells[i][j]));
                }else{
                    draw_filled_rect(camera_screen.ts_button_border+PREVIEW_X + (TILE_SIZE * i),
                            PREVIEW_Y + (TILE_SIZE * j),
                            camera_screen.ts_button_border+PREVIEW_X + (TILE_SIZE * i)+TILE_SIZE-1,
                            PREVIEW_Y + (TILE_SIZE * j)+TILE_SIZE-1,
                            TETRIS_COLOR_BG);
                }
            }
        }
    }
    
    /* Draw the cells in the board */
    for (i = 0; i < BOARD_WIDTH; ++i) {
        for (j = 0; j < BOARD_HEIGHT; ++j){
            if (game->map[i][j] != EMPTY_CELL) {
                tmp2[i][j] = game->map[i][j];
            }
        }
    }
    /* Draw falling tetromino */
    for (i = 0; i<4; ++i) {
        for (j = 0; j < 4; ++j) {
            if (game->fallingBlock.cells[i][j] != EMPTY_CELL) {
              tmp[i+game->fallingBlock.x][j+game->fallingBlock.y] = game->fallingBlock.cells[i][j];
            }
        }
    }

    for (i = 0; i < BOARD_WIDTH; ++i) {
        for (j = 0; j < BOARD_HEIGHT; ++j){
                    if(tmp[i][j] != EMPTY_CELL){
                    draw_filled_rect(camera_screen.ts_button_border+BOARD_X + (TILE_SIZE * i),
                            BOARD_Y + (TILE_SIZE * j),
                            camera_screen.ts_button_border+BOARD_X + (TILE_SIZE * i)+TILE_SIZE-1,
                            BOARD_Y + (TILE_SIZE * j)+TILE_SIZE-1,
                             MAKE_COLOR(tmp[i][j], tmp[i][j]));
                    }else if(tmp2[i][j] != EMPTY_CELL){
                    draw_filled_rect(camera_screen.ts_button_border+BOARD_X + (TILE_SIZE * i),
                            BOARD_Y + (TILE_SIZE * j),
                            camera_screen.ts_button_border+BOARD_X + (TILE_SIZE * i)+TILE_SIZE-1,
                            BOARD_Y + (TILE_SIZE * j)+TILE_SIZE-1,
                             MAKE_COLOR(tmp2[i][j], tmp2[i][j]));
                    }else{
                    draw_filled_rect(camera_screen.ts_button_border+BOARD_X + (TILE_SIZE * i),
                            BOARD_Y + (TILE_SIZE * j),
                            camera_screen.ts_button_border+BOARD_X + (TILE_SIZE * i)+TILE_SIZE-1,
                            BOARD_Y + (TILE_SIZE * j)+TILE_SIZE-1,
                             TETRIS_COLOR_BOARD);
                    }
        }
    }
    /* output game info */
    char str_buf[100];
    static struct tm *ttm;
    sprintf(str_buf,"High:    %5d",game->stats.high);
    draw_string(camera_screen.ts_button_border+150,35,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK));
    sprintf(str_buf,"Points:  %5d",game->stats.score);
    draw_string(camera_screen.ts_button_border+150,55,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK));
    sprintf(str_buf,"Lines:   %5d",game->stats.lines);
    draw_string(camera_screen.ts_button_border+150,75,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK));
    sprintf(str_buf,"Level:   %5d",game->stats.level);
    draw_string(camera_screen.ts_button_border+150,95,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK));
    sprintf(str_buf,"UP  -> Pause");
    draw_string(camera_screen.ts_button_border+150,135,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK));
    sprintf(str_buf,"SET -> Rotate");
    draw_string(camera_screen.ts_button_border+150,155,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK));
    ttm = get_localtime();
    sprintf(str_buf,"Time:    %2u:%02u", ttm->tm_hour, ttm->tm_min);
    draw_string(camera_screen.ts_button_border+150,195,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK));
    sprintf(str_buf,"Batt:     %3d%%", get_batt_perc());
    draw_string(camera_screen.ts_button_border+150,215,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK));
}