コード例 #1
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);
}
コード例 #2
0
ファイル: gui_debug.c プロジェクト: arne182/chdk-eyefi
//-------------------------------------------------------------------
static void gui_debug_draw_values(const coord y, void* addr) {
    int i;

    if (!(addr<=(void*)MAXRAMADDR || addr>=(void*)ROMBASEADDR)) { addr = &dummy; };

    sprintf(buf, "0x%08X (%10u)", *((unsigned int*)addr), *((unsigned int*)addr));
    draw_txt_string(10, y, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));

    sprintf(buf, "0x%04X (%5hu)", *((unsigned short*)addr), *((unsigned short*)addr));
    draw_txt_string(10, y+1, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));

    sprintf(buf, "0x%02X (%3hu)", *((unsigned char*)addr), *((unsigned char*)addr));
    draw_txt_string(10, y+2, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));

    //sprintf(buf, "0x%lf", *((double*)addr));
    //draw_txt_string(10, y+3, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));

    for (i=0; i<30; ++i) {
        if (*((char*)(addr+i))) buf[i]=*((char*)(addr+i));
        else break;
    }
    while (i<30) {
        buf[i++]=' ';
    }
    buf[i]=0;
    draw_txt_string(10, y+4, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
}
コード例 #3
0
ファイル: module_inspector.c プロジェクト: pelrun/CHDK
static void gui_mem_info(char *typ, cam_meminfo *meminfo, int showidx)
{
    char txt[50];
    sprintf(txt,"%-5s: %08x-%08x: %d",typ,meminfo->start_address, meminfo->end_address, meminfo->total_size);
    draw_txt_string(0, 5+showidx,  txt,       MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
	sprintf(txt,"alloc: now=%d(%d) max=%d", meminfo->allocated_size, meminfo->allocated_count, meminfo->allocated_peak);
    draw_txt_string(0, 6+showidx,  txt,       MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
	sprintf(txt,"free:  now=%d(%d) max=%d", meminfo->free_size, meminfo->free_block_count, meminfo->free_block_max_size);
    draw_txt_string(0, 7+showidx,  txt,       MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
}
コード例 #4
0
ファイル: module_inspector.c プロジェクト: pelrun/CHDK
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;
}
コード例 #5
0
ファイル: gui_debug.c プロジェクト: adongy/ixus160_elph160
//-------------------------------------------------------------------
static void gui_debug_draw_values(const coord y, void* addr) {
    int i;

    if ((addr<=(void*)camera_info.maxramaddr || addr>=(void*)camera_info.rombaseaddr))
    {
        sprintf(buf, "0x%08X (%10u)", *((unsigned int*)addr), *((unsigned int*)addr));
        draw_string(10*FONT_WIDTH, y, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));

        sprintf(buf, "0x%04X     (     %5hu)", *((unsigned short*)addr), *((unsigned short*)addr));
        draw_string(10*FONT_WIDTH, y+FONT_HEIGHT, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));

        sprintf(buf, "0x%02X       (       %3hu)", *((unsigned char*)addr), *((unsigned char*)addr));
        draw_string(10*FONT_WIDTH, y+2*FONT_HEIGHT, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));

        for (i=0; i<30; ++i) {
            if (*((char*)(addr+i))) buf[i]=*((char*)(addr+i));
            else break;
        }
        while (i<30) {
            buf[i++]=' ';
        }
        buf[i]=0;
        draw_string(10*FONT_WIDTH, y+3*FONT_HEIGHT, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
    }
    else
    {
        draw_string(10*FONT_WIDTH, y, bad_address, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
        draw_string(10*FONT_WIDTH, y+FONT_HEIGHT, bad_address, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
        draw_string(10*FONT_WIDTH, y+2*FONT_HEIGHT, bad_address, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
        draw_string(10*FONT_WIDTH, y+3*FONT_HEIGHT, bad_address, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
    }
}
コード例 #6
0
ファイル: gui_osd.c プロジェクト: de-wolff/CHDK
//-------------------------------------------------------------------
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;

    twoColors col = user_color(conf.osd_color);

    draw_rectangle(x0,y0,x0+70,y0+24, visible? MAKE_COLOR(BG_COLOR(col),BG_COLOR(col)): COLOR_TRANSPARENT, RECT_BORDER1|DRAW_FILLED);

    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), col);
    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), col);

    deltax=8*get_ev_video();

    x0+=deltax;

    draw_line(x0+34,y0+16,x0+34,y0+22,col);
    draw_line(x0+35,y0+16,x0+35,y0+22,col);

    draw_line(x0+32,y0+19,x0+32,y0+22,col);
    draw_line(x0+33,y0+18,x0+33,y0+22,col);
    draw_line(x0+36,y0+18,x0+36,y0+22,col);
    draw_line(x0+37,y0+19,x0+37,y0+22,col);
#endif
}
コード例 #7
0
ファイル: main.c プロジェクト: daishengdong/ArtOS
// ----------------------------------------------------------------------------
// TestB: 一个极简的"进程"
void TestB() {
    int i = 0x1000;
    while (1) {
        disp_color_str("B.", BRIGHT | MAKE_COLOR(BLACK, RED));
        milli_delay(10);
    }
}
コード例 #8
0
ファイル: console.c プロジェクト: c10ud/CHDK
//-------------------------------------------------------------------
static void gui_console_draw()
{
    if (console_redraw_flag)
    {
        twoColors col = user_color(conf.menu_color);

        int w = MAX_CONSOLE_LINE_LENGTH;
        int h = MAX_CONSOLE_DISP_LINES;

        coord x = (camera_screen.width - w * FONT_WIDTH) >> 1;
        coord y = (camera_screen.height - (h+1) * FONT_HEIGHT) >> 1;

        draw_rectangle(x-3, y-3, x+w*FONT_WIDTH+3, y+(h+1)*FONT_HEIGHT+2, col, RECT_BORDER1|DRAW_FILLED); // main box
        draw_rectangle(x-2, y-2, x+w*FONT_WIDTH+2, y+FONT_HEIGHT+1, col, RECT_BORDER1|DRAW_FILLED); //title

        draw_string_justified(x, y, "Console - press SET to close", col, 0, w*FONT_WIDTH, TEXT_CENTER); //title text
        y += FONT_HEIGHT + 2;

        int c, i;
        for (c = h-1, i = console_cur_line-console_scroll; c >= 0; --c, --i)
        {
            if (i < 0) i += MAX_CONSOLE_HISTORY;
            draw_string_justified(x-1, y + c * FONT_HEIGHT, console_buf[i], col, 0, w * FONT_WIDTH, TEXT_LEFT|TEXT_FILL);
        }

        // Scrollbar
        draw_rectangle(x+w*FONT_WIDTH, y+((MAX_CONSOLE_HISTORY-console_scroll-h)*(h*FONT_HEIGHT))/MAX_CONSOLE_HISTORY,
                       x+w*FONT_WIDTH+2, y+((MAX_CONSOLE_HISTORY-console_scroll)*(h*FONT_HEIGHT))/MAX_CONSOLE_HISTORY-1,
                       MAKE_COLOR(COLOR_RED, COLOR_RED), RECT_BORDER0|DRAW_FILLED);

        console_redraw_flag = 0;
    }
}
コード例 #9
0
ファイル: gui_snake.c プロジェクト: BioDesignRealWorld/CHDK
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();
}
コード例 #10
0
ファイル: gui_read.c プロジェクト: adongy/ixus160_elph160
//-------------------------------------------------------------------
static void gui_read_draw_clock() {
    static struct tm *ttm;

    ttm = get_localtime();
    sprintf(buffer, "%2u:%02u", ttm->tm_hour, ttm->tm_min);
    draw_string(camera_screen.disp_right-17*FONT_WIDTH, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
}
コード例 #11
0
ファイル: gui_bench.c プロジェクト: BioDesignRealWorld/CHDK
//-------------------------------------------------------------------
static void gui_bench_draw_results(int pos, int value) {
    if (value!=-1) {
        if (value)
            sprintf(buf, "%7d Kb/s      ", value/1024);
        else
            sprintf(buf, lang_str(LANG_BENCH_CALCULATING));
        draw_txt_string(18, pos, buf, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
    }
}
コード例 #12
0
ファイル: gui_bench.c プロジェクト: alex73/ixus160_elph160
//-------------------------------------------------------------------
static void gui_bench_draw_results(int pos, int value) {
    if (value!=-1) {
        if (value)
            sprintf(buf, "%7d Kb/s      ", value/1024);
        else
            sprintf(buf, lang_str(LANG_BENCH_CALCULATING));
        draw_string(18*FONT_WIDTH, pos*FONT_HEIGHT, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
    }
}
コード例 #13
0
ファイル: Wall.cpp プロジェクト: MussabElDash/Bouncy
Wall::Wall(POINT startCorner,
           POINT endCorner,
           POINT deltaVector,
           POINT planeVector,
           void (*pushMatrix)(),
           void (*popMatrix)(),
           void (*translate)(double, double, double),
           void (*scale)(double, double, double),
           void (*cube)(double),
           void (*clearColor)(double, double, double)){
    this->startCorner = startCorner;
    this->endCorner = endCorner;
    this->deltaVector = deltaVector;
    this->planeVector = planeVector;
    
    this->pushMatrix = pushMatrix;
    this->popMatrix = popMatrix;
    this->translate = translate;
    this->scale = scale;
    this->cube = cube;
    this->clearColor = clearColor;
    
    // printf("%lf %lf %lf\n", deltaVector.X, startCorner.X, endCorner.X);
    int xSize = fabs(endCorner.X - startCorner.X) / deltaVector.X;
    int ySize = fabs(endCorner.Y - startCorner.Y) / deltaVector.Y;
    int zSize = fabs(endCorner.Z - startCorner.Z) / deltaVector.Z;
    
    epsilon = deltaVector.X * planeVector.X + deltaVector.Y * planeVector.Y + deltaVector.Z * planeVector.Z;

    this->size = MAKE_COLOR(xSize, ySize, zSize);
    for(int x = 0; x < xSize; x++){
        std::vector<std::vector<COLOR>> additx;
        for(int y = 0; y < ySize; y++){
            std::vector<COLOR> addity;
            for(int z = 0; z < zSize; z++){
                addity.push_back(MAKE_COLOR((rand() % 256) / 255.0, (rand() % 256) / 255.0, (rand() % 256) / 255.0));
            }
            additx.push_back(addity);
        }
        this->wallColors.push_back(additx);
    }
}
コード例 #14
0
ファイル: gui_menu.c プロジェクト: DIYBookScanner/chdk
//-------------------------------------------------------------------
// 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))); 
    }
コード例 #15
0
//-------------------------------------------------------------------
// Draw menu scroll bar if needed, and title bar
static void gui_draw_initial()
{ 
    count = gui_menu_disp_rows();

    if (count > num_lines)
    {
        y = ((camera_screen.height-(num_lines-1)*rbf_font_height())>>1);
        wplus = 8; 
        // scrollbar background 
        draw_rectangle((x+w), y, (x+w)+wplus, y+num_lines*rbf_font_height()-1, MAKE_COLOR(BG_COLOR(user_color(conf.menu_color)), BG_COLOR(user_color(conf.menu_color))), RECT_BORDER0|DRAW_FILLED);
    }
コード例 #16
0
ファイル: gui_calendar.c プロジェクト: adongy/ixus160_elph160
//-------------------------------------------------------------------
void gui_calendar_draw() {
    int x, y;
    static char str[32];
    int w, d, i;
    static struct tm *ttm;

    if (need_redraw == 2)
        gui_calendar_initial_draw();

    ttm = get_localtime();
    sprintf(str, " %2u %s %04u  %2u:%02u:%02u   ", ttm->tm_mday, lang_str(months[ttm->tm_mon]), 1900+ttm->tm_year, ttm->tm_hour, ttm->tm_min, ttm->tm_sec);
    draw_string(camera_screen.disp_left+FONT_WIDTH*8, 0, str, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));

    if (need_redraw) {
        need_redraw = 0;
        
        i = strlen(lang_str(months[cal_month]));
        x = cal_x + (cal_w-FONT_WIDTH*2-FONT_WIDTH*4-FONT_WIDTH*2-i*FONT_WIDTH)/2;
        y = cal_y + 4;
        draw_rectangle(cal_x+FONT_WIDTH, y, cal_x+cal_w-FONT_WIDTH-FONT_WIDTH*4-FONT_WIDTH, y+FONT_HEIGHT, MAKE_COLOR(BG_COLOR(TITLE_COLOR), BG_COLOR(TITLE_COLOR)), RECT_BORDER0|DRAW_FILLED);
        draw_string(x+FONT_WIDTH, y, lang_str(months[cal_month]), TITLE_COLOR);
        
        sprintf(str, "%04d", cal_year);
        draw_string(cal_x+cal_w-FONT_WIDTH*2-FONT_WIDTH*4, y, str, TITLE_COLOR);

        d = calendar_days_in_month(cal_month+1, cal_year);
        w = calendar_day_of_week(1, cal_month+1, cal_year);

        y += FONT_HEIGHT+4+4;

        y += FONT_HEIGHT+4;
        for (x=0; x<w; ++x) {
            draw_string(cal_x+x*FONT_WIDTH*4, y, "    ", (x<5)?CALENDAR_COLOR:WEEKEND_COLOR);
        }
        
        for (i=1; i<=d; ++i) {
            sprintf(str, " %2d ", i);
            draw_string(cal_x+x*FONT_WIDTH*4, y, str, (x<5)?CALENDAR_COLOR:WEEKEND_COLOR);
            
            if (++x>6) {
              x=0;
              y += FONT_HEIGHT+4;
            }
        }
        for (; y<cal_y+cal_h; y += FONT_HEIGHT+4, x=0) {
            for (; x<7; ++x) {
                draw_string(cal_x+x*FONT_WIDTH*4, y, "    ", (x<5)?CALENDAR_COLOR:WEEKEND_COLOR);
            }
        }
    }
}
コード例 #17
0
ファイル: proc.c プロジェクト: tztztztztz/os
/*****************************************************************************
 *                                dump_proc
 *****************************************************************************/
PUBLIC void dump_proc(struct proc* p)
{
    char info[STR_DEFAULT_LEN];
    int i;
    int text_color = MAKE_COLOR(GREEN, RED);

    int dump_len = sizeof(struct proc);

    out_byte(CRTC_ADDR_REG, START_ADDR_H);
    out_byte(CRTC_DATA_REG, 0);
    out_byte(CRTC_ADDR_REG, START_ADDR_L);
    out_byte(CRTC_DATA_REG, 0);

    sprintf(info, "byte dump of proc_table[%d]:\n", p - proc_table);
    disp_color_str(info, text_color);
    for (i = 0; i < dump_len; i++) {
        sprintf(info, "%x.", ((unsigned char *)p)[i]);
        disp_color_str(info, text_color);
    }

    /* printl("^^"); */

    disp_color_str("\n\n", text_color);
    sprintf(info, "ANY: 0x%x.\n", ANY);
    disp_color_str(info, text_color);
    sprintf(info, "NO_TASK: 0x%x.\n", NO_TASK);
    disp_color_str(info, text_color);
    disp_color_str("\n", text_color);

    sprintf(info, "ldt_sel: 0x%x.  ", p->ldt_sel);
    disp_color_str(info, text_color);
    sprintf(info, "ticks: 0x%x.  ", p->ticks);
    disp_color_str(info, text_color);
    sprintf(info, "priority: 0x%x.  ", p->priority);
    disp_color_str(info, text_color);
    sprintf(info, "pid: 0x%x.  ", p->pid);
    disp_color_str(info, text_color);
    sprintf(info, "name: %s.  ", p->name);
    disp_color_str(info, text_color);
    disp_color_str("\n", text_color);
    sprintf(info, "p_flags: 0x%x.  ", p->p_flags);
    disp_color_str(info, text_color);
    sprintf(info, "p_recvfrom: 0x%x.  ", p->p_recvfrom);
    disp_color_str(info, text_color);
    sprintf(info, "p_sendto: 0x%x.  ", p->p_sendto);
    disp_color_str(info, text_color);
    /* sprintf(info, "nr_tty: 0x%x.  ", p->nr_tty); disp_color_str(info, text_color); */
    disp_color_str("\n", text_color);
    sprintf(info, "has_int_msg: 0x%x.  ", p->has_int_msg);
    disp_color_str(info, text_color);
}
コード例 #18
0
ファイル: keyboard.c プロジェクト: douzh/mydisk
/*======================================================================*
                           get_byte_from_kb_buf
*======================================================================*/
PRIVATE t_8 get_byte_from_kb_buf()	/* 从键盘缓冲区中读取下一个字节 */
{
	t_8	scan_code;

	while (kb_in.count <= 0) {}	/* 等待下一个字节到来 */

	disable_int();
	scan_code = *(kb_in.p_tail);
	kb_in.p_tail++;
	if (kb_in.p_tail == kb_in.buf + KB_IN_BYTES) {
		kb_in.p_tail = kb_in.buf;
	}
	kb_in.count--;
	enable_int();

#ifdef __TINIX_DEBUG__
	disp_color_str("[", MAKE_COLOR(WHITE,BLUE));
	disp_int(scan_code);
	disp_color_str("]", MAKE_COLOR(WHITE,BLUE));
#endif

	return scan_code;
}
コード例 #19
0
ファイル: blender_template.c プロジェクト: WoodMath/mathmap
inline static color_t
get_orig_val_pixel (float x, float y, ImBuf *img, int frame)
{
    int ix = (int)x, iy = (int)y;
    unsigned char *p;

    /* FIXME: edge behaviour */
    if (ix < 0 || ix >= img->x
	|| iy < 0 || iy >= img->y)
	return MAKE_COLOR(0,0,0,1);

    p = (unsigned char*)img->rect + (iy * img->x + ix) * 4;

    return MAKE_RGBA_COLOR(p[0],p[1],p[2],p[3]);
}
コード例 #20
0
ファイル: gui_snake.c プロジェクト: BioDesignRealWorld/CHDK
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));
      }
    }
}
コード例 #21
0
/*****************************************************************************
Initialize the console window subsystem
****************************************************************************/
BOOL consolewindow_initialize ( void )
{
	int	i = MAX_WINDOW + 2;

	SDL_memset ( WindowList, 0, sizeof ( CONSOLE_WINDOW ) * i );

	for ( i--; i >= 0; i-- )
		WindowZOrder[i] = i;

	GlobBackgroundColor = MAKE_COLOR ( BLUE, LIGHTGRAY );
	GlobBackgroundPattern = 0xB0;

	RefreshIndicator = 2;

	return TRUE;
}
コード例 #22
0
ファイル: gui_snake.c プロジェクト: BioDesignRealWorld/CHDK
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();
}
コード例 #23
0
ファイル: gui_bench.c プロジェクト: alex73/ixus160_elph160
//-------------------------------------------------------------------
void gui_bench_draw() {
    switch (bench_to_draw) {
        case 1:
            draw_rectangle(camera_screen.disp_left, 0, camera_screen.disp_right, camera_screen.height-1, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK), RECT_BORDER0|DRAW_FILLED);
            draw_string(1*FONT_WIDTH, 0*FONT_HEIGHT,  lang_str(LANG_BENCH_TITLE), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));

            draw_string(1*FONT_WIDTH, 2*FONT_HEIGHT,  lang_str(LANG_BENCH_SCREEN), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
            draw_string(3*FONT_WIDTH, 3*FONT_HEIGHT,  lang_str(LANG_BENCH_WRITE), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
            draw_string(3*FONT_WIDTH, 4*FONT_HEIGHT,  lang_str(LANG_BENCH_READ), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));

            draw_string(1*FONT_WIDTH, 6*FONT_HEIGHT,  lang_str(LANG_BENCH_MEMORY),  MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
            draw_string(3*FONT_WIDTH, 7*FONT_HEIGHT,  lang_str(LANG_BENCH_WRITE), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
            draw_string(3*FONT_WIDTH, 8*FONT_HEIGHT,  lang_str(LANG_BENCH_READ), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));

            draw_string(1*FONT_WIDTH, 10*FONT_HEIGHT, lang_str(LANG_BENCH_FLASH_CARD), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
            draw_string(3*FONT_WIDTH, 11*FONT_HEIGHT, lang_str(LANG_BENCH_WRITE_RAW), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
            draw_string(3*FONT_WIDTH, 12*FONT_HEIGHT, lang_str(LANG_BENCH_WRITE_MEM), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
            draw_string(3*FONT_WIDTH, 13*FONT_HEIGHT, lang_str(LANG_BENCH_WRITE_64K), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
            draw_string(3*FONT_WIDTH, 14*FONT_HEIGHT, lang_str(LANG_BENCH_READ_64K), MAKE_COLOR(COLOR_BLACK, 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;
    }
}
コード例 #24
0
ファイル: gui_osd.c プロジェクト: de-wolff/CHDK
static void gui_print_osd_dof_string_dist(const char * title, int value, short use_good_color, short is_hyp) {
  strcpy(osd_buf, title);
  int i=strlen(osd_buf);
  twoColors col = user_color(conf.osd_color);
  twoColors valid_col = MAKE_COLOR(BG_COLOR(col), COLOR_GREEN);
  if (i<8) {
    draw_osd_string(conf.values_pos, 0, m, osd_buf, col, conf.values_scale);
    if (is_hyp) {
        sprintf_dist_hyp(osd_buf, value);
    } else {
        sprintf_dist(osd_buf, value);
    }
    sprintf(osd_buf+strlen(osd_buf), "%9s", "");
    osd_buf[9-i]=0;
    draw_osd_string(conf.values_pos, i*FONT_WIDTH, m, osd_buf, use_good_color?valid_col:col, conf.values_scale);
  } else {
    osd_buf[9]=0;
    draw_osd_string(conf.values_pos, 0, m, osd_buf, col,conf.values_scale);
  }
  m+=FONT_HEIGHT;
}
コード例 #25
0
// Open a sub-menu
void gui_activate_sub_menu(CMenu *sub_menu)
{
    // push current menu on stack
    gui_menu_stack[gui_menu_stack_ptr].menu = curr_menu;
    gui_menu_stack[gui_menu_stack_ptr].curpos = gui_menu_curr_item;
    gui_menu_stack[gui_menu_stack_ptr].toppos = gui_menu_top_item;

    gui_menu_set_curr_menu(sub_menu, 0, 0);

    gui_menu_stack_ptr++;

    // FIXME check on stack overrun;
    if (gui_menu_stack_ptr > MENUSTACK_MAXDEPTH)
    {
        draw_string(1, 0, "E1", MAKE_COLOR(COLOR_RED, COLOR_YELLOW));
        gui_menu_stack_ptr = 0;
    }

    // Force full redraw
    gui_menu_erase_and_redraw();
}
コード例 #26
0
/* Create a display window */
Uint32	consolewindow_create ( const Uint8 *Title, CW_PROC WndProc, Uint32 Start, Uint32 End )
{
	Uint32	i;

	for ( i = Start; i <= End; i++ )
	{
		if ( ! ( WindowList[i].State & USED ) )
		{
			WindowList[i].Coords.Left = GlobCX;
			WindowList[i].Coords.Top = GlobCY;
			WindowList[i].Coords.Right = GlobCX + 19;
			WindowList[i].Coords.Bottom = GlobCY + 8;

			GlobCX++;
			GlobCY++;

			GlobCX &= 0xF;
			GlobCY &= 0xF;

			WindowList[i].State = USED;
			WindowList[i].Title = Title;
			WindowList[i].Color = MAKE_COLOR ( BLACK, CYAN );
			WindowList[i].WndProc = WndProc;
			WindowList[i].Tag = 0;
			WindowList[i].Tag2 = NULL;

			consolewindow_clrscr ( &WindowList[i] );

			WndProc ( &WindowList[i], CW_MSG_INITIALIZE, NULL );

			WindowList[i].RefreshIndicator = 2;

			SET_REFRESH_LEVEL_TO_1 ( RefreshIndicator );

			return i;
		}
	}

	return CREATE_FAILED;
}
コード例 #27
0
ファイル: gui_osd.c プロジェクト: de-wolff/CHDK
void gui_osd_draw_dof(int is_osd_edit) 
{
    if (conf.show_dof != DOF_DONT_SHOW)
        shooting_update_dof_values();

    if (is_osd_edit ||
        (camera_info.state.mode_rec_or_review && ((conf.show_dof == DOF_SHOW_IN_DOF) || (conf.show_dof == DOF_SHOW_IN_DOF_EX)) &&
         (((camera_info.state.is_shutter_half_press || camera_info.state.state_kbd_script_run || shooting_get_common_focus_mode()) &&
           (camera_info.state.mode_photo || camera_info.state.mode_shooting==MODE_STITCH)) ||
          ((camera_info.state.mode_video || is_video_recording()) && conf.show_values_in_video))))
    {
        twoColors col = user_color(conf.osd_color);
        twoColors valid_col = MAKE_COLOR(BG_COLOR(col), COLOR_GREEN);
        int i = 8, j;
        short f_ex = (conf.show_dof==DOF_SHOW_IN_DOF_EX);
        draw_osd_string(conf.dof_pos, 0, 0, "S/NL/FL:", col, conf.dof_scale);
        sprintf_dist(osd_buf, camera_info.dof_values.subject_distance);
        j = strlen(osd_buf);
        draw_osd_string(conf.dof_pos, i*FONT_WIDTH, 0, osd_buf, (f_ex && (camera_info.dof_values.distance_valid || shooting_get_focus_mode()))?valid_col:col, conf.dof_scale);
        i = i+j;
        draw_osd_string(conf.dof_pos, i*FONT_WIDTH, 0, "/", col, conf.dof_scale);
        sprintf_dist(osd_buf, camera_info.dof_values.near_limit);
        j = strlen(osd_buf);
        draw_osd_string(conf.dof_pos, (++i)*FONT_WIDTH, 0, osd_buf, (f_ex && camera_info.dof_values.distance_valid)?valid_col:col, conf.dof_scale);
        i = i+j;
	    draw_osd_string(conf.dof_pos, i*FONT_WIDTH, 0, "/", col, conf.dof_scale);
        sprintf_dist(osd_buf, camera_info.dof_values.far_limit);
	    draw_osd_string(conf.dof_pos, (++i)*FONT_WIDTH, 0, osd_buf, (f_ex && camera_info.dof_values.distance_valid)?valid_col:col, conf.dof_scale);
        i = 8;
	    draw_osd_string(conf.dof_pos, 0, FONT_HEIGHT, "DOF/HYP:", col, conf.dof_scale);
        sprintf_dist(osd_buf, camera_info.dof_values.depth_of_field);
        j = strlen(osd_buf);
	    draw_osd_string(conf.dof_pos, i*FONT_WIDTH, FONT_HEIGHT, osd_buf, (f_ex && camera_info.dof_values.distance_valid)?valid_col:col, conf.dof_scale);
        i = i+j;
	    draw_osd_string(conf.dof_pos, i*FONT_WIDTH, FONT_HEIGHT, "/", col, conf.dof_scale);
        sprintf_dist_hyp(osd_buf, camera_info.dof_values.hyperfocal_distance);
	    draw_osd_string(conf.dof_pos, (++i)*FONT_WIDTH, FONT_HEIGHT, osd_buf, (f_ex && camera_info.dof_values.hyperfocal_valid)?valid_col:col, conf.dof_scale);
    }
}
コード例 #28
0
ファイル: gui_menu.c プロジェクト: DIYBookScanner/chdk
// Open a sub-menu
void gui_activate_sub_menu(CMenu *sub_menu)
{
    // push current menu on stack
    gui_menu_stack[gui_menu_stack_ptr].menu = curr_menu;
    gui_menu_stack[gui_menu_stack_ptr].curpos = gui_menu_curr_item;
    gui_menu_stack[gui_menu_stack_ptr].toppos = gui_menu_top_item;

    // Select first item in menu, (or none)
    if (conf.menu_select_first_entry)
    {
        gui_menu_set_curr_menu(sub_menu, 0, 0);
        if ((curr_menu->menu[gui_menu_curr_item].type & MENUITEM_MASK)==MENUITEM_TEXT || (curr_menu->menu[gui_menu_curr_item].type & MENUITEM_MASK)==MENUITEM_SEPARATOR)
        {
            //++gui_menu_top_item;
            ++gui_menu_curr_item;
        }
    }
    else 
        gui_menu_set_curr_menu(sub_menu, 0, -1);

    gui_menu_stack_ptr++;

    // FIXME check on stack overrun;
    if (gui_menu_stack_ptr > MENUSTACK_MAXDEPTH)
    {
        draw_txt_string(0, 0, "E1", MAKE_COLOR(COLOR_RED, COLOR_YELLOW));
        gui_menu_stack_ptr = 0;
    }

    // Set active Tv override menu entry if present
    extern void set_tv_override_menu(CMenu *menu);
    set_tv_override_menu(curr_menu);

    // Force full redraw
    gui_menu_erase_and_redraw();
}
コード例 #29
0
ファイル: proc.c プロジェクト: liangbizhi/bzOS
/**************************************************************************************************
 * 					dump_proc
 *************************************************************************************************/
PUBLIC void dump_proc(PROCESS* p){
	char info[STR_DEFAULT_LEN];
	int i;
	int text_color		= MAKE_COLOR(GREEN, RED);
	
	int dump_len		= sizeof(PROCESS);

	out_byte(CRTC_ADDR_REG, START_ADDR_H);
	out_byte(CRTC_DATA_REG, 0);
	out_byte(CRTC_ADDR_REG, START_ADDR_L);
	out_byte(CRTC_DATA_REG, 0);

	vsprintf(info, "byte dump of proc_table[%d]:\n", p - proc_table);
	disp_color_str(info, text_color);
	for(i=0; i<dump_len; i++){
		vsprintf(info, "%x.", ((unsigned char*)p)[i]);
		disp_color_str(info, text_color);
	}

	disp_color_str("\n\n", text_color);
	vsprintf(info, "ANY: %x.\n", ANY);		disp_color_str(info, text_color);
	vsprintf(info, "NO_TASK: %x.\n", NO_TASK);	disp_color_str(info, text_color);
	disp_color_str("\n", text_color);

	vsprintf(info, "ldt_sel: %x.  ", p->ldt_sel);		disp_color_str(info, text_color);
	vsprintf(info, "ticks: %x.  ", p->ticks);		disp_color_str(info, text_color);
	vsprintf(info, "priority: %x.  ", p->priority);		disp_color_str(info, text_color);
//	vsprintf(info, "pid: %x.  ", p->pid);			disp_color_str(info, text_color);
	vsprintf(info, "name: %s.  ", p->name);			disp_color_str(info, text_color);
	disp_color_str("\n", text_color);
	vsprintf(info, "flags: %x.  ", p->flags);		disp_color_str(info, text_color);
	vsprintf(info, "recv_from: %x.  ", p->recv_from);	disp_color_str(info, text_color);
	vsprintf(info, "send_to: %x.  ", p->send_to);		disp_color_str(info, text_color);
	disp_color_str("\n", text_color);
	vsprintf(info, "has_int_msg: %x.  ", p->has_int_msg);	disp_color_str(info, text_color);
}
コード例 #30
0
ファイル: gui_bench.c プロジェクト: BioDesignRealWorld/CHDK
//-------------------------------------------------------------------
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;
    }
}