예제 #1
0
// Handles mouse click events
void mouseClick(int button, int state, int x, int y)
{
	if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN) {
		// Right click
		changeBlock();
	}
}
void TestAppBlockBuilder::eventHandling ( const SDL_Event& event  ){
    //printf( "NonInert_seats::eventHandling() \n" );
    int rot;
    switch( event.type ){
        case SDL_KEYDOWN :
            switch( event.key.keysym.sym ){
                case SDLK_a:  ix ++; if( ix >= nMaxShapes ) ix = 255; break;
                case SDLK_d:  ix --; if( ix <  0          ) ix = 0;   break;
                case SDLK_w:  iy ++; if( iy >= nMaxShapes ) iy = 255; break;
                case SDLK_s:  iy --; if( iy <  0          ) iy = 0;   break;
                case SDLK_q:  iz ++; if( iz >= nMaxShapes ) iz = 255; break;
                case SDLK_e:  iz --; if( iz <  0          ) iz = 0;   break;
                case SDLK_x:  orientation ^= 0b10000000; break;
                case SDLK_y:  orientation ^= 0b01000000; break;
                case SDLK_z:  orientation ^= 0b00100000; break;
                case SDLK_r:  rot = orientation & 0b00011111; rot++; if(rot>= 6 ) rot=0; orientation = rot | ( orientation & 0b11100000 );  break;
                case SDLK_f:  rot = orientation & 0b00011111; rot--; if(rot<  0 ) rot=5; orientation = rot | ( orientation & 0b11100000 );  break;
                case SDLK_LEFTBRACKET:  iShape ++; if( iShape>=nShapes ) iShape = 0;            break;
                case SDLK_RIGHTBRACKET: iShape --; if( iShape< 0       ) iShape = nShapes-1;    break;
                case SDLK_RETURN:         changeBlock( ix, iy, iz, orientation, shapes[iShape] ); break;
                case SDLK_BACKSPACE: changeBlock( ix, iy, iz, 0, 0 ); break;
                case SDLK_u:  qCamera.setOne();  break;
                //case SDLK_r:  world.fireProjectile( warrior1 ); break;
            }
            break;

        /*
        case SDL_MOUSEBUTTONDOWN:
            switch( event.button.button ){
                case SDL_BUTTON_LEFT:
                    //printf( "left button pressed !!!! " );
                    pickParticle( world.picked );
                break;
            }
            break;
        case SDL_MOUSEBUTTONUP:
            switch( event.button.button ){
                case SDL_BUTTON_LEFT:
                    //printf( "left button pressed !!!! " );
                    world.picked = NULL;
                    break;
            }
            break;
        */
    };
    AppSDL2OGL_3D::eventHandling( event );
}
예제 #3
0
void MiniWorld::deleteBlock(glm::i32vec3 p)
{
	changeBlock(p,blockTypes::air);
}