Exemple #1
0
void		display_l(t_elem *list, t_opt *opt, t_pad *pad)
{
	if (!list)
		return ;
	while (list)
	{
		if (opt->a == 1)
		{
			ft_padding(&list, pad);
			print_infos(list, opt);
			ft_putchar('\n');
		}
		else
		{
			if (list->name[0] != '.')
			{
				ft_padding(&list, pad);
				print_infos(list, opt);
				ft_putchar('\n');
			}
		}
		list = list->next;
	}
}
Exemple #2
0
void draw()
{
	cxt->clearScreen();
	// sh.enable(true);
	cam.control(elapsedTime);

	cam.reset();
    //glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient );
    //glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
	//glMaterialf(GL_FRONT, GL_SHININESS, shininess);
	cam.look();

	glEnable(GL_TEXTURE_2D);

	glColor3f(1.0f, 1.0f, 1.0f);

	glPushMatrix();
	glTranslatef(lightPos[0],lightPos[1],lightPos[2]);
	drawCube(0.5f);
	glPopMatrix();

	game.drawMap();
	glCullFace(GL_BACK);
	glEnable(GL_CULL_FACE);
	glEnable(GL_LIGHTING);
	game.drawEntities();
	glDisable(GL_LIGHTING);
	glDisable(GL_CULL_FACE);

	// sh.enable(false);

	game.drawQuads();

	glDisable(GL_TEXTURE_2D);
	cam.begin2d();

	glColor3f(1.f, 1.f, 1.f);

	if(sinput->keys[SDLK_F1])
		print_infos();
	
	if(game.areaSel)
	{
		glColor3f(1.f, 1.f, 1.f);
		glBegin(GL_LINE_STRIP);
		glVertex3i(game.startMouseSelX, game.startMouseSelY, -1.f);
		glVertex3i(game.endMouseSelX, game.startMouseSelY, -1.f);
		glVertex3i(game.endMouseSelX, game.endMouseSelY, -1.f);
		glVertex3i(game.startMouseSelX, game.endMouseSelY, -1.f);
		glVertex3i(game.startMouseSelX, game.startMouseSelY, -1.f);
		glEnd();
	}

	game.drawMinimap();
	game.draw2D();
	cam.end2d();

	if(!showPicking) cxt->flip();

	// print framerate
	if((cxt->secs() - before) >= 5.f)
	{
		printf("After 5s : %g FPS\n", frames/(cxt->secs()-before));
		frames = 0;
		before = cxt->secs();
	}
	else
		frames++;
}
Exemple #3
0
/*
 * interactively select a kernel image and options.
 * The kernel can be an actual filename or a label in the config file
 * Return:
 * 	-1: if unsucessful
 * 	 0: otherwise
 */
static INTN
select_kernel(CHAR16 *buffer, INTN size)
{
#define CHAR_CTRL_C	L'\003' /* Unicode CTRL-C */
#define CHAR_CTRL_D	L'\004' /* Unicode CTRL-D */
#define CHAR_CTRL_U	L'\025' /* Unicode CTRL-U */
//#define CHAR_TAB	L'\t'
	SIMPLE_INPUT_INTERFACE *ip = systab->ConIn;
	EFI_INPUT_KEY key;
	EFI_STATUS status;
	INTN pos = 0, ret;
	INT8 first_time = 1;

	/* 
	 * let's give some help first
	 */
	print_help(0);

	print_infos(0);

reprint:
	buffer[pos] = CHAR_NULL;

	Print(L"\nELILO boot: %s", buffer);
	/*
	 * autoboot with default choice after timeout expires
	 */
	if (first_time && (ret=wait_timeout(elilo_opt.timeout)) != 1) {
		return ret == -1 ? -1: 0;
	}
	first_time = 0;

	for (;;) {
		while ((status = uefi_call_wrapper(ip->ReadKeyStroke, 2, ip, &key))
				 == EFI_NOT_READY);
		if (EFI_ERROR(status)) {
			ERR_PRT((L"select_kernel readkey: %r", status));
			return -1;
		} 
		switch (key.UnicodeChar) {
			case CHAR_TAB:
				Print(L"\n");
				if (pos == 0) {
					print_label_list();
					Print(L"(or a kernel file name: [[dev_name:/]path/]kernel_image cmdline options)\n");
				} else {
					buffer[pos] = CHAR_NULL;
					display_label_info(buffer);
				}
				goto reprint;
			case L'%':
				if (pos>0) goto normal_char;
				Print(L"\n");
				print_vars();
				goto reprint;
			case L'?':
				if (pos>0) goto normal_char;
				Print(L"\n");
				print_help(1);
				goto reprint;
			case L'&':
				if (pos>0) goto normal_char;
				Print(L"\n");
				print_infos(1);
				goto reprint;
			case L'=':
				if (pos>0) goto normal_char;
				Print(L"\n");
				print_devices();
				goto reprint;
			case CHAR_BACKSPACE:
				if (pos == 0) break;
				pos--;
				Print(L"\b \b");
				break;
			case CHAR_CTRL_U: /* clear line */
				while (pos) {
					Print(L"\b \b");
					pos--;
				}
				break;
			case CHAR_CTRL_C: /* kill line */
				pos = 0;
				goto reprint;
			case CHAR_LINEFEED:
			case CHAR_CARRIAGE_RETURN:
				buffer[pos]   = CHAR_NULL;
				Print(L"\n");
				return 0;
			default:
normal_char:
				if (key.UnicodeChar == CHAR_CTRL_D || key.ScanCode == 0x17 ) {
					Print(L"\nGiving up then...\n");
					return  -1;
				}
				if (key.UnicodeChar == CHAR_NULL) break;

				if (pos > size-1) break;

				buffer[pos++] = key.UnicodeChar;

				/* Write the character out */
				Print(L"%c", key.UnicodeChar);
		}
	}
	return 0;
}