示例#1
0
文件: main.c 项目: sdlu1992/clims
int main(int argc, char **argv)
{
	initScreen();       //初始化屏幕
	initColor();        //初始化颜色
	bkgd(COLOR_PAIR(1));//给背景设定颜色
	box(stdscr, 0, 0);  //画边框
	editWin = newwin(LINES-4, COLS-4, 3, 2);
	wbkgd(editWin, COLOR_PAIR(2));
	wattron(editWin, COLOR_PAIR(3));    //当前使用该色彩
	box(editWin, 0, 0);
	wattroff(editWin, COLOR_PAIR(3));   //不使用该色彩了
    wattron(editWin,COLOR_PAIR(7));
	initMenu(); //初始化菜单
	draw_main_menu(stdscr); //画菜单
	initList(); //初始化链表
	while(isOn){
		wnoutrefresh(stdscr);
		wnoutrefresh(editWin);
		doupdate();
		drawMenuList(0, 0);
		touchwin(editWin);
		wrefresh(editWin);
	}
	exitScreen();   //退出函数
	return 0;
}
示例#2
0
文件: draw_menu.c 项目: aempisse/42
void			draw_menu(t_env *env)
{
	if (env->menu->menu_lvl == 0)
		draw_main_menu(env);
	else if (env->menu->menu_lvl == 1)
		setup_scene_menu(env);
}
示例#3
0
Game::Game(Window& starting_window) : main_menu(starting_window) {
  // Ok this one is going to be a dozy.
  // This constructor is going to initalize ALL THE THINGS.
  // There's no way around that.
  // It could potentially take a noticable amount of time to initialize all the things.
  // However we are still going to have the initalization block the rest of the program.
  // Opening the ansync thread of worms is NOT worth it.
  // The only advantage would be that the user could screw around on the menu before the game is loaded.
  // There's nothing of substance you can do before the game is loaded anyway.
  // So accepting keyboard input before the game is loaded really is no big deal.
  // What we can do, is have multiple refreshes take place during this call.
  // Using this we can have a loading bar type thing down the line potentially.
  // Other operations (worldgen etc) could also potentially take a noticable amount of time to run.
  // Those operations will be refered here, which is where the approach behind non instant stuff is detailed.

  draw_main_menu(main_menu);

  // Calls to refresh are done explicitly outside of drawing functions.
  // Having refreshes inside of drawing functions would make drawing animations and similar possible.
  // However animations of that sort would block input, which would make the game feel a lot less responsive.
  // Calling refresh inside of a drawing function could lead to a situation like this:
  // Crawl's auto explore by default will animate every frame.
  // This sounds nice and you see an animation of your character exploring.
  // In practice though, it slows down gameplay a lot, and I disable it every time.
  // Code to disable it could be hard though if we have refresh calls all over the place.
  main_menu.refresh();
}
int menu_session()
{
    int key;
    int run_flag = -1;
    int rowField = 1;

    // Draw main part of interface
    draw_main_menu();

    // Save terminal settings, change mode, hide cursor
    rk_mytermsave();
    rk_mytermregime(0, 0, 1, 0, 1);
    mt_setcursor(0);

    // Setup color palete
    mt_setbgcolor(clBlack);
    mt_setfgcolor(clGreen);

    while (rk_readkey(&key) == 0 && key != K_ESC) {
        switch (key) 
        {     
            case K_UP:
                if (rowField != 0) {
                    rowField--;
                    draw_main_menu_field(rowField);
                }
                break;
                
            case K_DOWN:
                if (rowField != 2) {
                    rowField++;
                    draw_main_menu_field(rowField);
                }
                break;
      
            case K_ENTER:
                if (rowField == 0) {
                    run_flag = 0;
                } else if (rowField == 1) {
                    run_flag = 1;
                } else {
                    run_flag = 2;
                }
                break;
        }
        if (key == K_ENTER) {
            break;
        }
    }
    rk_mytermrestore();
    mt_setcursor(1);
    mt_setstdcolor();
    mt_gotoXY(39, 1);
    mt_clrscr();

    return run_flag;
}
示例#5
0
文件: loop.c 项目: laaph/FTRV
void main_loop()
{
    int input;
    while(1)
    {
        clearscreen();
        drawspaceship (4, 2);
        drawcharacters(4, 2);
        drawroomnumbers(4, 2);
        draw_main_menu(30, 2);
        drawstats();
        refresh();
        
        input = getch();
        switch(input)
        {
            case '1':
                //Launch
                launch();
                break;
            case '2':
                // Dock
                dock();
                break;
            case '3':
                // Trouble
                unimplemented(34, 4);
                break;
            case '4':
                // Details
                unimplemented(34, 4);
                break;
            case 'x':
            case 'X':
            case 27: // Escape character - what, no macro?
                pause_menu();
                break;
        }
    }
}
示例#6
0
int fmain_menu()
{
	char c;
	int i, x, y;
	int now_main = site, old_main = 0;

	clear();
	draw_banner(MAIN_MENU_TOP - 6);

	move(MAIN_MENU_TOP - 2, MAIN_MENU_LEFT);
	prints("¢~שששששששששששששששששששששששששששששששששששששששששששששששששששששששששששששששששש¢¡");
	for (i = 0;i < total_nall;i++)
	{
		x = i % MAX_MAIN_MENU ;
		y = i / MAX_MAIN_MENU ;
		if (y == 0)
		{
			move(MAIN_MENU_TOP + x, MAIN_MENU_LEFT);
			clrtohol();
		}
		move(MAIN_MENU_TOP + x, MAIN_MENU_LEFT + y*37);
		prints("%s%12s  %s", ORG_BAR, main_menu[i], ORG_BAR);
	}
	move(MAIN_MENU_TOP + MAX_MAIN_MENU + 1, MAIN_MENU_LEFT);
	prints("¢¢שששששששששששששששששששששששששששששששששששששששששששששששששששששששששששששששששש¢£");
	outz("\033[46;44m ¡i¾�§@»¡©ת¡j \033[47;31m  (¡פ¡ץ¡צ¡ק) \033[30m¿ן¾� \033[31m(Enter) \033[30m½T©w\033[31m (q)\033[30m ֲק¶}                          \033[m");
	draw_main_menu(site, site);

	do
	{
		old_main = now_main;
		c = vkey();
		switch (c)
		{
		case KEY_DOWN:
			now_main ++;
			if (now_main == total_nall)
				now_main = 0;
			draw_main_menu(now_main, old_main);
			break;
		case KEY_UP:
			now_main --;
			if (now_main < 0)
				now_main = total_nall - 1;
			draw_main_menu(now_main, old_main);
			break;
		case KEY_HOME:
		case '0':
			now_main = 0;
			draw_main_menu(now_main, old_main);
			break;
		case KEY_END:
		case '$':
			now_main = total_nall - 1;
			draw_main_menu(now_main, old_main);
			break;
		case Ctrl('U'):
						every_U();
			break;
		case KEY_RIGHT:
			now_main += MAX_MAIN_MENU ;
			if (now_main > total_nall - 1)
				now_main %= MAX_MAIN_MENU ;
			draw_main_menu(now_main, old_main);
			break ;
		case KEY_LEFT:
			if (now_main < MAX_MAIN_MENU)
	{
				if (now_main <= (total_nall - 1) % MAX_MAIN_MENU)
				{
					now_main += MAX_MAIN_MENU * ((total_nall - 1) / MAX_MAIN_MENU);
				}
				else
				{
					now_main = total_nall - 1;
				}
			}
			else
				now_main -= MAX_MAIN_MENU ;
			draw_main_menu(now_main, old_main);
			break;
		case '\n':
		case '\r':
			return now_main;
		}
	}
	while (c != 'q' && c != 'Q' && c != KEY_ESC);
	return -1;
}
示例#7
0
void MainMenu()
{
	//This function brings up the main menu and has it do stuff.

	RegisterRamReset(RESET_GFX);

	REG_DISPCNT= DCNT_MODE0 | DCNT_BG0;

	tte_init_chr4c(0, 			// BG 0
		BG_CBB(0)|BG_SBB(31),	// Charblock 0; screenblock 31
		0xF000,					// Screen-entry offset
		bytes2word(1,2,0,0),	// Color attributes.
		CLR_WHITE, 			// White text
		&verdana9Font,			// Verdana 9 font
		NULL
		);

	vid_vsync();
	draw_main_menu();



	while(1){


		vid_vsync();
		mmFrame();
		key_poll();


//This code is still being worked on but it will handle what is selected on the menu.
		    if (key_hit(KEY_DOWN)){
		    	mainmenuselected++;
	           if (mainmenuselected > 3){
	        	   mainmenuselected = 3;
			   }

			    draw_main_menu();

			}else if (key_hit(KEY_UP)){
				mainmenuselected = mainmenuselected - 1;

			   if (mainmenuselected < 0){
				   mainmenuselected = 0;
			   }
			    draw_main_menu();
			}else if (key_hit(KEY_B)){

			}else if (key_hit(KEY_A)){

	          if (mainmenuselected == 0){
			  


	        	  biosdump();
	        	  vid_vsync();
	              draw_main_menu();
	
	
		   }else if (mainmenuselected == 1){
			   
			   buttontest();
			   vid_vsync();
			   draw_main_menu();
		   }else if (mainmenuselected == 2){

			   RTC_Main();
			   vid_vsync();
			   draw_main_menu();
		   }else if (mainmenuselected == 3){

			   soundtest();
			   vid_vsync();

			   draw_main_menu();
		   }

		}

	}
}