예제 #1
0
void Renderer::draw_rect(const RenderListPtr &render_list, const Vec4 &rect, float stroke_width, Color color)
{
	draw_filled_rect(render_list, { rect.x, rect.y, rect.z, stroke_width }, color);
	draw_filled_rect(render_list, { rect.x, rect.y + rect.w - stroke_width, rect.z, stroke_width }, color);
	draw_filled_rect(render_list, { rect.x, rect.y, stroke_width, rect.w }, color);
	draw_filled_rect(render_list, { rect.x + rect.z - stroke_width, rect.y, stroke_width, rect.w }, color);
}
예제 #2
0
파일: gui_read.c 프로젝트: pelrun/CHDK
//-------------------------------------------------------------------
int gui_read_init(const char* file) {
    static struct STD_stat   st;
    read_file = safe_open(file, O_RDONLY, 0777);
    if (strcmp(file, conf.reader_file)!=0) {
        conf.reader_pos = 0;
        strcpy(conf.reader_file, file);
    }
    read_on_screen = 0;
    read_file_size = (read_file>=0 && safe_stat((char*)file, &st)==0)?st.st_size:0;
    if (read_file_size<=conf.reader_pos) {
        conf.reader_pos = 0;
    }
    pause = 0;
    read_to_draw = 1;
    x=camera_screen.ts_button_border+6;
    y=FONT_HEIGHT;
    w=camera_screen.width-camera_screen.ts_button_border*2-6-6-8;
    h=camera_screen.height-y;
    last_time = get_tick_count();

    reader_is_active=1;
    old_mode = gui_set_mode(&GUI_MODE_READ);

    draw_filled_rect(0, 0, camera_screen.width-1, y-1, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK));
    draw_filled_rect(0, y, camera_screen.width-1, camera_screen.height-1, MAKE_COLOR(BG_COLOR(conf.reader_color), BG_COLOR(conf.reader_color)));

    gui_read_draw_scroll_indicator();
    gui_read_draw_batt();

    return (read_file >= 0);
}
예제 #3
0
static void gui_space_draw_spacebar_vertical () {
    coord y;
    color cl = conf.space_color;
    int perc = get_space_perc(), width = 2;
    float size = 0;
    if (conf.space_warn_type == 0){
    cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color);
    }
    if (conf.space_warn_type == 1){
    cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color);
    }
    if (conf.space_warn_type == 2){
    cl = conf.space_color;
    }
    
       // space icon / bar
    width = conf.space_bar_width+1;
    if (conf.space_bar_size == 0){
    size = screen_height/4-4;
         if (conf.space_ver_pos.y>(screen_height-size)){
            conf.space_ver_pos.y = screen_height-size;
        }
    }
    if (conf.space_bar_size == 1){
    size = screen_height/2-4;
       if (conf.space_ver_pos.y>(screen_height-size)){
            conf.space_ver_pos.y = screen_height-size;
        }
    }
     if (conf.space_bar_size == 2){
    size = screen_height-4;
        if (conf.space_ver_pos.y>(screen_height-size)){
            conf.space_ver_pos.y = 0;
        }
    }
    if (conf.space_ver_pos.x > (screen_width-width-3)){
            conf.space_ver_pos.x = screen_width-width-3;
    }
    draw_rect(conf.space_ver_pos.x+1,    conf.space_ver_pos.y+1,     conf.space_ver_pos.x+1+width+1, conf.space_ver_pos.y+1+size+2,  cl);
    draw_line(conf.space_ver_pos.x+1-1,    conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1-1,    conf.space_ver_pos.y+1+5, COLOR_BLACK);  // l
    
    draw_line(conf.space_ver_pos.x+1-1,    conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1+width+2,    conf.space_ver_pos.y+1-1, COLOR_BLACK);  // t
    draw_line(conf.space_ver_pos.x+1-1,    conf.space_ver_pos.y+1+size+3, conf.space_ver_pos.x+1+width+2,    conf.space_ver_pos.y+1+size+3, COLOR_BLACK);   // b
    
    draw_line(conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1-1,   conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1+size+3,  COLOR_BLACK);  // r
    
    // space bar fill
        
    y=conf.space_ver_pos.y+size-(perc/(100/size));
    if (y<=conf.space_ver_pos.y+1) y=conf.space_ver_pos.y+1;
    if (y>conf.space_ver_pos.y+size) y=conf.space_ver_pos.y+size;
    draw_filled_rect(conf.space_ver_pos.x+1+1, conf.space_ver_pos.y+1+1, conf.space_ver_pos.x+1+width, y-1, MAKE_COLOR(COLOR_TRANSPARENT, COLOR_BLACK));
    draw_filled_rect(conf.space_ver_pos.x+1+1, y, conf.space_ver_pos.x+1+width, conf.space_ver_pos.y+1+size+2, MAKE_COLOR(cl, cl));
}
예제 #4
0
static void gui_space_draw_spacebar_horizontal () {
    coord x;
    color cl = conf.space_color;
    int perc = get_space_perc(),height = 2;
    float size = 0;
    if (conf.space_warn_type == 0){
    cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color);
    }
    if (conf.space_warn_type == 1){
    cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color);
    }
    if (conf.space_warn_type == 2){
    cl = conf.space_color;
    }
       // space icon / bar
    height = conf.space_bar_width+1;
    if (conf.space_bar_size == 0){
    size = screen_width/4-4;
           if (conf.space_hor_pos.x>(screen_width-size)){
            conf.space_hor_pos.x = screen_width-size;
        }    
    }
    if (conf.space_bar_size == 1){
    size = screen_width/2-4;
           if (conf.space_hor_pos.x>(screen_width-size)){
            conf.space_hor_pos.x = screen_width-size;
        }
    }
     if (conf.space_bar_size == 2){
    size = screen_width-4;
        if (conf.space_hor_pos.x>(screen_width-size)){
            conf.space_hor_pos.x = 0;
        }
    }
    if (conf.space_hor_pos.y > (screen_height-height-3)){
            conf.space_hor_pos.y = screen_height-height-3;
    }
    draw_rect(conf.space_hor_pos.x+1,    conf.space_hor_pos.y+1,     conf.space_hor_pos.x+1+size+2, conf.space_hor_pos.y+1+height+1,  cl);
    draw_line(conf.space_hor_pos.x+1-1,    conf.space_hor_pos.y+1-1, conf.space_hor_pos.x+1-1,    conf.space_hor_pos.y+1+height+2, COLOR_BLACK);  // l
    draw_line(conf.space_hor_pos.x+1-1,    conf.space_hor_pos.y+1-1,   conf.space_hor_pos.x+1+size+3, conf.space_hor_pos.y+1-1,   COLOR_BLACK);  // t
    draw_line(conf.space_hor_pos.x+1-1,    conf.space_hor_pos.y+1+height+2,  conf.space_hor_pos.x+1+size+3, conf.space_hor_pos.y+1+height+2,  COLOR_BLACK);  // b
    draw_line(conf.space_hor_pos.x+1+size+3, conf.space_hor_pos.y+1-1,   conf.space_hor_pos.x+1+size+3, conf.space_hor_pos.y+1+height+2,  COLOR_BLACK);  // r
    
    // space bar fill
        
    x=conf.space_hor_pos.x+size-(perc/(100/size));
    if (x<=conf.space_hor_pos.x+1) x=conf.space_hor_pos.x+1;
    if (x>conf.space_hor_pos.x+size) x=conf.space_hor_pos.x+size;
    draw_filled_rect(conf.space_hor_pos.x+1+1, conf.space_hor_pos.y+1+1, x-1, conf.space_hor_pos.y+1+height, MAKE_COLOR(COLOR_TRANSPARENT, COLOR_BLACK));
    draw_filled_rect(x, conf.space_hor_pos.y+1+1, conf.space_hor_pos.x+1+size+2, conf.space_hor_pos.y+1+height, MAKE_COLOR(cl, cl));
}
예제 #5
0
//-------------------------------------------------------------------
void gui_osd_draw_ev_video(int is_osd_edit)
{
#if CAM_EV_IN_VIDEO
    if (!is_video_recording() && !is_osd_edit) return;

    int visible = get_ev_video_avail() || is_osd_edit;

    int x0=conf.ev_video_pos.x, y0=conf.ev_video_pos.y;
    int i, deltax;

    draw_filled_rect(x0,y0,x0+70,y0+24, visible? MAKE_COLOR(BG_COLOR(conf.osd_color),BG_COLOR(conf.osd_color)): COLOR_TRANSPARENT);

    if (!visible) { return; }

    for (i=0;i<9;i++) draw_line(x0+2+i*8,   y0+12, x0+2+i*8,   y0+12-(i&1 ? 5 : 10), conf.osd_color);
    for (i=0;i<9;i++) draw_line(x0+2+i*8+1, y0+12, x0+2+i*8+1, y0+12-(i&1 ? 5 : 10), conf.osd_color);

    deltax=8*get_ev_video();

    x0+=deltax;

    draw_line(x0+34,y0+16,x0+34,y0+22,conf.osd_color);
    draw_line(x0+35,y0+16,x0+35,y0+22,conf.osd_color);

    draw_line(x0+32,y0+19,x0+32,y0+22,conf.osd_color);
    draw_line(x0+33,y0+18,x0+33,y0+22,conf.osd_color);
    draw_line(x0+36,y0+18,x0+36,y0+22,conf.osd_color);
    draw_line(x0+37,y0+19,x0+37,y0+22,conf.osd_color);
#endif
}
예제 #6
0
static void game_over(){
    draw_filled_rect(0,0,camera_screen.width,camera_screen.height, COLOR_WHITE);
    sprintf(str_buf,"Points: %d",points);
    draw_string(0,0,str_buf, MAKE_COLOR(COLOR_WHITE, COLOR_BLUE));
    msleep(3000);
    snake_start();
}
예제 #7
0
파일: room.c 프로젝트: oitofelix/mininim
void
clear_rect_to_color (ALLEGRO_BITMAP *to, struct rect *r,
                     ALLEGRO_COLOR color)
{
  int op, src, dst;
  al_get_blender (&op, &src, &dst);
  al_set_blender (ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO);
  draw_filled_rect (to, r, color);
  al_set_blender (op, src, dst);
}
예제 #8
0
파일: draw.c 프로젝트: arthurmaurer/42-FdF
static void	clear(t_fdf *fdf)
{
	t_pt	pt;
	t_uint	size[2];

	pt.x_2d = 0;
	pt.y_2d = 0;
	size[0] = WINDOW_WIDTH;
	size[1] = WINDOW_HEIGHT;
	draw_filled_rect(fdf->gfx, &pt, size, 0);
}
예제 #9
0
//-------------------------------------------------------------------
// Draw menu scroll bar if needed, and title bar
void gui_menu_draw_initial()
{ 
    count = gui_menu_rows();

    if (count > num_lines)
    {
        y = ((camera_screen.height-(num_lines-1)*rbf_font_height())>>1);
        wplus = 8; 
        // scrollbar background 
        draw_filled_rect((x+w), y, (x+w)+wplus, y+num_lines*rbf_font_height()-1, MAKE_COLOR(BG_COLOR(conf.menu_color), BG_COLOR(conf.menu_color))); 
    }
예제 #10
0
파일: room.c 프로젝트: oitofelix/mininim
void
draw_no_floor_selection (ALLEGRO_BITMAP *bitmap, struct pos *p)
{
  if (peq (p, &mouse_pos)) {
    struct rect r;
    new_rect (&r, p->room, p->place * PLACE_WIDTH + 25,
              p->floor * PLACE_HEIGHT - 13,
              PLACE_WIDTH, PLACE_HEIGHT);
    draw_filled_rect (bitmap, &r, NO_FLOOR_SELECTION_COLOR);
  }
}
예제 #11
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));
}
예제 #12
0
파일: guard.c 프로젝트: allisson128/mininim
void
draw_guard_lives (ALLEGRO_BITMAP *bitmap, struct anim *g, enum vm vm)
{
    if (g->dont_draw_lives) return;
    if (g->current_lives <= 0) return;

    int current_lives = (g->current_lives > 10)
                        ? 10 : g->current_lives;

    int i;
    struct coord c;
    struct rect r;
    new_rect (&r, room_view, ORIGINAL_WIDTH - 7 * current_lives,
              ORIGINAL_HEIGHT - 8, 7 * current_lives,
              ORIGINAL_HEIGHT - 1);

    ALLEGRO_COLOR bg_color;

    switch (vm) {
    case CGA:
        bg_color = C_LIVES_RECT_COLOR;
        break;
    case EGA:
        bg_color = E_LIVES_RECT_COLOR;
        break;
    case VGA:
        bg_color = V_LIVES_RECT_COLOR;
        break;
    }

    draw_filled_rect (bitmap, &r, bg_color);

    ALLEGRO_BITMAP *life = guard_life;
    palette pal = NULL;

    if ((g->type == SHADOW && g->style == 0)
            || g->type == KID) {
        pal = get_shadow_life_palette (vm);
        life = apply_palette (life, pal);
    } else if (g->type == SKELETON && g->style == 0)
        life = apply_palette (life, skeleton_life_palette);
    else if (is_guard (g)) {
        pal = get_guard_palette (g->style, vm);
        life = apply_palette (life, pal);
    }

    if (hgc) life = apply_palette (life, hgc_palette);

    for (i = 0; i < current_lives; i++)
        draw_bitmapc (life, bitmap, guard_life_coord (i, &c), 0);
}
예제 #13
0
void gui_module_draw()
{
    int idx, showidx;

    if (modinspect_redraw) {

    	draw_filled_rect(0, 0, camera_screen.width-1, camera_screen.height-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR));
        draw_txt_string(5, 0,  "*** Module Inspector ***", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
        draw_txt_string(0, 2,  "Idx Name         Addr       Size", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));

		showidx=0;
		for ( idx=0; idx<20; idx++)
		{
			struct flat_hdr* flat = module_get_adr(idx);
			if (flat==0) continue;

			char namebuf[12];
			memcpy(namebuf,flat->modulename,11);
			namebuf[11]=0;

			char txt[50];
		    sprintf(txt,"%02d: %-12s %08x - %d bytes", idx, namebuf, (unsigned)flat, flat->reloc_start);
        	draw_txt_string(0, 3+showidx,  txt,       MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
			showidx++;
		}

//    sprintf(buf, lang_str(LANG_MSG_MEMORY_INFO_TEXT), core_get_free_memory(), MEMISOSIZE, &_start, &_end);
//		sprintf(buf,"MEM     %08x-%08x - %d free",&_start, &_end,core_get_free_memory());
//		sprintf(buf,"--- %-12s %08x - %d","CHDK",&_start, MEMISOSIZE );

        draw_txt_string(1, 4+showidx,  "SET-redraw, DISP-unload_all, MENU-exit",       MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));

    	cam_meminfo meminfo;

        // Display Canon heap memory info
        // amount of data displayed may vary depending on GetMemInfo implementation
        memset(&meminfo,0,sizeof(meminfo));
        GetMemInfo(&meminfo);
        gui_mem_info("MEM", &meminfo, showidx);
        showidx += 3;

        // Display EXMEM memory info (only if enabled)
        memset(&meminfo,0,sizeof(meminfo));
        if (GetExMemInfo(&meminfo))
        {
            gui_mem_info("EXMEM", &meminfo, showidx);
		}
	}

	modinspect_redraw = 0;
}
예제 #14
0
static void load_laby(int num){
  int x,y;
  for(x=0;x<RING_WIDTH;x++)
    for(y=0;y<RING_HEIGHT;y++){
      ring[x][y] = labyrinth[num][y][x];
      if(ring[x][y] != ' '){
        draw_element(x,y,wall,0);
      }else{
        draw_filled_rect(x * SNAKE_ELEMENT_SIZE,
                         y * SNAKE_ELEMENT_SIZE,
                         x * SNAKE_ELEMENT_SIZE+SNAKE_ELEMENT_SIZE-1,
                         y * SNAKE_ELEMENT_SIZE+SNAKE_ELEMENT_SIZE-1, MAKE_COLOR(COLOR_WHITE,COLOR_WHITE));
      }
    }
}
예제 #15
0
static void snake_start(){
  int i;
  load_laby(rand()%4);
  snake_head = 3;
  snake_tail = 0;
  level = 5;
  points = 0;
  for(i=snake_tail;i<snake_head;i++){
    snake[i][0] = 2+i;
    snake[i][1] = 2;
    draw_filled_rect(snake[i][0] * SNAKE_ELEMENT_SIZE,
                     snake[i][1] * SNAKE_ELEMENT_SIZE,
                     snake[i][0] * SNAKE_ELEMENT_SIZE+SNAKE_ELEMENT_SIZE-1,
                     snake[i][1] * SNAKE_ELEMENT_SIZE+SNAKE_ELEMENT_SIZE-1, MAKE_COLOR(COLOR_WHITE,COLOR_RED));
  }
  direction = DIR_RIGHT;
  for(i=0;i<10;i++)
    snake_generate_apple();
}
예제 #16
0
파일: mirror.c 프로젝트: oitofelix/mininim
void
draw_mirror (ALLEGRO_BITMAP *bitmap, struct pos *p,
                 enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *mirror = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: mirror = dc_mirror; break;
    case EGA: mirror = de_mirror; break;
    case VGA: mirror = dv_mirror; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: mirror = pc_mirror; break;
    case EGA: mirror = pe_mirror; break;
    case VGA: mirror = pv_mirror; break;
    }
    break;
  }

  /* make mirror black */
  struct rect r;
  new_rect (&r, p->room, PLACE_WIDTH * p->place + 2,
            PLACE_HEIGHT * p->floor + 3,
            PLACE_WIDTH - 10, PLACE_HEIGHT - 16);
  draw_filled_rect (bitmap, &r, BLACK);

  /* draw floor reflex */
  draw_floor_reflex (bitmap, p, em, vm);

  /* draw mirror properly */
  if (vm == VGA) mirror = apply_hue_palette (mirror);
  if (hgc) mirror = apply_palette (mirror, hgc_palette);
  if (peq (p, &mouse_pos))
    mirror = apply_palette (mirror, selection_palette);

  struct coord c;
  draw_bitmapc (mirror, bitmap, mirror_coord (p, &c), 0);
}
예제 #17
0
//-------------------------------------------------------------------
void gui_bench_draw() {
    switch (bench_to_draw) {
        case 1:
            draw_filled_rect(0, 0, camera_screen.width-1, camera_screen.height-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR));
            draw_txt_string(1, 0,  lang_str(LANG_BENCH_TITLE), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));

            draw_txt_string(1, 2,  lang_str(LANG_BENCH_SCREEN),       MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(3, 3,  lang_str(LANG_BENCH_WRITE), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(3, 4,  lang_str(LANG_BENCH_READ), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));

            draw_txt_string(1, 6,  lang_str(LANG_BENCH_MEMORY),       MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(3, 7,  lang_str(LANG_BENCH_WRITE), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(3, 8,  lang_str(LANG_BENCH_READ), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));

            draw_txt_string(1, 10, lang_str(LANG_BENCH_FLASH_CARD),   MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(3, 11, lang_str(LANG_BENCH_WRITE_RAW), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(3, 12, lang_str(LANG_BENCH_WRITE_MEM), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(3, 13, lang_str(LANG_BENCH_WRITE_64K), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(3, 14, lang_str(LANG_BENCH_READ_64K), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            
            /* no break here */
        case 2:
            gui_bench_draw_results_screen(3, bench.screen_output_bps, camera_screen.buffer_size);
            gui_bench_draw_results_screen(4, bench.screen_input_bps, camera_screen.width * vid_get_viewport_height() * 3);

            gui_bench_draw_results(7, bench.memory_write_bps);
            gui_bench_draw_results(8, bench.memory_read_bps);

            gui_bench_draw_results(11, bench.disk_write_raw_bps);
            gui_bench_draw_results(12, bench.disk_write_mem_bps);
            gui_bench_draw_results(13, bench.disk_write_buf_bps);
            gui_bench_draw_results(14, bench.disk_read_buf_bps);

            bench_to_draw = 0;
            break;
        default:
            bench_to_draw = 0;
            break;
    }
}
예제 #18
0
//-------------------------------------------------------------------
void gui_debug_draw() {
    switch (debug_to_draw) {
        case 1:
            draw_filled_rect(0, 0, screen_width-1, screen_height-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR));
            draw_txt_string(1, 0, "Address:", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(22, 0, "Incr:", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(39,0,  "Auto:", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(1, 1, "Values:",  MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(2, 2, "DWORD  :", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(2, 3, "WORD   :", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(2, 4, "BYTE   :", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(2, 5, "DOUBLE :", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(2, 6, "STRING :", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(1, 7, "Dereferencing:",  MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(2, 8, "DWORD  :", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(2, 9, "WORD   :", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(2, 10, "BYTE   :", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(2, 11, "DOUBLE :", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
            draw_txt_string(2, 12, "STRING :", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));

            debug_to_draw = 2;
            break;
        case 2:
            sprintf(buf, "0x%08X", addr);
            draw_txt_string(10, 0, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
            sprintf(buf, "0x%08X", step);
            draw_txt_string(28, 0, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
            sprintf(buf,"%0d",debug_cont_update);
            draw_txt_string(44, 0, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
            gui_debug_draw_values(2, addr);
            gui_debug_draw_values(8, *((void**)addr));
            conf.mem_view_addr_init = (long)addr;

            if (debug_cont_update==0) debug_to_draw = 0;
            break;
        default:
            debug_to_draw = 0;
            break;
    }
}
예제 #19
0
파일: gui_tetris.c 프로젝트: pelrun/CHDK
void gui_tetris_init(){
    draw_filled_rect(camera_screen.ts_button_border+0,0,camera_screen.width-camera_screen.ts_button_border,camera_screen.height, TETRIS_COLOR_BG);
    draw_rect(camera_screen.ts_button_border+BOARD_X-1,BOARD_Y-1,camera_screen.ts_button_border+BOARD_WIDTH*TILE_SIZE+10,BOARD_HEIGHT*TILE_SIZE+10, COLOR_BLACK);
    game = createGame();
    gameInit(game);
  
    long buf;
    FILE *f;    

    f=fopen("A/CHDK/GAMES/TETRIS.SCO","rb");
    if(!f) {
        game->stats.high = 0;
    } else {
    
    fread( &buf, 1, sizeof( buf ), f );
    game->stats.high = buf; 
    
    }

    fclose (f);
    startGame(game);
}
예제 #20
0
void Renderer::draw_pixel(const RenderListPtr &render_list, const Vec2 &position, Color color /* = 0UL */)
{
	draw_filled_rect(render_list, { position.x, position.y, 1.f, 1.f }, color);
}
예제 #21
0
void Renderer::draw_pixels(const RenderListPtr &render_list, const Vec2 &position, float square, Color color /* = 0UL */)
{
	draw_filled_rect(render_list, { position.x - 0.5f * square, position.y - 0.5f * square, square, square }, color);
}
예제 #22
0
void
DrawingContext::draw_filled_rect(const Rectf& rect, const Color& color,
                                 int layer)
{
  draw_filled_rect(rect, color, 0.0f, layer);
}
예제 #23
0
파일: mirror.c 프로젝트: oitofelix/mininim
void
draw_mirror_fg (ALLEGRO_BITMAP *bitmap, struct pos *p, struct frame *f,
                enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *mirror = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: mirror = dc_mirror; break;
    case EGA: mirror = de_mirror; break;
    case VGA: mirror = dv_mirror; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: mirror = pc_mirror; break;
    case EGA: mirror = pe_mirror; break;
    case VGA: mirror = pv_mirror; break;
    }
    break;
  }

  /* make mirror black */
  struct rect r;
  new_rect (&r, p->room, PLACE_WIDTH * p->place + 2,
            PLACE_HEIGHT * p->floor + 3,
            13, PLACE_HEIGHT - 16);
  draw_filled_rect (bitmap, &r, BLACK);

  /* draw floor reflex */
  draw_floor_reflex (bitmap, p, em, vm);

  ignore_clipping_rectangle_intersection = true;
  /* draw anim */
  if (f) {
    push_clipping_rectangle (bitmap, PLACE_WIDTH * p->place + 2,
                             PLACE_HEIGHT * p->floor + 3,
                             16, PLACE_HEIGHT - 9);
    struct anim *a = get_anim_by_id (f->parent_id);
    struct anim a0 = *a;
    invert_frame_dir (&a0.f, &a0.f);
    a0.f.c.x = (2 * PLACE_WIDTH * p->place + 36)
      - (a->f.c.x + al_get_bitmap_width (a->f.b));
    draw_anim_frame (bitmap, &a0, vm);
    pop_clipping_rectangle ();
  }

  /* draw mirror properly */
  if (vm == VGA) mirror = apply_hue_palette (mirror);
  if (hgc) mirror = apply_palette (mirror, hgc_palette);
  if (peq (p, &mouse_pos))
    mirror = apply_palette (mirror, selection_palette);

  struct coord c;
  int h = al_get_bitmap_height (mirror);
  push_reset_clipping_rectangle (bitmap);
  draw_bitmap_regionc (mirror, bitmap, 0, 0, 22, h, mirror_coord (p, &c), 0);
  pop_clipping_rectangle ();

  ignore_clipping_rectangle_intersection = false;
}
예제 #24
0
파일: gui_tetris.c 프로젝트: pelrun/CHDK
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));
}
예제 #25
0
int gui_snake_init() {
    draw_filled_rect(0,0,camera_screen.width,camera_screen.height, COLOR_WHITE);
    snake_start();
	gui_set_mode(&GUI_MODE_SNAKE);
    return 1;
}
예제 #26
0
void gui_snake_draw() {
  unsigned short new_head;
  unsigned short new_tail;
  unsigned short new_cord;
  char game_over_flag = 0,draw_head,clear_tail,draw_points=1;
  unsigned char prevdir = direction;
  unsigned int i;
    new_head = (snake_head+1)%SNAKE_MAX_LENGTH;
    new_tail = (snake_tail+1)%SNAKE_MAX_LENGTH;
    draw_head = 1;
    clear_tail = 1;
    if(direction == DIR_RIGHT){
      new_cord = (snake[snake_head][0]+1)%RING_WIDTH;
      snake[new_head][0] = new_cord;
      snake[new_head][1] = snake[snake_head][1];
    }
    if(direction == DIR_LEFT){
      new_cord = snake[snake_head][0]-1;
      if(new_cord == 0xFFFF) new_cord = RING_WIDTH-1;
      snake[new_head][0] = new_cord;
      snake[new_head][1] = snake[snake_head][1];
    }
    if(direction == DIR_UP){
      new_cord = snake[snake_head][1]-1;
      if(new_cord == 0xFFFF) new_cord = RING_HEIGHT-1;
      snake[new_head][0] = snake[snake_head][0];
      snake[new_head][1] = new_cord;
    }
    if(direction == DIR_DOWN){
      new_cord = (snake[snake_head][1]+1)%RING_HEIGHT;
      snake[new_head][0] = snake[snake_head][0];
      snake[new_head][1] = new_cord;
    }

    i = snake_tail;
    while(1){
      if(snake[i][0] == snake[new_head][0] && snake[i][1] == snake[new_head][1]){
        game_over_flag = 1;
        break;
      }
      if(i == snake_head) break;
      i = (i+1)%SNAKE_MAX_LENGTH;
    }

    if(ring[snake[new_head][0]][snake[new_head][1]] == 1){
      ring[snake[new_head][0]][snake[new_head][1]] = ' ';
      snake_generate_apple();
      points+=level;
      draw_points = 1;
      if((new_head+1)%SNAKE_MAX_LENGTH != snake_tail){
        new_tail = snake_tail;
        clear_tail = 0;
      }
    }else if(ring[snake[new_head][0]][snake[new_head][1]] != ' '){
      game_over_flag = 1;
    }
    if(draw_head){
      if(direction == DIR_UP) draw_element(snake[new_head][0],snake[new_head][1],head,2);   //up
      if(direction == DIR_LEFT) draw_element(snake[new_head][0],snake[new_head][1],head,0);  //left
      if(direction == DIR_DOWN) draw_element(snake[new_head][0],snake[new_head][1],head,1);  //down
      if(direction == DIR_RIGHT) draw_element(snake[new_head][0],snake[new_head][1],head,3);  //right

      new_cord = snake_head-1;
      if(new_cord == 0xFFFF) new_cord = SNAKE_MAX_LENGTH-1;
      if(snake[new_cord][0] > snake[new_head][0] && snake[new_cord][1] > snake[new_head][1] && direction == DIR_UP) draw_element(snake[snake_head][0],snake[snake_head][1],tail2,2);
      else if(snake[new_cord][0] > snake[new_head][0] && snake[new_cord][1] > snake[new_head][1] && direction == DIR_LEFT) draw_element(snake[snake_head][0],snake[snake_head][1],tail2,0);
      else if(snake[new_cord][0] < snake[new_head][0] && snake[new_cord][1] > snake[new_head][1] && direction == DIR_UP) draw_element(snake[snake_head][0],snake[snake_head][1],tail2,4);
      else if(snake[new_cord][0] < snake[new_head][0] && snake[new_cord][1] > snake[new_head][1] && direction == DIR_RIGHT) draw_element(snake[snake_head][0],snake[snake_head][1],tail2,3);
      else if(snake[new_cord][0] < snake[new_head][0] && snake[new_cord][1] < snake[new_head][1] && direction == DIR_RIGHT) draw_element(snake[snake_head][0],snake[snake_head][1],tail2,2);
      else if(snake[new_cord][0] < snake[new_head][0] && snake[new_cord][1] < snake[new_head][1] && direction == DIR_DOWN) draw_element(snake[snake_head][0],snake[snake_head][1],tail2,0);
      else if(snake[new_cord][0] > snake[new_head][0] && snake[new_cord][1] < snake[new_head][1] && direction == DIR_LEFT) draw_element(snake[snake_head][0],snake[snake_head][1],tail2,4);
      else if(snake[new_cord][0] > snake[new_head][0] && snake[new_cord][1] < snake[new_head][1] && direction == DIR_DOWN) draw_element(snake[snake_head][0],snake[snake_head][1],tail2,3);
      else if(prevdir == direction && (direction == DIR_RIGHT || direction == DIR_LEFT)) draw_element(snake[snake_head][0],snake[snake_head][1],tail,0);
      else if(prevdir == direction && (direction == DIR_UP || direction == DIR_DOWN)) draw_element(snake[snake_head][0],snake[snake_head][1],tail,1);
    }
    prevdir = direction;
    if(clear_tail){
        draw_filled_rect(snake[snake_tail][0] * SNAKE_ELEMENT_SIZE,
                         snake[snake_tail][1] * SNAKE_ELEMENT_SIZE,
                         snake[snake_tail][0] * SNAKE_ELEMENT_SIZE+SNAKE_ELEMENT_SIZE-1,
                         snake[snake_tail][1] * SNAKE_ELEMENT_SIZE+SNAKE_ELEMENT_SIZE-1, COLOR_WHITE);
    }
    snake_head = new_head;
    snake_tail = new_tail;
    msleep(100);
    if(game_over_flag){
      game_over();
      game_over_flag = 0;
    }
    if(draw_points){
      draw_points = 0;
      sprintf(str_buf,"Points: %d",points);
      draw_string(10,220,str_buf, MAKE_COLOR(COLOR_WHITE, COLOR_BLUE));
    }
}
예제 #27
0
void
Canvas::draw_filled_rect(const Rectf& rect, const Color& color,
                         int layer)
{
  draw_filled_rect(rect, color, 0.0f, layer);
}
예제 #28
0
파일: lib.c 프로젝트: pelrun/CHDK
void vid_bitmap_refresh()
{
	draw_filled_rect(0, 0, 360, 240, 0x00) ;
}
예제 #29
0
파일: gui_read.c 프로젝트: pelrun/CHDK
//-------------------------------------------------------------------
static void read_goto_next_line() {
    draw_filled_rect(xx, yy, x+w-1, yy+rbf_font_height()-1, MAKE_COLOR(BG_COLOR(conf.reader_color), BG_COLOR(conf.reader_color)));
    xx  = x;
    yy += rbf_font_height();
}
예제 #30
0
파일: gui_read.c 프로젝트: pelrun/CHDK
//-------------------------------------------------------------------
void gui_read_draw(int enforce_redraw) {
    if (conf.reader_autoscroll && !pause && get_tick_count()-last_time >= conf.reader_autoscroll_delay*1000 && (conf.reader_pos+read_on_screen)<read_file_size) {
        conf.reader_pos += read_on_screen;
        read_to_draw = 1;
    }
    if (read_to_draw) {
        int n, i, ii, ll, new_word=1;

        xx=x;
        yy=y;

        lseek(read_file, conf.reader_pos, SEEK_SET);
        read_on_screen=0;

        while (yy<=y+h-rbf_font_height()) {
            n=read(read_file, buffer, READ_BUFFER_SIZE);
            if (n==0) {
                read_goto_next_line();
                if (yy < y+h)
                    draw_filled_rect(x, yy, x+w-1, y+h-1, MAKE_COLOR(BG_COLOR(conf.reader_color), BG_COLOR(conf.reader_color)));
                break;
            }
            i=0;
            while (i<n && yy<=y+h-rbf_font_height()) {
                switch (buffer[i]) {
                case '\r':
                    new_word = 1;
                    break;
                case '\n':
                    read_goto_next_line();
                    new_word = 1;
                    break;
                case '\t':
                    buffer[i] = ' ';
                // no break here
                default:
                    if (conf.reader_wrap_by_words) {
                        if (buffer[i] == ' ') {
                            new_word = 1;
                            if (xx==x) //ignore leading spaces
                                break;
                        } else if (new_word) {
                            new_word = 0;
                            for (ii=i, ll=0; ii<n && buffer[ii]!=' ' && buffer[ii]!='\t' && buffer[ii]!='\r' && buffer[ii]!='\n'; ++ii) {
                                ll+=rbf_char_width(buffer[ii]);
                            }
                            if (ii==n) {
                                memcpy(buffer, buffer+i, n-i);
                                n=ii=n-i;
                                read_on_screen+=i;
                                i=0;
                                n+=read(read_file, buffer+n, READ_BUFFER_SIZE-n);
                                for (; ii<n && buffer[ii]!=' ' && buffer[ii]!='\t' && buffer[ii]!='\r' && buffer[ii]!='\n'; ++ii) {
                                    ll+=rbf_char_width(buffer[ii]);
                                }
                            }
                            if (xx+ll>=x+w && ll<w) {
                                read_goto_next_line();
                                continue;
                            }
                        }
                    }
                    if (!read_fit_next_char(buffer[i])) {
                        read_goto_next_line();
                        continue;
                    }
                    xx+=rbf_draw_char(xx, yy, buffer[i], conf.reader_color);
                    break;
                }
                ++i;
                if (xx >= x+w) {
                    xx  = x;
                    yy += rbf_font_height();
                }
            }
            read_on_screen+=i;
        }

        sprintf(buffer, "(%3d%%) %d/%d  ", (read_file_size)?(conf.reader_pos*100/read_file_size):0, conf.reader_pos, read_file_size);
        buffer[camera_screen.width/FONT_WIDTH]=0;
        draw_txt_string((camera_screen.ts_button_border/FONT_WIDTH), 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline

        // scrollbar
        if (read_file_size) {
            i=h-1 -1;           // full height
            n=i*read_on_screen/read_file_size;           // bar height
            if (n<20) n=20;
            i=(i-n)*conf.reader_pos/read_file_size;   // top pos
            draw_filled_rect(x+w+6+2, y+1,   x+w+6+6, y+1+i,   MAKE_COLOR(COLOR_BLACK, COLOR_BLACK));
            draw_filled_rect(x+w+6+2, y+i+n, x+w+6+6, y+h-1-1, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK));
            draw_filled_rect(x+w+6+2, y+1+i, x+w+6+6, y+i+n,   MAKE_COLOR(COLOR_WHITE, COLOR_WHITE));
        } else {
            draw_filled_rect((x+w)*FONT_WIDTH+2, y*FONT_HEIGHT+1,
                             (x+w)*FONT_WIDTH+6, (y+h)*FONT_HEIGHT-1-1, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK));
        }

        read_to_draw = 0;
        last_time = get_tick_count();
    }
    gui_read_draw_batt();
    gui_read_draw_clock();
}