Exemplo n.º 1
2
static void
draw_emergency_active_message_box(frame_t *frame, int param)
{
	draw_string(1, 10, frame, "Emergency");
	draw_string(1, 20, frame, "program");
	draw_string(1, 30, frame, "activated");
	draw_map_object(18, 8, map_building_sprite[BUILDING_CASTLE] + 1, frame);
}
Exemplo n.º 2
1
static void
draw_call_to_location_message_box(frame_t *frame, int param)
{
	draw_string(1, 10, frame, "You wanted me");
	draw_string(1, 20, frame, "to call you to");
	draw_string(1, 30, frame, "this location");
	draw_map_object(20, 14, 0x90, frame);
}
Exemplo n.º 3
1
static void
draw_emergency_neutral_message_box(frame_t *frame, int param)
{
	draw_string(1, 10, frame, "Emergency");
	draw_string(1, 20, frame, "program");
	draw_string(1, 30, frame, "neutralized");
	draw_map_object(16, 8, map_building_sprite[BUILDING_CASTLE], frame);
}
Exemplo n.º 4
0
static void
draw_1h_since_save_message_box(frame_t *frame, int param)
{
	draw_string(1, 10, frame, "One hour passed");
	draw_string(1, 20, frame, "since the last");
	draw_string(1, 30, frame, "saving");
	draw_icon(20, 14, 0x5d, frame);
}
Exemplo n.º 5
0
static void
draw_lost_fight_message_box(frame_t *frame, int opponent)
{
	draw_string(1, 10, frame, "Your knights");
	draw_string(1, 20, frame, "just lost the");
	draw_string(1, 30, frame, "fight");
	draw_player_face(18, 8, opponent, frame);
}
Exemplo n.º 6
0
static void
draw_call_to_stock_message_box(frame_t *frame, int param)
{
	draw_string(1, 10, frame, "You wanted me");
	draw_string(1, 20, frame, "to call you");
	draw_string(1, 30, frame, "to this stock");
	draw_map_object(16, 8, map_building_sprite[BUILDING_STOCK], frame);
}
Exemplo n.º 7
0
static void
drawChar(Lvns * lvns, int x, int y, int code, int attr)
{
    static int black[] = {
	 COLOR_TRANSPARENT, COLOR_BLACK, COLOR_BLACK, COLOR_BLACK
    };

    static int gray[] = {
	 COLOR_TRANSPARENT, 0x00000006, 0x00000007, 0x0000008
    };

    static int white[] = {
	 COLOR_TRANSPARENT, 0x00000008, 0x0000000c, 0x000000f
    };
#ifdef FONT_PLUS
    if( lvns->font != NULL){
        x += MGL_XOFFSET;
        y += MGL_YOFFSET;
        code--;

        lvnsfont_draw( lvns->font, x + 1, y + 1, code, black);
        if( !attr){
        	lvnsfont_draw( lvns->font, x, y, code, white);
        } else {
        	lvnsfont_draw( lvns->font, x, y, code, gray);
        }
     } else {
#endif /* FONT_PLUS */
    char buf[3];

#if 0
    if (lvns->skip && !attr)
      MglGetEvent(lvns, 1);
#endif

    buf[0] = lvns->leaf_to_euc[code * 2];
    buf[1] = lvns->leaf_to_euc[code * 2 + 1];
    buf[2] = 0;

    x += MGL_XOFFSET;
    y += MGL_YOFFSET;

    set_font(12, 0);

    set_color(COLOR_BLACK);
    draw_string(x + 1, y + 1, buf, DIR_NORTH);
    draw_string(x + 2, y + 1, buf, DIR_NORTH);

    if (!attr) {
	set_color(COLOR_WHITE);
    } else {
	set_color(COLOR_LIGHTGRAY);
    }
    draw_string(x, y, buf, DIR_NORTH);
#ifdef FONT_PLUS
    }
#endif /* FONT_PLUS */
}
Exemplo n.º 8
0
static void
draw_mine_empty_message_box(frame_t *frame, int mine)
{
	draw_string(1, 10, frame, "This mine hauls");
	draw_string(1, 20, frame, "no more raw");
	draw_string(1, 30, frame, "materials");
	draw_map_object(18, 8, map_building_sprite[BUILDING_STONEMINE] + mine,
			frame);
}
Exemplo n.º 9
0
static void
draw_lost_land_message_box(frame_t *frame, int opponent)
{
	draw_string(1, 10, frame, "Because of this");
	draw_string(1, 20, frame, "enemy building");
	draw_string(1, 30, frame, "you lost some");
	draw_string(1, 40, frame, "land");
	draw_player_face(18, 8, opponent, frame);
}
Exemplo n.º 10
0
void GameOver(Game * game) {
	clear_screen();
	draw_string((screen_width()/2)-11,screen_height()/2-2,"----------------------");
    draw_string((screen_width()/2)-11,screen_height()/2-1,"|     You Died :(    |");
    draw_string((screen_width()/2)-11,screen_height()/2,  "|   Press Q to Quit  |");
    draw_string((screen_width()/2)-11,screen_height()/2+1,"| Press R to Restart |");
    draw_string((screen_width()/2)-11,screen_height()/2+2,"----------------------");
	show_screen();
}
Exemplo n.º 11
0
static int test_default_command(int x, int y)
{
	draw_string(x, y, "ENTER  Save & Exit", DRAW_COLOR_WHITE);
	++y;
	draw_string(x, y, "ESC    Exit", DRAW_COLOR_WHITE);
	++y;

	return y;
}
Exemplo n.º 12
0
void info() {
        int x = screen_width()/2;
        draw_string(x - 5, screen_height() -1, "Level: 1" );
        draw_string(0, screen_height()-2, "Georgina Hine (n8872597)");
        draw_string(screen_width() - 9, screen_height() - 2, "Lives:");
        draw_string(screen_width()-18, screen_height() - 2, "Score:"); 
        draw_line(0, screen_height() - 3, screen_width(), screen_height() - 3, '-');
 
        show_screen();
}
Exemplo n.º 13
0
// saves the actual active overlay data to a file.
void save_edge_overlay(void)
{

    char fn[64];
    char msg[64];
    FILE *fd;
    DIR* d;
    int fnum = 0;
    int fr = 0;
    int zoom = 0;
    struct dirent* de;
    static struct utimbuf t;
    // nothing to save? then dont save

    if( !is_buffer_ready() )
    {
        draw_string(0, 0, "No overlay to save.", user_color(conf.osd_color));
        return;
    }

    zoom = shooting_get_zoom();

    // first figure out the most appropriate filename to use
    d = opendir(EDGE_SAVE_DIR);
    if( ! d )
    {
        return;
    }

    while( (de = readdir(d)) )
    {
        fr = get_edge_file_num(de->d_name);
        if( fr > fnum )
        {
            fnum = fr;
        }
    }
    ++fnum; // the highest is set, we use the next one
    get_viewport_size();
    // open the right file
    sprintf(fn, EDGE_SAVE_DIR "/" EDGE_FILE_FORMAT, fnum );
    fd = fopen(fn, "wb");
    if(fd !=NULL)
    {
        // write the data
        fwrite(edgebuf->ptr,edgebuf->ptrLen,1,fd);
        fwrite(&zoom,sizeof(zoom),1,fd);
        fclose(fd);
        t.actime = t.modtime = time(NULL);
        utime(fn, &t);
        sprintf(msg, "Saved as %s",fn);
        draw_string(0, 0, msg, user_color(conf.osd_color));
    }
    closedir(d);
}
Exemplo n.º 14
0
static void render_decorations_fancy(yutani_window_t * window, gfx_context_t * ctx, char * title, int decors_active) {
	int width = window->width;
	int height = window->height;

	for (int j = 0; j < decor_top_height; ++j) {
		for (int i = 0; i < width; ++i) {
			GFX(ctx,i,j) = 0;
		}
	}

	for (int j = decor_top_height; j < height - decor_bottom_height; ++j) {
		for (int i = 0; i < decor_left_width; ++i) {
			GFX(ctx,i,j) = 0;
		}
		for (int i = width - decor_right_width; i < width; ++i) {
			GFX(ctx,i,j) = 0;
		}
	}

	for (int j = height - decor_bottom_height; j < height; ++j) {
		for (int i = 0; i < width; ++i) {
			GFX(ctx,i,j) = 0;
		}
	}

	if (decors_active == DECOR_INACTIVE) decors_active = INACTIVE;

	draw_sprite(ctx, sprites[decors_active + 0], 0, 0);
	for (int i = 0; i < width - (ul_width + ur_width); ++i) {
		draw_sprite(ctx, sprites[decors_active + 1], i + ul_width, 0);
	}
	draw_sprite(ctx, sprites[decors_active + 2], width - ur_width, 0);
	for (int i = 0; i < height - (u_height + l_height); ++i) {
		draw_sprite(ctx, sprites[decors_active + 3], 0, i + u_height);
		draw_sprite(ctx, sprites[decors_active + 4], width - mr_width, i + u_height);
	}
	draw_sprite(ctx, sprites[decors_active + 5], 0, height - l_height);
	for (int i = 0; i < width - (ll_width + lr_width); ++i) {
		draw_sprite(ctx, sprites[decors_active + 6], i + ll_width, height - l_height);
	}
	draw_sprite(ctx, sprites[decors_active + 7], width - lr_width, height - l_height);

	set_font_face(FONT_SANS_SERIF_BOLD);
	set_font_size(12);

	int title_offset = (width / 2) - (draw_string_width(title) / 2);
	if (decors_active == 0) {
		draw_string(ctx, title_offset, TEXT_OFFSET, rgb(226,226,226), title);
	} else {
		draw_string(ctx, title_offset, TEXT_OFFSET, rgb(147,147,147), title);
	}

	/* Buttons */
	draw_sprite(ctx, sprites[decors_active + 8], width - 28, 16);
}
Exemplo n.º 15
0
int main(int argc,char** argv) {
	if (argc < 2) { 
		cout << "usage: ./visualise_face_tracker tracker [video_file]" << endl; 
		return 0;
	}
	
	//load detector model
	face_tracker tracker = load_ft<face_tracker>(argv[1]);

	//create tracker parameters
	face_tracker_params p; 
	p.ssize.resize(3);
	p.ssize[0] = Size(21,21);
	p.ssize[1] = Size(11,11);
	p.ssize[2] = Size(5,5);
	
#ifdef WITH_CUDA
	cout << gpu::getCudaEnabledDeviceCount() << " device(s) found" << endl;
	gpu::setDevice(0);
	gpu::printShortCudaDeviceInfo(cv::gpu::getDevice());
#endif

	//open video stream
	VideoCapture cam; 
	if (argc > 2) cam.open(argv[2]); 
	else cam.open(0);
	if (!cam.isOpened()) {
		cout << "Failed opening video stream." << endl; 
		return 0;
	}
	
	//detect until user quits
	namedWindow("lip tracker");
	Mat im;
	while (cam.isOpened()) {
		if (!paused) {
			cam >> im;
			if (tracker.track(im,p)) tracker.draw(im);
			draw_string(im, "d - redetection");
			draw_string(im, "p - pause", 20);
			tracker.timer.display_fps(im, Point(1, im.rows - 1));
			imshow("lip tracker", im);
		}
		
		int c = waitKey(10);
		if (c == 'q') break;
		else if (c == 'd') {
			tracker.reset();
			paused = false;	
		}
		else if (c == 'p') {
			paused = !paused;
			if (!paused) tracker.reset();
		}
	}
Exemplo n.º 16
0
static void test_dmfont()
{
    s32 x = 300, y = 200;
    draw_string("baby os, [email protected]",            x, y + 20 * 0, color);
    draw_string("天下事有难易乎?",                         x, y + 20 * 1, color);
    draw_string("为之,则难者亦易矣,不为,则易者亦难矣;", x, y + 20 * 2, color);
    draw_string("人之为学有难易乎?",                       x, y + 20 * 3, color);
    draw_string("学之,则难者亦易矣,不学,则易者亦难矣。", x, y + 20 * 4, color);
    draw_hex(0x12345678,                                    x, y + 20 * 5, color);
    draw_dec(sizeof(u32),                                   x, y + 20 * 6, color);
}
Exemplo n.º 17
0
static void
draw_call_to_menu_message_box(frame_t *frame, int menu)
{
	const int map_menu_sprite[] = {
		0xe6, 0xe7, 0xe8, 0xe9,
		0xea, 0xeb, 0x12a, 0x12b
	};

	draw_string(1, 10, frame, "You wanted me");
	draw_string(1, 20, frame, "to call you");
	draw_string(1, 30, frame, "to this menu");
	draw_icon(18, 8, map_menu_sprite[menu], frame);
}
Exemplo n.º 18
0
static void show_menu_line(Menu *m, int x, int y, int w) {
	int hx = x, hw = 0;
	draw_string(x, y, m->label, w);
	if (m->num_opts > 0) {
		m->cur_opt %= m->num_opts;
		hx = x + 24;
		hw = strlen(m->options[m->cur_opt]) + 2;
		if (hw > ((x + w) - hx))
			hw = (x + w) - hx;
		draw_char(hx, y, '[');
		draw_string(hx + 1, y, m->options[m->cur_opt], hw);
		draw_char(hx + hw - 1, y, ']');
	}
}
Exemplo n.º 19
0
int draw_string_shadowed (int x, int y, const unsigned char * our_string, int max_lines, float fr,float fg,float fb, float br,float bg,float bb)
{
 	 int px,py,r;
 	 //set shadow colour
	 glColor3f(br, bg, bb);
	 for(px=-1;px<2;px++)
  	     for(py=-1;py<2;py++)
  	         if(px!=0 || py!=0)
  	             r=draw_string(x+px, y+py, our_string, max_lines);
 	 //set foreground colour
	 glColor3f(fr, fg, fb);
     r=draw_string(x, y, our_string, max_lines);
     return r;
}
Exemplo n.º 20
0
//-------------------------------------------------------------------
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));
    }
}
Exemplo n.º 21
0
//-------------------------------------------------------------------
static void gui_calendar_initial_draw() {
    int x, i;

    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(camera_screen.disp_left+FONT_WIDTH, 0, lang_str(LANG_CALENDAR_TODAY), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
    draw_rectangle(cal_x-3, cal_y-3, cal_x+cal_w+2, cal_y+cal_h+2, CALENDAR_COLOR, RECT_BORDER1);
    draw_rectangle(cal_x-1, cal_y-1, cal_x+cal_w, cal_y+FONT_HEIGHT+8, TITLE_COLOR, RECT_BORDER1|DRAW_FILLED);
    draw_rectangle(cal_x-1, cal_y+FONT_HEIGHT+8, cal_x+cal_w, cal_y+cal_h, CALENDAR_COLOR, RECT_BORDER1|DRAW_FILLED);

    draw_rectangle(cal_x+cal_w-FONT_WIDTH*4*2, cal_y+FONT_HEIGHT+8+1, cal_x+cal_w-1, cal_y+cal_h-1, MAKE_COLOR(BG_COLOR(WEEKEND_COLOR), BG_COLOR(WEEKEND_COLOR)), RECT_BORDER0|DRAW_FILLED);
    for (x=cal_x+FONT_WIDTH/2, i=0; i<7; x+=FONT_WIDTH*4, ++i) {
        draw_string(x, cal_y+4+FONT_HEIGHT+4+4, lang_str(days[i]), (i<5)?CALENDAR_COLOR:WEEKEND_COLOR);
    }
}
Exemplo n.º 22
0
void menu_exec(struct MENU *menu)
{
	unsigned char csel, set, total;
	csel = 0;
again:
	lcd_fill(0);

	set_font(BOLDFONT);
	draw_string(0, 0, (char*)menu->name, 3, DRAW_PUT);
	draw_block(0,10,128,2,3,DRAW_PUT);
	draw_block(0,149,128,2,3,DRAW_PUT);
	set_font(SMALLFONT);

	total = menu->num_entries;
	for(set=0;set<total; set++)
	{
		draw_string(1, 15+(set*9), (char*)menu->entry[set].name, 3, DRAW_PUT);
	}

	draw_block(0, 14+(csel*9), 60, 9, 3, DRAW_XOR);
	draw_string(0, 152, (char*)menu->entry[csel].help, 3, DRAW_PUT);

	while(KEY_Exit) {};
	while(!KEY_Exit)
	{
		waitKeyUpDown();
		draw_block(0, 14+(csel*9), 60, 9, 3, DRAW_XOR);
		if(KEY_OK)
		{
			if(menu_execentry((MENU_ENTRY*)&menu->entry[csel]))
				goto again;
		}
		if(KEY_Up)
		{
			csel--;
			if(csel >= total)
				csel = total-1;
		}
		if(KEY_Down)
		{
			csel++;
			if(csel == total)
				csel = 0;
		}
		draw_block(0, 14+(csel*9), 60, 9, 3, DRAW_XOR);
		draw_block(0, 152, 128, 8, 3, DRAW_ERASE);
		draw_string(0, 152, (char*)menu->entry[csel].help, 3, DRAW_PUT);
	}
}
Exemplo n.º 23
0
static void draw (QCADDesignObject *obj, GdkDrawable *dst, GdkFunction rop)
  {
  GdkGC *gc = NULL ;
  char *pszFont = NULL ;
  GdkRectangle rc = {0} ;
  GdkRectangle rcDst = {0} ;
  GdkRectangle rcDraw = {0} ;
  QCADLabel *label = NULL ;

  if ((label = QCAD_LABEL (obj))->bShrinkWrap)
    qcad_label_shrinkwrap (label) ;

  world_to_real_rect (&(obj->bounding_box), &rc) ;
  gdk_drawable_get_size (dst, &(rcDst.width), &(rcDst.height)) ;
  if (!gdk_rectangle_intersect (&rc, &rcDst, &rcDraw)) return ;

  gc = gdk_gc_new (dst) ;
  gdk_gc_set_function (gc, rop) ;
  gdk_gc_set_clip_rectangle (gc, &rc) ;
  if (GDK_COPY == rop)
    {
    gdk_gc_set_foreground (gc, obj->bSelected ? &(QCAD_DESIGN_OBJECT_GET_CLASS (obj)->clrSelected) : &(obj->clr)) ;
    draw_string (dst, gc, pszFont = g_strdup_printf ("Courier %d", world_to_real_cy (CYFONT)),
      rc.x + XTOP_LABEL_OFFSET, rc.y + YTOP_LABEL_OFFSET, label->psz) ;
    g_free (pszFont) ;
    }
  else
    {
    if (label->bNeedsEPMDraw)
      {
      GdkGC *gcEPM = NULL ;

      label->bNeedsEPMDraw = FALSE ;
      label->epm = exp_pixmap_cond_new (label->epm, dst, rcDraw.width, rcDraw.height, -1) ;
      exp_pixmap_clean (label->epm) ;
      gcEPM = gdk_gc_new (label->epm->pixmap) ;
      gdk_gc_set_foreground (gcEPM, obj->bSelected ? &(QCAD_DESIGN_OBJECT_GET_CLASS (obj)->clrSelected) : &(obj->clr)) ;
      draw_string (label->epm->pixmap, gcEPM, pszFont = g_strdup_printf ("Courier %d", world_to_real_cy (CYFONT)),
        XTOP_LABEL_OFFSET, YTOP_LABEL_OFFSET, label->psz) ;
      g_free (pszFont) ;
      g_object_unref (gcEPM) ;
      }
    gdk_draw_drawable (dst, gc, label->epm->pixmap, 0, 0, rc.x, rc.y, rcDraw.width, rcDraw.height) ;
    }

  if (obj->bSelected)
    gdk_draw_rectangle (dst, gc, FALSE, rc.x, rc.y, rc.width - 1, rc.height - 1) ;
  gdk_gc_unref (gc) ;
  }
/* Display a menu showing available games, allowing the user to select what to play */
uint8_t game_menu() {
	int8_t menu_item = SKETCH_GAME_SELECT;
	int8_t prev_menu_item = menu_item;
		
	uint8_t sketch_string_length = strlen(sketch_game_string);
	uint8_t snake_string_length = strlen(snake_game_string);
	uint8_t life_string_length = strlen(life_game_string);
	
	// Draw game list
	buffer_clear(MENU_BUFFER);
	draw_string(MENU_STRINGS_COLUMN, MENU_START_PAGE, sketch_game_string, sketch_string_length, MENU_BUFFER);
	draw_string(MENU_STRINGS_COLUMN, MENU_START_PAGE+1, snake_game_string, snake_string_length, MENU_BUFFER);
	draw_string(MENU_STRINGS_COLUMN, MENU_START_PAGE+2, life_game_string, life_string_length, MENU_BUFFER);
	draw4x4_square(MENU_STRINGS_COLUMN/2, (menu_item + 1) * PAGE_HEIGHT, MENU_BUFFER); // Start selection at sketch
	send_buffer_all(MENU_BUFFER);
		
	// Get input from the user
	uint8_t button_timer = 0;
	while(1) {
		if(button_timer > BUTTON_TIMER_COUNT) {
			// Input for moving up and down menu
			if(BUTTON_UP) menu_item--;
			if(BUTTON_DOWN) menu_item++;
			// Input for selected current game
			if(BUTTON_A1) break;
			button_timer = 0;
		}
		button_timer++;
		
		if(menu_item >= NUM_MENU_ITEMS) menu_item = 0;
		if(menu_item < 0) menu_item = NUM_MENU_ITEMS - 1;

		// Remove the previous square
		// Only need to clear if the menu selection has moved
		if(!(prev_menu_item == menu_item)) {
			clear4x4_square(MENU_STRINGS_COLUMN/2, (prev_menu_item + 1) * PAGE_HEIGHT, MENU_BUFFER);
			
			// Draw dot next to current menu item
			// Center of dot at game_strings_column/2
			draw4x4_square(MENU_STRINGS_COLUMN/2, (menu_item + 1) * PAGE_HEIGHT, MENU_BUFFER);
		}
		
		send_buffer_all(MENU_BUFFER);
		prev_menu_item = menu_item;
	}
	
	return menu_item;
}
Exemplo n.º 25
0
/// draw hud
void display_hud() {
    char buf[2048];
    sprintf(buf, "time: %6d / draw: %s%s%s%s%s / light: %s / tess: %2d%s",
            (int)round(draw_opts.time*1000),
            (draw_opts.faces)?"f":" ",(draw_opts.edges)?"e":" ",
            (draw_opts.lines)?"l":" ",(draw_opts.control)?"c":" ",
            (draw_opts.doublesided)?"d":" ",
            (draw_opts.cameralights)?"c":"s",
            tesselation_level,(tesselation_smooth)?"s":"f");
//    msg01 += "/"+to_string("%3d",(int)round(1/hud_fps_display.elapsed()));
//    msg01 += "/"+to_string("%3d",(animating)?(int)round(1/hud_fps_update.elapsed()):0);
    
    int w = glutGet(GLUT_WINDOW_WIDTH);
    int h = glutGet(GLUT_WINDOW_HEIGHT);
    
    glColor3f(1,1,1);
    glPushMatrix();
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluOrtho2D(0, w, h, 0);
    glMatrixMode(GL_MODELVIEW);
    glRasterPos2f(5, 20);
    draw_string(buf);
    glPopMatrix();
}
Exemplo n.º 26
0
static void
gamine_on_key (GtkWidget *pWidget,
    GdkEventKey* pKey,
    gamine_t *cb)
{
    gint mx, my;
    if (pKey->type == GDK_KEY_PRESS)
    {
        switch (pKey->keyval)
        {
            case GDK_Escape :
                gtk_main_quit ();
            break;
            case GDK_space :
                gtk_widget_queue_draw(pWidget);
            break;
            case GDK_Print:
                save_picture(cb);
            break;
            default:
                gdk_window_get_pointer(pWidget->window, &mx, &my, NULL);
                draw_string(cb, mx, my, pKey->string);
            break;
        }
    };
}
Exemplo n.º 27
0
void timetrav::port_write(Uint16 port, Uint8 value)
{
	char s[80];
   static char display_string[9] = {0};

   switch(port)
   {
      case 0x1180:
      case 0x1181:
      case 0x1182:
      case 0x1183:
      case 0x1184:
      case 0x1185:
      case 0x1186:
      case 0x1187:
         m_video_overlay_needs_update = true;
         display_string[port & 0x07] = value;
         draw_string(display_string, 0, 0, get_active_video_overlay());
         video_blit();
         break;
      default:
         sprintf(s, "Unmapped write to port %x, value %x", port, value);
		   printline(s);
         break;
   }
}
Exemplo n.º 28
0
void SDL_UpdateRect(SDL_Surface *screen, int x, int y, int w, int h) {
	assert(screen);
	assert(screen->pitch == 320);
	if(screen->flags & SDL_HWSURFACE) {
		if(x == 0 && y == 0) {
			/* Draw FPS */
			vmem = VMEM_ADDR;
			char buf[80];
			sprintf(buf, "%dFPS", get_fps());
			draw_string(buf, 0, 0, 10);
		}
		return;
	}

	/* TODO: Copy the pixels in the rectangle area to the screen. */

//	assert(0);
	int i;
	uint8_t *dst = (void*)0xa0000 + x + y * 320;
	uint8_t *src = screen->pixels + x + y * screen->w;
	for(i = 0; i < h; i++) {
	    memcpy(dst, src, w);
	    src += screen->w;
	    dst += 320;
	}

}
Exemplo n.º 29
0
void _ttk_draw_button_select(cairo_t * cr, int x, int y, int width, int height, char * title) {
	cairo_save(cr);

	cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
	cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);

	cairo_rounded_rectangle(cr, 2 + x, 2 + y, width - 4, height - 4, 2.0);
	cairo_set_source_rgba(cr, 134.0/255.0, 173.0/255.0, 201.0/255.0, 1.0);
	cairo_set_line_width(cr, 2);
	cairo_stroke(cr);

	cairo_rounded_rectangle(cr, 2 + x, 2 + y, width - 4, height - 4, 2.0);
	cairo_set_source_rgba(cr, 202.0/255.0, 211.0/255.0, 232.0/255.0, 1.0);
	cairo_fill(cr);

	{
		cairo_surface_t * surface = cairo_get_target(cr);
		gfx_context_t fake_context = {
			.width = cairo_image_surface_get_width(surface),
			.height = cairo_image_surface_get_height(surface),
			.depth = 32,
			.buffer = NULL,
			.backbuffer = cairo_image_surface_get_data(surface)
		};

		set_font_face(FONT_SANS_SERIF);
		set_font_size(13);

		int str_width = draw_string_width(title);
		draw_string(&fake_context, (width - str_width) / 2 + x, y + (height) / 2 + 4, rgb(49,49,49), title);
	}

	cairo_restore(cr);
	
}
Exemplo n.º 30
0
void _ttk_draw_menu(cairo_t * cr, int x, int y, int width) {
	cairo_save(cr);

	int height = TTK_MENU_HEIGHT;
	cairo_set_source_rgba(cr, 59.0/255.0, 59.0/255.0, 59.0/255.0, 1);
	cairo_rectangle(cr, x, y, width, height);
	cairo_fill(cr);

	{
		cairo_surface_t * surface = cairo_get_target(cr);
		gfx_context_t fake_context = {
			.width = cairo_image_surface_get_width(surface),
			.height = cairo_image_surface_get_height(surface),
			.depth = 32,
			.buffer = NULL,
			.backbuffer = cairo_image_surface_get_data(surface)
		};

		set_font_face(FONT_SANS_SERIF);
		set_font_size(13);

		draw_string(&fake_context, x + 8, y + height - 6, rgb(248,248,248), "File");
	}


	cairo_restore(cr);
}