Beispiel #1
0
void ColoredCubeApp::initApp()
{
	D3DApp::initApp();
	
	line1.init(md3dDevice, 10.0f, GREEN);
	line2.init(md3dDevice, 10.0f, BLUE);
	line3.init(md3dDevice, 10.0f, RED);

	xLine.init(&line1, Vector3(0,0,0), 5);
	xLine.setPosition(Vector3(0,0,0));
	yLine.init(&line2, Vector3(0,0,0), 5);
	yLine.setPosition(Vector3(0,0,0));
	yLine.setRotationZ(ToRadian(90));
	zLine.init(&line3, Vector3(0,0,0), 5);
	zLine.setPosition(Vector3(0,0,0));
	zLine.setRotationY(ToRadian(90));

	quad1.init(md3dDevice, 50, CYAN);
	quad1.setPosition(Vector3(0,-5,0));

	quad2.init(md3dDevice, 50, RED);
	quad2.setPosition(Vector3(0,5,0));

	quad3.init(md3dDevice, 50, BEACH_SAND);
	quad3.setPosition(Vector3(5,5,0));
	quad3.setRotXAngle(ToRadian(90));
	quad3.setRotYAngle(ToRadian(90));

	quad4.init(md3dDevice, 50, BEACH_SAND);
	quad4.setPosition(Vector3(-5,5,0));
	quad4.setRotXAngle(ToRadian(90));
	quad4.setRotYAngle(ToRadian(90));

	quad4.init(md3dDevice, 50, BEACH_SAND);
	quad4.setPosition(Vector3(-5,5,0));
	quad4.setRotXAngle(ToRadian(90));

	quad5.init(md3dDevice, 50, DARKBROWN);
	quad5.setPosition(Vector3(0,0,-7));
	quad5.setRotXAngle(ToRadian(90));

	for(int i = 0; i < WALL_SIZE; ++i) {
		wall[i].init(md3dDevice, 1, GREEN);
		wall[i].setPosition(Vector3((rand() % MAX_RADIUS) - (MAX_RADIUS / 2), (rand() % MAX_RADIUS) - (MAX_RADIUS / 2), -6));
		wall[i].setRotXAngle(ToRadian(90));
		wall[i].setRotZAngle(ToRadian(45));
	}

	buildFX();
	buildVertexLayouts();

}
Beispiel #2
0
void ColoredCubeApp::initApp()
{
	D3DApp::initApp();
	
	buildFX();
	buildVertexLayouts();

	mBox.init(md3dDevice, 1.0f, D3DXCOLOR(0.5,0.5,0.5,1));
	redBox.init(md3dDevice, 1.0f, DARKBROWN);
	greenBox.init(md3dDevice, 1.0f, D3DXCOLOR(0.1,0.1,0.8,1));
	shootBox.init(md3dDevice, 1.0f, BEACH_SAND);

	line.init(md3dDevice, 1.0f, DARKBROWN);
	line2.init(md3dDevice, 1.0f, RED);
	line3.init(md3dDevice, 1.0f, GREEN);

	/*xLine.init(&line, mfxWVPVar, Vector3(0,0,0), 1);
	xLine.setPosition(Vector3(0,0,0));
	yLine.init(&line, mfxWVPVar, Vector3(0,0,0), 1);
	yLine.setPosition(Vector3(0,0,0));
	yLine.setRotationZ(ToRadian(90));
	zLine.init(&line, mfxWVPVar, Vector3(0,0,0), 1);
	zLine.setPosition(Vector3(0,0,0));
	zLine.setRotationY(ToRadian(90));*/

	shootCube.init(&shootBox,mfxWVPVar,sqrt(2.0f),Vector3(10,0,10),Vector3(0,0,0),0,Vector3(1,1,1));
	//shootCube.setRotation(Vector3(ToRadian(-20),ToRadian(45),0));

	leftWall.init(&redBox,mfxWVPVar,sqrt(2.0f),Vector3(20,0,0),Vector3(0,0,0),0,Vector3(0.5,20,100));
	//leftWall.setRotation(Vector3(ToRadian(-20),ToRadian(45),0));

	floor.init(&redBox,mfxWVPVar,sqrt(2.0f),Vector3(0,-5,0),Vector3(0,0,0),0,Vector3(20,0.2,20));
	//floor.setRotation(Vector3(ToRadian(-26),ToRadian(45),0));

	ceiling.init(&mBox,mfxWVPVar,sqrt(2.0f),Vector3(0,20,0),Vector3(0,0,0),0,Vector3(20,0.2,100));
	ceiling.setRotation(Vector3(ToRadian(-20),ToRadian(45),0));

	rightWall.init(&redBox,mfxWVPVar,sqrt(2.0f),Vector3(-20,0,0),Vector3(0,0,0),0,Vector3(0.5,20,100));
	//rightWall.setRotation(Vector3(ToRadian(-20),ToRadian(45),0));

	//srand(time(0));

	for(int i = 0; i < 20; i++)
	{
		tiles[i].init(&greenBox,mfxWVPVar,sqrt(2.0f),Vector3((-5+rand()%10)*3,-100,(-5+rand()%10)*3),Vector3(0,0,0),0,Vector3(1,1,1));
	}

	origin.init(&line,&line2,&line3,mfxWVPVar,10);

	quad1.init(md3dDevice, 10, CYAN);
	quad1.setPosition(Vector3(0,0,0));

	spinAmount = 0;

	// init sound system
    audio = new Audio();
    if (*WAVE_BANK != '\0' && *SOUND_BANK != '\0')  // if sound files defined
    {
        if( FAILED( hr = audio->initialize() ) )
        {
			exit(1);
            //if( hr == HRESULT_FROM_WIN32( ERROR_FILE_NOT_FOUND ) )
            //    throw(GameError(gameErrorNS::FATAL_ERROR, "Failed to initialize sound system because media file not found."));
            //else
            //    throw(GameError(gameErrorNS::FATAL_ERROR, "Failed to initialize sound system."));
        }
    }

	hitCubes = new CubeHoard(100,10,5,5,1,-15,15,-15,15,-100,40);
	hitCubes->init(&redBox,mfxWVPVar,sqrt(4.0f),Vector3(0,0,0),Vector3(0,100,0),70,Vector3(2,2,2));

	avoidCubes = new CubeHoard(100,20,10,10,1,-20,20,-20,20,-100,50);
	avoidCubes->init(&greenBox,mfxWVPVar,sqrt(4.0f),Vector3(0,0,0),Vector3(0,100,0),70,Vector3(2,2,2));

	audio->playCue(MUSIC);

	//input->initialize(this->getMainWnd(), false);  

}