예제 #1
0
파일: shards.cpp 프로젝트: exaexa/orthos
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;
}
예제 #2
0
파일: default.cpp 프로젝트: kidaa/aur
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;
}