예제 #1
0
파일: main-gcu.c 프로젝트: EpicMan/angband
/*
 * Init the "curses" system
 */
static void Term_init_gcu(term *t)
{
	term_data *td = (term_data *)(t->data);

	/*
	 * This is necessary to keep the first call to getch()
	 * from clearing the screen
	 */
	wrefresh(stdscr);

	/* Count init's, handle first */
	if (active++ != 0) return;

	/* Erase the window */
	(void)wclear(td->win);

	/* Reset the cursor */
	(void)wmove(td->win, 0, 0);

	/* Flush changes */
	(void)wrefresh(td->win);

	/* Game keymap */
	keymap_game();
}
예제 #2
0
파일: main-cap.c 프로젝트: MarvinPA/mpa-sil
/*
 * Prepare this file for Angband usage
 */
errr init_cap(int argc, char **argv)
{
	term *t = &term_screen_body;


	/*** Initialize ***/

	/* Initialize the screen */
	if (init_cap_aux()) return (-1);

	/* Hack -- Require large screen, or Quit with message */
	if ((rows < 24) || (cols < 80)) quit("Screen too small!");


	/*** Prepare to play ***/

	/* Extract the normal keymap */
	keymap_norm_prepare();

	/* Extract the game keymap */
	keymap_game_prepare();

	/* Hack -- activate the game keymap */
	keymap_game();

	/* Hack -- Do NOT buffer stdout */
	setbuf(stdout, NULL);


	/*** Now prepare the term ***/

	/* Initialize the term */
	term_init(t, 80, 24, 256);

	/* Avoid the bottom right corner */
	t->icky_corner = TRUE;

	/* Erase with "white space" */
	t->attr_blank = TERM_WHITE;
	t->char_blank = ' ';

	/* Set some hooks */
	t->init_hook = Term_init_cap;
	t->nuke_hook = Term_nuke_cap;

	/* Set some more hooks */
	t->text_hook = Term_text_cap;
	t->wipe_hook = Term_wipe_cap;
	t->curs_hook = Term_curs_cap;
	t->xtra_hook = Term_xtra_cap;

	/* Save the term */
	term_screen = t;

	/* Activate it */
	Term_activate(term_screen);

	/* Success */
	return (0);
}
예제 #3
0
/*
 * Suspend/Resume
 */
static errr Term_xtra_gcu_alive(int v)
{
	int x, y;


	/* Suspend */
	if (!v)
	{
		/* Go to normal keymap mode */
		keymap_norm();

		/* Restore modes */
		nocbreak();
		echo();
		nl();

		/* Hack -- make sure the cursor is visible */
		Term_xtra(TERM_XTRA_SHAPE, 1);

		/* Flush the curses buffer */
		(void)refresh();

		/* Get current cursor position */
		getyx(curscr, y, x);

		/* Move the cursor to bottom right corner */
		mvcur(y, x, LINES - 1, 0);

		/* Exit curses */
		endwin();

		/* Flush the output */
		(void)fflush(stdout);
	}

	/* Resume */
	else
	{
		/* Refresh */
		/* (void)touchwin(curscr); */
		/* (void)wrefresh(curscr); */

		/* Restore the settings */
		cbreak();
		noecho();
		nonl();

		/* Go to angband keymap mode */
		keymap_game();
	}

	/* Success */
	return (0);
}
예제 #4
0
/*
 * Suspend/Resume
 */
static errr Term_xtra_gcu_alive(int v)
{
   /* Suspend */
   if (!v)
   {
      /* Go to normal keymap mode */
      keymap_norm();

      /* Restore modes */
      nocbreak();
      echo();
      nl();

      /* Hack -- make sure the cursor is visible */
      Term_xtra(TERM_XTRA_SHAPE, 1);

      /* Flush the curses buffer */
      (void)refresh();

#ifdef SPECIAL_BSD
      /* this moves curses to bottom right corner */
      mvcur(curscr->cury, curscr->curx, LINES - 1, 0);
#else
      /* this moves curses to bottom right corner */
      mvcur(getcury(curscr), getcurx(curscr), LINES - 1, 0);
#endif

      /* Exit curses */
      endwin();

      /* Flush the output */
      (void)fflush(stdout);
   }

   /* Resume */
   else
   {
      /* Refresh */
      /* (void)touchwin(curscr); */
      /* (void)wrefresh(curscr); */

      /* Restore the settings */
      cbreak();
      noecho();
      nonl();

      /* Go to angband keymap mode */
      keymap_game();
   }

   /* Success */
   return (0);
}
예제 #5
0
/*
 * Init the "curses" system
 */
static void Term_init_gcu(term *t)
{
	term_data *td = (term_data *)(t->data);

	/* Count init's, handle first */
	if (active++ != 0) return;

	/* Erase the window */
	(void)wclear(td->win);

	/* Reset the cursor */
	(void)wmove(td->win, 0, 0);

	/* Flush changes */
	(void)wrefresh(td->win);

	/* Game keymap */
	keymap_game();
}
예제 #6
0
파일: main-cap.c 프로젝트: MarvinPA/mpa-sil
/*
 * Suspend/Resume
 */
static errr Term_xtra_cap_alive(int v)
{
	/* Suspend */
	if (!v)
	{
		if (!active) return (1);

		/* Hack -- make sure the cursor is visible */
		curs_set(1);

		/* Move to bottom right */
		do_move(0, rows - 1, 0, rows - 1);

		/* Go to normal keymap mode */
		keymap_norm();

		/* No longer active */
		active = FALSE;
	}

	/* Resume */
	else
	{
		if (active) return (1);

		/* Hack -- restore the cursor location */
		do_move(curx, cury, curx, cury);

		/* Hack -- restore the cursor visibility */
		curs_set(curv);

		/* Go to angband keymap mode */
		keymap_game();

		/* Now we are active */
		active = TRUE;
	}

	/* Success */
	return (0);
}