Пример #1
0
// Creates a new tunnel "app" window
void new_tunnel_window(void)
{
	
    tunnel_gc = pz_get_gc(1);       /* Get the graphics context */
	
    /* Open the window: */
    tunnel_wid = pz_new_window (0,
								   21,
								   screen_info.cols,
								   screen_info.rows - (HEADER_TOPLINE+1),
								   draw_header,
								   handle_event);
	
	GrGetWindowInfo(tunnel_wid, &wi); /* Get screen info */	
	
    /* Select the types of events you need for your window: */
    GrSelectEvents (tunnel_wid, GR_EVENT_MASK_TIMER|GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_KEY_DOWN|GR_EVENT_MASK_KEY_UP);
	
	// set up pixmap 
	temp_pixmap = GrNewPixmap(screen_info.cols,
							  (screen_info.rows - (HEADER_TOPLINE + 1)),
							  NULL);
	
    /* Display the window: */
    GrMapWindow (tunnel_wid);
	draw_header();
	readHighScore();
	reset();
}
Пример #2
0
static int draw_duckhunt_highscore (TWidget *wid, ttk_surface srf)
{
    int length;
    char str[30];

    sprintf (str, "High Score = %d", readHighScore("/mnt/aj/duckhunt/hs"));
    length = ttk_text_width (ttk_menufont, str);
    ttk_fillrect (srf, 0, 0, ttk_screen->w, ttk_screen->h, ttk_makecol(WHITE));
    ttk_text (srf, ttk_menufont, (ttk_screen->w/2)-(length/2), (ttk_screen->h-HEADER)/2, ttk_makecol(BLACK), str);
    return 0;
}