Beispiel #1
0
int orthos_skin_start()
{
	int res_x = 0, res_y = 0;
	x_get_resolution (&res_x, &res_y);
	exaSetParams (res_x, res_y, 32);
	if (!exaInit() ) return 1;

	exaKeyRepeat (0.4, 0.05);

	const char*font_fn = config ("font");

	font.loadfromfreetype (font_fn ? font_fn :
	                       "/usr/share/fonts/ttf-bitstream-vera/VeraMono.ttf", 128);

	box.setcaption (login_line);

	glClearColor (0, 0, 0, 0);
	glShadeModel (GL_SMOOTH);
	glDisable (GL_DEPTH_TEST);

	glMatrixMode (GL_PROJECTION);
	glLoadIdentity();
	glFrustum (-0.16, 0.16, -0.1, 0.1, 0.1, 100);
	glMatrixMode (GL_MODELVIEW);


	Mode = 0;
	box.setcaption (login_line);
	box.pwmask (false);
	box.setcolor (0.4, 0.4, 0.4);
	box.flash (0, 0, 0);
	exaGetElapsedTime();
	return 0;
}
Beispiel #2
0
int orthos_skin_update()
{
	exaUpdate();
	float time = 0;

	while (time < 0.035) {
		time += exaGetElapsedTime();
		exaUSleep (2000);
	}

	rot += time;
	box.update (time);
	sess.update (time);
	shut.update (time);

	if (exaIsKeyHit (EKEY_RETURN) )
		switch (Mode) {
		case 0:
			login = box.text;
			Mode = 1;
			box.clear();
			box.setcaption ("password");
			box.setcolor (0.2, 0.2, 0.2);
			box.pwmask (true);
			break;
		case 1:
			pw = box.text;
			box.clear();
			if (selected_session) {
				if (validate_login (login.c_str(), pw.c_str() ) ) {
					Mode = 0;
					box.setcaption (login_line);
					box.setcolor (0.4, 0.4, 0.4);
					box.flash (1, 0, 0);
					box.pwmask (false);
				} else Mode = 3;
			} else {
				Mode = 2;
				box.setcaption ("session");
				box.setcolor (0.1, 0.1, 0.4);
				box.pwmask (false);
			}
			break;
		case 2:
			session = box.text;
			box.clear();
			if (validate_login (login.c_str(), pw.c_str() ) ) {
				Mode = 0;
				box.setcaption (login_line);
				box.setcolor (0.4, 0.4, 0.4);
				box.flash (1, 0, 0);
				box.pwmask (false);
			} else Mode = 3;
			break;
		case 3:
		case 4:
			break;
		default:
			Mode = 0;
			box.clear();
			box.setcaption (login_line);
			box.pwmask (false);
			box.setcolor (0.4, 0.4, 0.4);
			box.flash (0, 0, 0);
			break;
		}

	glClear (GL_COLOR_BUFFER_BIT);
	glLoadIdentity();

	glTranslatef (0, 0, -1);
	glRotatef (rot, 1, 0, 0.3);
	glEnable (GL_BLEND);
	glBlendFunc (GL_SRC_ALPHA, GL_ONE);
	do_sphere();
	glDisable (GL_BLEND);

	if (invert) {
		glPushMatrix();
		glLoadIdentity();
		glMatrixMode (GL_PROJECTION);
		glPushMatrix();
		glLoadIdentity();
		glOrtho (0, 1, 0, 1, 1, -1);
		glColor4f (1, 1, 1, 1);
		glEnable (GL_BLEND);
		glBlendFunc (GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
		glBegin (GL_QUADS);
		glVertex2f (0, 0);
		glVertex2f (0, 1);
		glVertex2f (1, 1);
		glVertex2f (1, 0);
		glEnd();
		glPopMatrix();
		glMatrixMode (GL_MODELVIEW);
		glPopMatrix();
	}


	glLoadIdentity();
	glTranslatef (0, -13, -25);
	box.draw();
	glTranslatef (0, 2, 0);
	sess.draw();
	glTranslatef (0, -6, 0);
	shut.draw();

	exaglSwapBuffers();
	switch (Mode) {
	case 3:
		do_login (login.c_str(), selected_session ? sessions[selected_session].cmd.c_str() : session.c_str() );
		return 0;
	case 4:
		return 0;
	}
	return 1;
}
Beispiel #3
0
int orthos_skin_update()
{
    exaUpdate();
    float time=0;

    while(time<0.02) {
        time+=exaGetElapsedTime();
        exaUSleep(2000);
    }

    rot+=time;
    box.update(time);
    sess.update(time);
    shut.update(time);

    if(exaIsKeyHit(EKEY_RETURN))
        switch(Mode) {
        case 0:
            login=box.text;
            Mode=1;
            box.clear();
            box.setcaption("password");
            box.setcolor(0.2,0.2,0.2);
            box.pwmask(true);
            break;
        case 1:
            pw=box.text;
            box.clear();
            if(selected_session) {
                if(validate_login(login.c_str(),pw.c_str())) {
                    Mode=0;
                    box.setcaption(login_line);
                    box.setcolor(0.4,0.4,0.4);
                    box.flash(1,0,0);
                    box.pwmask(false);
                } else Mode=3;
            } else {
                Mode=2;
                box.setcaption("session");
                box.setcolor(0.1,0.1,0.4);
                box.pwmask(false);
            }
            break;
        case 2:
            session=box.text;
            box.clear();
            if(validate_login(login.c_str(),pw.c_str())) {
                Mode=0;
                box.setcaption(login_line);
                box.setcolor(0.4,0.4,0.4);
                box.flash(1,0,0);
                box.pwmask(false);
            } else Mode=3;
            break;
        case 3:
        case 4:
            break;
        default:
            Mode=0;
            box.clear();
            box.setcaption(login_line);
            box.pwmask(false);
            box.setcolor(0.4,0.4,0.4);
            box.flash(0,0,0);
            break;
        }

    glClear(GL_COLOR_BUFFER_BIT);
    glLoadIdentity();

    glTranslatef(0,0,-5);
    glRotatef(rot,0,0,1);
    for(int i=0; i<10; ++i) {
        glBegin(GL_TRIANGLE_STRIP);
        glColor3f(0,0,0);
        glVertex3f(1,5,5);
        glVertex3f(-1,5,5);
        glColor3f(0,0.1,0.3);
        glVertex3f(1,5,-1);
        glVertex3f(-1,5,-1);
        glColor3f(0,0,0);
        glVertex3f(1,5,-20);
        glVertex3f(-1,5,-20);
        glEnd();
        glRotatef(36,0,0,1);
    }

    glLoadIdentity();
    glTranslatef(0,0,-25);
    box.draw();
    glTranslatef(0,2,0);
    sess.draw();
    glTranslatef(0,-6,0);
    shut.draw();

    exaglSwapBuffers();
    switch (Mode) {
    case 3:
        do_login(login.c_str(),selected_session?sessions[selected_session].cmd.c_str():session.c_str());
        return 0;
    case 4:
        return 0;
    }
    return 1;
}