コード例 #1
0
ファイル: allegro.c プロジェクト: gsrr/Python
void toggle_fullscreen()
{
	BITMAP *bmp = set_screen(is_windowed_mode());
	if (bmp->w == virt_screen->w)
		destroy_bitmap(bmp);
	else {
		if (bmp->w > virt_screen->w) {
			int h = 400;
			if (in_menu) {
				blit(virt_screen, screen, 0, 384, 0, 464,
							  512, 16);
				h = 384;
			}
			blit(virt_screen, bmp, 0, 0, 64, 0, 512, h);
			curs_x += 8;
		} else {
			blit(virt_screen, bmp, 64, 0, 0, 0, 512, 400);
			curs_x -= 8;
		}
		margin_x = getmargin_x();
		destroy_bitmap(virt_screen);
		virt_screen = bmp;
	}
	refresh_needed = 1;
	refreshscreen();
}
コード例 #2
0
ファイル: allegro.c プロジェクト: gsrr/Python
static void got_focus_back()
{
	textgfx_flags &= ~LOST_FOCUS;
	kb_flushinp();
	refresh_needed = 1;
	refreshscreen();
}
コード例 #3
0
ファイル: allegro.c プロジェクト: gsrr/Python
void textgfx_init()
{
#ifdef UNIX
	strcpy(_xwin.application_name, "vitetris");
	strcpy(_xwin.application_class, "Vitetris");
#endif
	if (install_allegro(SYSTEM_AUTODETECT, &errno, NULL) != 0)
		exit(1);
#ifdef UNIX
	sigaction(SIGINT, NULL, &allegro_sigint_handler);
	signal(SIGINT, sigint_handler);
#endif
	load_pc8x16_font();
	set_window_title(VITETRIS_VER);
	set_close_button_callback(close_btn);
#ifndef UNIX
	/* Seems to cause seg fault later quite randomly on Linux  */
	int depth = desktop_color_depth();
	if (depth != 0)
		set_color_depth(depth);
#endif
	virt_screen = set_screen(getopt_int("", "fullscreen"));
	lang |= LATIN1;
	if (!font8x16) {
		font8x16 = font;
		textgfx_flags |= ASCII;
	}
	setattr_normal();
#if WIN32 && !ALLEGRO_USE_CONSOLE
	if (exists("stdout.tmp")) {
		FILE *fp;
		freopen("stdout2.tmp", "w", stdout);
		fp = fopen("stdout.tmp", "r");
		if (fp) {
			char line[80];
			int i;
			for (i=0; i < 25 && fgets(line, 80, fp); i++) {
				setcurs(0, i);
				i += printline(line);	
			}
			fclose(fp);
			if (i) {
				refreshscreen();
				if (!strncmp(line, "Press ", 6)) {
					install_keyboard();
					clear_keybuf();
					readkey();
					remove_keyboard();
				}
			}
		}
		freopen("stdout.tmp", "w", stdout);
		delete_file("stdout2.tmp");
	}
#endif
}
コード例 #4
0
ファイル: tcinput.c プロジェクト: lornix/tcalc
/* Uses the BIOS to read the next keyboard character */
int getkey(void)
{
    int key, lo, hi;

    key = bioskey(0);
    if (key==12)
        refreshscreen();
    lo = key & 0X00FF;
    hi = (key & 0XFF00) >> 8;
    return((lo == 0) ? hi + 256 : lo);
} /* getkey */
コード例 #5
0
ファイル: ansi_win.c プロジェクト: williamiced/SocketTetris
void refreshwin(int win)
{
	static int redraw;
	struct player *p;
	if (redraw)
		return;
#ifdef TWOPLAYER
	if ((win == 1 || win == 2) && !game_running) {
		p = &game->player[win-1];
#else
	if (win == 1 && !game_running) {
		p = &player1;
#endif
		redraw = 1;
		if (game_paused)
			redrawboard(p, 19);
		else
			redrawboard(p, 3);
		redraw = 0;
	}
	refreshscreen();
}

/* only used for clearing window showing next tetromino and game screen */
void clearwin(int win)
{
	int h;
	setwcurs(win, 0, 0);
	if (win >= WIN_NEXT)
		clearbox(0, 0, 8, 2);
	else {
		margin_x = 0;
		h = term_height;
		if (h < 24 && h > 21)
			h = 21;
		clearbox(0, 0, 0, h);
	}
}