src/ui-term.c
errr term_init(term *t, int w, int h, int k)
{
	int y;

	/* Wipe it */
	memset(t, 0, sizeof(term));

	/* Prepare the input queue */
	t->key_head = t->key_tail = 0;

	/* Determine the input queue size */
	t->key_size = k;

	/* Allocate the input queue */
	t->key_queue = mem_zalloc(t->key_size * sizeof(ui_event));

	/* Save the size */
	t->wid = w;
	t->hgt = h;

	/* Allocate change arrays */
	t->x1 = mem_zalloc(h * sizeof(int));
	t->x2 = mem_zalloc(h * sizeof(int));


	/* Allocate "displayed" */
	t->old = mem_zalloc(sizeof(term_win));

	/* Initialize "displayed" */
	term_win_init(t->old, w, h);


	/* Allocate "requested" */
	t->scr = mem_zalloc(sizeof(term_win));

	/* Initialize "requested" */
	term_win_init(t->scr, w, h);

	/* Assume change */
	for (y = 0; y < h; y++) {
		/* Assume change */
		t->x1[y] = 0;
		t->x2[y] = w - 1;
	}

	/* Assume change */
	t->y1 = 0;
	t->y2 = h - 1;

	/* Force "total erase" */
	t->total_erase = TRUE;

	/* Default "blank" */
	t->attr_blank = 0;
	t->char_blank = L' ';

	/* No saves yet */
	t->saved = 0;

	/* Success */
	return (0);
}
/**
 * Initialize a term, using a window of the given size.
 * Also prepare the "input queue" for "k" keypresses
 * By default, the cursor starts out "invisible"
 * By default, we "erase" using "black spaces"
 */
Initialize a term, using a window of the given size.
Initialize a term using a window of the given size .
errr term_init(term *t, int w, int h, int k)
{
	int y;
	memset(t, 0, sizeof(term));
	t->key_head = t->key_tail = 0;
	t->key_size = k;
	t->key_queue = mem_zalloc(t->key_size * sizeof(ui_event));
	t->wid = w;
	t->hgt = h;
	t->x1 = mem_zalloc(h * sizeof(int));
	t->x2 = mem_zalloc(h * sizeof(int));
	t->old = mem_zalloc(sizeof(term_win));
	term_win_init(t->old, w, h);
	t->scr = mem_zalloc(sizeof(term_win));
	term_win_init(t->scr, w, h);
	for (y = 0; y < h; y++) {
		t->x1[y] = 0;
		t->x2[y] = w - 1;
	}
	t->y1 = 0;
	t->y2 = h - 1;
	t->total_erase = TRUE;
	t->attr_blank = 0;
	t->char_blank = L' ';
	t->saved = 0;
	return (0);
}
errr term_init ( term * t , int w , int h , int k ) { int y ; memset ( t , 0 , sizeof ( term ) ) ; t -> key_head = t -> key_tail = 0 ; t -> key_size = k ; t -> key_queue = mem_zalloc ( t -> key_size * sizeof ( ui_event ) ) ; t -> wid = w ; t -> hgt = h ; t -> x1 = mem_zalloc ( h * sizeof ( int ) ) ; t -> x2 = mem_zalloc ( h * sizeof ( int ) ) ; t -> old = mem_zalloc ( sizeof ( term_win ) ) ; term_win_init ( t -> old , w , h ) ; t -> scr = mem_zalloc ( sizeof ( term_win ) ) ; term_win_init ( t -> scr , w , h ) ; for ( y = 0 ; y < h ; y ++ ) { t -> x1 [ y ] = 0 ; t -> x2 [ y ] = w - 1 ; } t -> y1 = 0 ; t -> y2 = h - 1 ; t -> total_erase = TRUE ; t -> attr_blank = 0 ; t -> char_blank = L' ' ; t -> saved = 0 ; return ( 0 ) ; }
Initialize a term, using a window of the given size.
Initialize a term using a window of the given size .
/* Wipe it */ /* Prepare the input queue */ /* Determine the input queue size */ /* Allocate the input queue */ /* Save the size */ /* Allocate change arrays */ /* Allocate "displayed" */ /* Initialize "displayed" */ /* Allocate "requested" */ /* Initialize "requested" */ /* Assume change */ /* Assume change */ /* Assume change */ /* Force "total erase" */ /* Default "blank" */ /* No saves yet */ /* Success */