Example #1
0
File: main.c Project: gsrr/Python
static void startup(int i)
{
#if XLIB
	in_xterm_init();
#endif
	textgfx_init();
	atexit(textgfx_end);
	init_inputdevs();
#if TERM_RESIZING
	enable_term_resizing();
#endif
	if (!bgdot)
		bgdot = default_bgdot();
	if (in_menu)
		textgfx_entermenu();
#if !TWOPLAYER
	setupgame(1);
#else
	if (i)
		goto setup;
	i = getopt_int("", "mode");
	if (i & MODE_NETWORK)
		i = 3;
	else
		i = 2-!(i & MODE_2PLAYER);
# if NO_MENU
setup:	setupgame(i);
# else
	if (!in_menu)
		goto setup;
	mk_invitfile();
	while (1) {
		i = startupmenu(i);
		if (!i)
			break;
#  ifdef INET
		if (i==3 && !netplaymenu())
			continue;
#  endif
		if (i <= 3) {
setup:			setupgame(i);
#  ifdef INET
			if (i==3 && playerlist_n > 0 && netplaymenu())
				goto setup;
#  endif
		}
		if (i==OPTIONS)
			optionsmenu();
		if (i==HIGHSCORES)
			hiscorelist();
	}
# endif /* !NO_MENU */
#endif	/* TWOPLAYER */
	textgfx_end();
}
Example #2
0
int gamemenu()
{
	int i = 0;
#ifdef TWOPLAYER
	int y = 7;
	while (1) {
		if (!TWOPLAYER_MODE) {
			if (term_height >= 23)
				show_hiscorelist5(5, GAMEMENU_LENGTH+9, 0);
		} else if (term_height < 23) {
			setcurs(1, 4);
			cleartoeol();
			y = 5;
		}
		i = game_menu(0, 1, y);
		if (i != 4)
			break;
		wclrtobot(window);
		inputsetup_box(0, 1, 7);
	}
	if (!i) {
		setcurs(1, 4);
		wclrtobot(window);
		print_vitetris_ver(19, 4);
	}
#else
	while (1) {
		printmenuhelp(19);
		i = game_menu(i, 1, 7);
		if (!i)
			break;
		clearbox(0, 7, 0, GAMEMENU_LENGTH);
		if (i != 4 && i < GAMEMENU_LENGTH-1)
			break;
		wclrtobot(window);
		switch (i) {
		case 4:
			inputsetup_box(0, 1, 7);
			i = 0;
			continue;
		case GAMEMENU_LENGTH-1:
			optionsmenu();
			break;
		default:
			hiscorelist();
		}
		i--;
	}
#endif
	return i;
}
Example #3
0
// Left button released
long ShutterBug::onBtnRelease(FXObject*,FXSelector,void* ptr){
  FXEvent *event=(FXEvent*)ptr;
  ungrab();
  flags&=~FLAG_PRESSED;
  if(event->moved) return 1;
  FXMenuPane filemenu(this);
  new FXMenuCaption(&filemenu,"ShutterBug",smallicon);
  new FXMenuSeparator(&filemenu);
  new FXMenuCommand(&filemenu,tr("Snap..."),NULL,this,ID_SNAPSHOT);
  new FXMenuCommand(&filemenu,tr("Snap delayed..."),NULL,this,ID_SNAPSHOT_DELAYED);
  new FXMenuCommand(&filemenu,tr("Snap to clipboard..."),NULL,this,ID_SNAPSHOT_CLIPBOARD);
  new FXMenuCommand(&filemenu,tr("Record movie..."),NULL,this,ID_RECORD_MOVIE);
  new FXMenuCheck(&filemenu,tr("Show lasso"),this,ID_TOGGLE_LASSO);
  new FXMenuCheck(&filemenu,tr("Lines inside"),this,ID_INSIDE);
  new FXMenuCommand(&filemenu,tr("Color..."),NULL,this,ID_COLOR);
  FXMenuPane sizemenu(this);
  new FXMenuCascade(&filemenu,tr("Size"),NULL,&sizemenu);
  new FXMenuRadio(&sizemenu,"8x8",this,ID_SIZE_8X8);
  new FXMenuRadio(&sizemenu,"16x16",this,ID_SIZE_16X16);
  new FXMenuRadio(&sizemenu,"24x24",this,ID_SIZE_24X24);
  new FXMenuRadio(&sizemenu,"32x32",this,ID_SIZE_32X32);
  new FXMenuRadio(&sizemenu,"48x48",this,ID_SIZE_48X48);
  new FXMenuRadio(&sizemenu,"64x64",this,ID_SIZE_64X64);
  new FXMenuRadio(&sizemenu,"128x128",this,ID_SIZE_128X128);
  new FXMenuRadio(&sizemenu,"256x256",this,ID_SIZE_256X256);
  new FXMenuRadio(&sizemenu,"512x512",this,ID_SIZE_512X512);
  new FXMenuRadio(&sizemenu,tr("Screen"),this,ID_SIZE_SCREEN);
  new FXMenuRadio(&sizemenu,tr("Custom"),this,ID_SIZE_CUSTOM);
  FXMenuPane weightmenu(this);
  new FXMenuCascade(&filemenu,tr("Weight"),NULL,&weightmenu);
  new FXMenuCommand(&weightmenu,FXString::null,weighticons[0],this,ID_WEIGHT_1);
  new FXMenuCommand(&weightmenu,FXString::null,weighticons[1],this,ID_WEIGHT_2);
  new FXMenuCommand(&weightmenu,FXString::null,weighticons[2],this,ID_WEIGHT_3);
  new FXMenuCommand(&weightmenu,FXString::null,weighticons[3],this,ID_WEIGHT_4);
  new FXMenuCommand(&weightmenu,FXString::null,weighticons[4],this,ID_WEIGHT_5);
  new FXMenuCommand(&weightmenu,FXString::null,weighticons[5],this,ID_WEIGHT_6);
  FXMenuPane optionsmenu(this);
  new FXMenuCascade(&filemenu,tr("Options"),NULL,&optionsmenu);
  new FXMenuCommand(&optionsmenu,tr("Delay..."),NULL,this,ID_DELAY);
  new FXMenuCommand(&optionsmenu,tr("Set number..."),NULL,this,ID_SET_COUNT);
  new FXMenuCommand(&optionsmenu,tr("Reset number..."),NULL,this,ID_RESET_COUNT);
  new FXMenuCommand(&optionsmenu,tr("Record Rate..."),NULL,this,ID_RECORD_RATE);
  new FXMenuCheck(&optionsmenu,tr("Fast quantization"),this,ID_QUANTIZE);
  new FXMenuCommand(&filemenu,tr("About..."),NULL,this,ID_ABOUT);
  new FXMenuCommand(&filemenu,tr("Quit"),NULL,this,ID_QUIT);
  filemenu.create();
  filemenu.popup(NULL,event->root_x,event->root_y);
  getApp()->runModalWhileShown(&filemenu);
  return 1;
  }
Example #4
0
int gamemenu()
{
	int i = 1;
#ifdef TWOPLAYER
	int h;
	if (!TWOPLAYER_MODE || game->mode & MODE_NETWORK)
		h = GAMEMENU_LENGTH+4;
	else {
		h = 17;
		while (menuheight < h)
			newln(2);
	}
	while (1) {
		i = game_menu(0, 1, 4);
		if (i==4)
			inputsetup_box(0, 1, 4);
		else
			break;
	}
	if (!i)
		clearbox(0, 4, 0, h-4);
#else
	while (1) {
		i = game_menu(i-1, 1, 4);
		if (i==4) {
			setcurs(0, 13);
			printf("\033[K");
			inputsetup_box(0, 1, 4);
			i = 1;
		} else if (i < GAMEMENU_LENGTH-1)
			break;
		else {
			clearbox(0, 4, 0, GAMEMENU_LENGTH);
			if (i == GAMEMENU_LENGTH-1)
				optionsmenu();
			else
				hiscorelist();
		}
	}
#endif
	return i;
}
Example #5
0
int gamemenu()
{
	int i = 0;
#ifdef TWOPLAYER
	while (1) {
		if (!TWOPLAYER_MODE)
			show_hiscorelist5(5, GAMEMENU_LENGTH+9, 0);
		i = game_menu(0, 1, 7);
		if (i != 4)
			break;
		clearbox(5, GAMEMENU_LENGTH+9, 0, 5);
		inputsetup_box(0, 1, 7);
	}
	if (!i)
		clearbox(0, 7, 0, 14);
#else
	while (1) {
		printmenuhelp(19);
		i = game_menu(i, 1, 7);
		if (!i)
			break;
		clearbox(0, 7, 0, GAMEMENU_LENGTH);
		if (i != 4 && i < GAMEMENU_LENGTH-1)
			break;
		clearbox(0, 19, 0, 3);
		switch (i) {
		case 4:
			inputsetup_box(0, 1, 7);
			i = 0;
			continue;
		case GAMEMENU_LENGTH-1:
			optionsmenu();
			break;
		default:
			hiscorelist();
		}
		i--;
	}
#endif
	return i;
}