示例#1
0
Shock::Shock(class PlayerAI *player, Vector &direction){

	mat = new Material("Textures/Shield/Shield",Texture::cARGB);
	mat->SetMode(MATERIAL_DEST_ADD_SOURCE);
	Geometry *g = new Geometry();
	g->SetName(0,"Shock");
	g->Apply(mat);
	g->Add(Vector(-25000, 25000,0));
	g->Add(Vector( 25000, 25000,0));
	g->Add(Vector( 25000,-25000,0));
	g->Add(Vector(-25000,-25000,0));
	g->Add(Vertex(0,0,0));
	g->Add(Vertex(1,1,0));
	g->Add(Vertex(2,1,1));
	g->Add(Vertex(3,0,1));
	IndexedPolygon *pol;
	pol = g->NewIndexedPolygon(); //new IndexedPolygon(g);
	pol->Add(0);
	pol->Add(1);
	pol->Add(2);
	pol->Add(3);
	Intelligence::Apply(g);
	g->Node::Apply(0,this);
	player->GetCreatorGeometry()->Node::Apply(0,g);
	SetPosition(Vector(0,0,0));
	Quaternion dir = Quaternion(direction.X,-direction.Y,0,0);
	SetOrientation(Quaternion(dir));
	Spawn = -1.0f;
}
示例#2
0
Planet::Planet(Camera *cam, class Geometry *parent){
	camera = cam;
	mat = new Material("Textures/Backdrops/Planet5",Texture::cARGB);
	mat->SetMode(MATERIAL_SOURCE_DIFFUSE|MATERIAL_DEST_MULTIPLY_ONE_MINUS_ALPHA);
	Geometry *g = new Geometry();
	g->SetName(0,"Planet");
	g->Apply(mat);
	g->Add(Vector(-6000, 6000,0));
	g->Add(Vector( 6000, 6000,0));
	g->Add(Vector( 6000,-6000,0));
	g->Add(Vector(-6000,-6000,0));
	g->Add(Vertex(0,0,0));
	g->Add(Vertex(1,1,0));
	g->Add(Vertex(2,1,1));
	g->Add(Vertex(3,0,1));
	IndexedPolygon *pol;
	pol = /*g->NewIndexedPolygon();*/ new IndexedPolygon(g);
	pol->Add(0);
	pol->Add(1);
	pol->Add(2);
	pol->Add(3);
	Intelligence::Apply(g);
	g->Node::Apply(0,this);
	parent->Node::Apply(0,g);
	SetPosition(Vector(0,0,0));
g->SetSquareRadius(0);
}
示例#3
0
void GeometryListView::OnEditGeometry() 
// Called when user clicks "Edit" in the geometry list.
{
	// Figure out which geometry item to edit.
	int	index = GetSelectedItemIndex();
	if (index < 0) {
		// No item selected, so we don't know what to delete...
		return;
	}
	if (index == 0) {
		// Can't edit null geometry.
		return;
	}

	// Get the geometry object to edit.
	Geometry*	g = GetDocument()->GetGeometry(index);
	if (g == NULL) return;

	// Call edit dialog box.
	GeometryPropertiesDialog d;
	d.SetName(g->GetName());
	d.SetFilename(g->GetFilename()); 
	d.SetComment(g->GetComment());

	if (d.DoModal() != IDCANCEL) {
		// Apply the changes.
		g->SetName(d.GetName());
		g->SetFilename(d.GetFilename());
		g->SetComment(d.GetComment());

		GetDocument()->SetModifiedFlag();
		GetDocument()->UpdateAllViews(NULL);
	}
}
示例#4
0
void GeometryListView::OnAddNewGeometry() 
// Called when user clicks "New Geometry" button.
{
	// Call the properties dialog box with some default initial values.
	GeometryPropertiesDialog d;
	d.SetName("Untitled");
	d.SetFilename("Unknown");
	d.SetComment("");

	if (d.DoModal() != IDCANCEL) {
		// Create a new geometry item with the new values, and add it to our list.
		Geometry*	g = new Geometry;

		g->SetName(d.GetName());
		g->SetFilename(d.GetFilename());
		g->SetComment(d.GetComment());

		GetDocument()->AddGeometry(g);
		GetDocument()->SetModifiedFlag();

		GetDocument()->UpdateAllViews(NULL);
	}
}
void Meteorites::InitLevels(int count){
	Rocks = new DynamicArray();
	Rocks_sub = new DynamicArray();
	Rocks_sub_sub = new DynamicArray();
	AI_Rocks = new DynamicArray();
	Rocks_sub_item = 0;
	Rocks_sub_sub_item = 0;
	RockCount = 0;

	printf("Creating rocks...\n");
	int rCount = 10*count;
	ConsoleProgressBar *bar = new ConsoleProgressBar(40,rCount+rCount*3+rCount*3*3);
	for(int n=0; n<rCount; n++){
		Geometry *Rock = new Geometry();
		Rock->SetName("Rock");
/*
		Rock->Add(Vector(-40000,-40000,0));
		Rock->Add(Vector( 40000,-40000,0));
		Rock->Add(Vector( 40000, 40000,0));
		Rock->Add(Vector(-40000, 40000,0));
		Rock->Add(Vertex(0,0,0));
		Rock->Add(Vertex(1,1,0));
		Rock->Add(Vertex(2,1,1));
		Rock->Add(Vertex(3,0,1));
		IndexedPolygon *pol = Rock->NewIndexedPolygon();
		pol->Add(0);
		pol->Add(1);
		pol->Add(2);
		pol->Add(3);
*/
		Rocks->Add(Rock);
		RockAI *AI_Rock = new RockAI(this,Rock,40000.0f);
		Rock->Node::Apply(AI_Rock);
//		AI_Rocks->Add(AI_Rock);
		bar->Tick();
	}
/*
	for(n=0; n<rCount*3; n++){
		Geometry *Rock = new Geometry();
		Rock->SetName("Rock_sub");
		Rock->Add(Vector(-20000,-20000,0));
		Rock->Add(Vector( 20000,-20000,0));
		Rock->Add(Vector( 20000, 20000,0));
		Rock->Add(Vector(-20000, 20000,0));
		Rock->Add(Vertex(0,0,0));
		Rock->Add(Vertex(1,1,0));
		Rock->Add(Vertex(2,1,1));
		Rock->Add(Vertex(3,0,1));
		IndexedPolygon *pol = Rock->NewIndexedPolygon();
		pol->Add(0);
		pol->Add(1);
		pol->Add(2);
		pol->Add(3);
		Rocks_sub->Add(Rock);
		bar->Tick();
	}
	for(n=0; n<rCount*3*3; n++){
		Geometry *Rock = new Geometry();
		Rock->SetName("Rock_sub_sub");
		Rock->Add(Vector(-10000,-10000,0));
		Rock->Add(Vector( 10000,-10000,0));
		Rock->Add(Vector( 10000, 10000,0));
		Rock->Add(Vector(-10000, 10000,0));
		Rock->Add(Vertex(0,0,0));
		Rock->Add(Vertex(1,1,0));
		Rock->Add(Vertex(2,1,1));
		Rock->Add(Vertex(3,0,1));
		IndexedPolygon *pol = Rock->NewIndexedPolygon();
		pol->Add(0);
		pol->Add(1);
		pol->Add(2);
		pol->Add(3);
		Rocks_sub_sub->Add(Rock);
		bar->Tick();
	}
*/	delete bar;
/*
	printf("Shaping rocks..\n");
//	int rCount = 10*count;
//	ConsoleProgressBar
	bar = new ConsoleProgressBar(40,rCount+rCount*3+rCount*3*3);
	for(n=0; n<rCount; n++){
		Geometry *Rock = (Geometry*)Rocks->GetItem(n); //new Geometry();
		RockAI *AI_Rock = new RockAI(this,Rock,40000.0f);
		Rock->Node::Apply(AI_Rock);
		AI_Rocks->Add(AI_Rock);
		bar->Tick();
	}

	for(n=0; n<rCount*3; n++){
		Geometry *Rock = (Geometry*)Rocks_sub->GetItem(n); //new Geometry();
		RockAI *AI_Rock = new RockAI(this,Rock);
		Rock->Node::Apply(AI_Rock);
		AI_Rocks->Add(AI_Rock);
		bar->Tick();
	}
	for(n=0; n<rCount*3*3; n++){
		Geometry *Rock = (Geometry*)Rocks_sub_sub->GetItem(n); //new Geometry();
		RockAI *AI_Rock = new RockAI(this,Rock);
		Rock->Node::Apply(AI_Rock);
		AI_Rocks->Add(AI_Rock);
		bar->Tick();
	}
	delete bar;
*/
}
Meteorites::Meteorites() : Client(), Message(){

	SetName("MeteoritesGame");

	printf("------------------------------------------------------------------------\n");
	printf("Initializing TV-Meteorites, Copyright (C) RealityMakers Entertainment as\n");
	printf("------------------------------------------------------------------------\n");

//	char *str = new char[strlen(GetCurrentProcess()->GetName())+];
//	SetName();

	extern Host *host;
//	AttatchHook  = host->CreateHook("Attatch");
//	DetatchHook  = host->CreateHook("Detatch");
//	ShutDownHook = host->CreateHook("ShutDown");

	View1 = new View(Rect(0,0,1,1));
	View1->SetClearState(false);

/*
	ScoreView = new View(Rect(.8f,0,1,.5f));
	ScoreView->SetClearState(false);
	ScoreView->ConsoleStream::Clear();
	ScoreView->Print(" 1: 1261\n 2: 8726\n");
	ScoreView->Print(" 3: 8145\n 4: 6923\n");
	ScoreView->Print(" 5: 1261\n 6: 8726\n");
	ScoreView->Print(" 7: 8145\n 8: 6923\n");
	ScoreView->Print(" 9: 1261\n10: 8726\n");
	ScoreView->Print("11: 8145\n12: 6923\n");
	ScoreView->Print("13: 1261\n14: 8726\n");
	ScoreView->Print("15: 8145\n16: 6923\n");
	font = new Font("Fonts/Swiss");
	ScoreView->ConsoleStream::Apply(font);
	View1->Apply(ScoreView);
*/
//	View2 = new View(Rect(.8f,0,1,.5f));
	View4 = new View(Rect(.75f,0,1,.8f));
//	View2->SetClearState(false);
//	View4->SetClearState(false);

//	MeteoritesBitmap = new Bitmap("Textures/interface/divider"/*Textures/Title/title"*/,BITMAP_RGB); //Titletv4");
//	View *LoadView = new View(Rect(.2f,.2f,1-.2f,1-.2f));
//	View4->Apply(MeteoritesBitmap);
//View1->Apply(View4);
	// Initialize scene

//	Bitmap *DividerBitmap = new Bitmap("Textures/interface/divider"/*Textures/Title/title"*/,BITMAP_RGB); //Titletv4");

	Bitmap *ShadowBM = new Bitmap("Textures/Interface/Shipshadow",BITMAP_ARGB);
	View *Shadow = new View(Rect(.7f,0,1,1));
//	View1->Apply(Shadow);

	ScoreViews = new DynamicArray();
	font = new Font("Fonts/Swiss");
	for(int n=0; n<4; n++){		// 12.5 x 23.3, 54.2 x 23.3
		#define xofs	.01f
		#define yofs	.1f
		#define width  (.233f*.8f)
		#define height (((.125f+.542f)/16.0f)*.8f)
		#define spacing ((0.1666667f/100.0f)*5.0f)

//		View *DividerView = new View(Rect(1-width,float(n)*height,1,float(n)*height+height-spacing));
//		DividerView->Apply(DividerBitmap);
//		DividerView->SetClearState(false);
//		View1->Apply(DividerView);

		char str[1024];
		sprintf(str,"Textures/interface/playernum/no%d",n+1);
		Bitmap *PlayerNBitmap = new Bitmap(str,BITMAP_RGB); //Titletv4");
		View *PlayerNView = new View(Rect(1-width-height+xofs,float(n)*height+yofs,1-width-spacing+xofs,float(n)*height+height-spacing+yofs));
		PlayerNView->Apply(PlayerNBitmap);
		PlayerNView->SetClearState(false);
		View1->Apply(PlayerNView);

		float scl = 1-width-height*2.0f+xofs;
		float sct = float(n)*height+yofs;
		float scr = 1-width-height+xofs;
		float scb = float(n)*height+height+yofs;
		float xs = (scr-scl)*.2f;
		float ys = (scb-sct)*.2f;
		scl+=xs;
		scr-=xs;
		sct+=ys;
		scb-=ys;
		switch(n){
		Bitmap *PlaceBitmap;
		View *PlaceView;
		case 0:
			PlaceBitmap = new Bitmap("Textures/interface/first",BITMAP_RGB); //Titletv4");
			PlaceView = new View(Rect(scl,sct,scr,scb));
			PlaceView->Apply(PlaceBitmap);
			PlaceView->SetClearState(false);
			View1->Apply(PlaceView);
		break;
		case 1:
			PlaceBitmap = new Bitmap("Textures/interface/second",BITMAP_RGB); //Titletv4");
			PlaceView = new View(Rect(scl,sct,scr,scb));
			PlaceView->Apply(PlaceBitmap);
			PlaceView->SetClearState(false);
			View1->Apply(PlaceView);
		break;
		case 2:
			PlaceBitmap = new Bitmap("Textures/interface/third",BITMAP_RGB); //Titletv4");
			PlaceView = new View(Rect(scl,sct,scr,scb));
			PlaceView->Apply(PlaceBitmap);
			PlaceView->SetClearState(false);
			View1->Apply(PlaceView);
		break;
		}

		#define fontscale  0
		View *v = new View(Rect(1-width+xofs,float(n)*height+fontscale+yofs,1+xofs,float(n)*height+height-spacing-fontscale+yofs));
		v->ConsoleStream::Apply(font);
		v->SetClearState(false);
		v->Print("0 ...");
		/*
		switch(n){
		case 0:  v->SetColor(ARGB(1,0,0)); break;
		case 1:  v->SetColor(ARGB(0,0,1)); break;
		case 2:  v->SetColor(ARGB(1,1,0)); break;
		case 3:  v->SetColor(ARGB(0,1,0)); break;
		case 4:  v->SetColor(ARGB(1,.5f,.5f)); break;
		case 5:  v->SetColor(ARGB(0,1,1)); break;
		case 6:  v->SetColor(ARGB(.5f,.5f,.5f)); break;
		case 7:  v->SetColor(ARGB(1,0,0)); break;
		case 8:  v->SetColor(ARGB(1,0,0)); break;
		case 9:  v->SetColor(ARGB(1,0,0)); break;
		case 10: v->SetColor(ARGB(1,0,0)); break;
		case 11: v->SetColor(ARGB(1,0,0)); break;
		case 12: v->SetColor(ARGB(1,0,0)); break;
		case 13: v->SetColor(ARGB(1,0,0)); break;
		case 14: v->SetColor(ARGB(1,0,0)); break;
		case 15: v->SetColor(ARGB(1,0,0)); break;
		}
		*/
		v->SetColor(ARGB(1,1,1));
		View1->Apply(v);
		ScoreViews->Add(v);
	}

//	191,189
//	101
//	85

	Info1 = new Bitmap("Textures/Interface/Instructions/Inntasting",BITMAP_RGB);
	Info2 = new Bitmap("Textures/Interface/Instructions/Kontroll",BITMAP_RGB);
	Info3 = new Bitmap("Textures/Interface/Instructions/Pickups",BITMAP_RGB);
printf("%d,%d\n",Info1->GetWidth(),Info1->GetHeight());
printf("%d,%d\n",Info2->GetWidth(),Info2->GetHeight());
printf("%d,%d\n",Info3->GetWidth(),Info3->GetHeight());
	View *InfoView = new View(Rect(.75f,.7f,.95f,.9f));
	InfoView->SetClearState(false);
	View *v1 = new View(Rect(0,0,1,1.3f));
	View *v2 = new View(Rect(0,0,1,101.0f/189.0f*1.3f));
	View *v3 = new View(Rect(0,0,1,85.0f/189.0f*1.3f));
	v1->Apply(Info1);
	v2->Apply(Info2);
	v3->Apply(Info3);
	v1->SetClearState(false);
	v2->SetClearState(false);
	v3->SetClearState(false);
	InfoView->Apply(v1);
	InfoView->Apply(v2);
	InfoView->Apply(v3);
	View1->Apply(InfoView);

	Info3->SetTranslusency(.8f);

	null = new Geometry();
	null->SetPosition(Vector(0,0,1000000));

	Back = new Geometry();
	Back->Node::Apply(new Background(Back));
	Back->SetPosition(Vector(0,0,800000));
	Back->Post();
	null->Node::Apply(Back);

	new Planet(null);

	cam = new Camera();
	cam->SetName("Camera");
	null->Node::Apply(cam);
	camAI = new CameraAI(cam);
	cam->Apply(camAI);

	View1->Attatch(cam);

	PlayerGeometries = new DynamicArray();
	for(n=0; n<4; n++){
		Geometry *Ship = new Geometry();
		char name[1024];
		sprintf(name,"Player%d",n);
		Ship->SetName(name);
		//Ship->SetPosition(Vector(0,0,-800000));
		Ship->Post();
		PlayerGeometries->Add(Ship);
		//AI_Player1 = new PlayerAI(Ship);
		null->Node::Apply(Ship);
		Ship->Node::Apply(new PlayerAI(Ship,(View*)ScoreViews->GetItem(n)));
	}

	//

	printf("Initializing levels.\n");
	//#ifndef _DEBUG
	InitLevels(2);
	NextLevel(10);
	//#endif
	printf("Done.\n");

	printf("------------------------------------------------------------------------\n");
	printf("                       TV-Meteorites initalized\n");
	printf("------------------------------------------------------------------------\n");

	Initialized = true;
}
Meteorites::Meteorites() : Client(), Message(){

	SetName("MeteoritesGame");

	printf("------------------------------------------------------------------------\n");
	printf("Initializing TV-Meteorites, Copyright (C) RealityMakers Entertainment as\n");
	printf("------------------------------------------------------------------------\n");

//	char *str = new char[strlen(GetCurrentProcess()->GetName())+];
//	SetName();

	extern Host *host;
	AttatchHook  = host->CreateHook("Attatch");
	DetatchHook  = host->CreateHook("Detatch");
	ShutDownHook = host->CreateHook("ShutDown");

	View1 = new View(Rect(0,0,1,1));
	View1->SetClearState(false);

	ScoreViews = new DynamicArray();
	font = new Font("Fonts/Swiss");
	for(int n=0; n<16; n++){
		View *v = new View(Rect(.8f,float(n)*.6f/16.0f,1,float(n+1)*.6f/16.0f));
		v->ConsoleStream::Apply(font);
		v->SetClearState(false);
		v->Print("0");
		switch(n){
		case 0:  v->SetColor(ARGB(1,0,0)); break;
		case 1:  v->SetColor(ARGB(0,0,1)); break;
		case 2:  v->SetColor(ARGB(1,1,0)); break;
		case 3:  v->SetColor(ARGB(0,1,0)); break;
		case 4:  v->SetColor(ARGB(1,.5f,.5f)); break;
		case 5:  v->SetColor(ARGB(0,1,1)); break;
		case 6:  v->SetColor(ARGB(.5f,.5f,.5f)); break;
		case 7:  v->SetColor(ARGB(1,0,0)); break;
		case 8:  v->SetColor(ARGB(1,0,0)); break;
		case 9:  v->SetColor(ARGB(1,0,0)); break;
		case 10: v->SetColor(ARGB(1,0,0)); break;
		case 11: v->SetColor(ARGB(1,0,0)); break;
		case 12: v->SetColor(ARGB(1,0,0)); break;
		case 13: v->SetColor(ARGB(1,0,0)); break;
		case 14: v->SetColor(ARGB(1,0,0)); break;
		case 15: v->SetColor(ARGB(1,0,0)); break;
		}
		View1->Apply(v);
		ScoreViews->Add(v);
	}
/*
	ScoreView = new View(Rect(.8f,0,1,.5f));
	ScoreView->SetClearState(false);
	ScoreView->ConsoleStream::Clear();
	ScoreView->Print(" 1: 1261\n 2: 8726\n");
	ScoreView->Print(" 3: 8145\n 4: 6923\n");
	ScoreView->Print(" 5: 1261\n 6: 8726\n");
	ScoreView->Print(" 7: 8145\n 8: 6923\n");
	ScoreView->Print(" 9: 1261\n10: 8726\n");
	ScoreView->Print("11: 8145\n12: 6923\n");
	ScoreView->Print("13: 1261\n14: 8726\n");
	ScoreView->Print("15: 8145\n16: 6923\n");
	font = new Font("Fonts/Swiss");
	ScoreView->ConsoleStream::Apply(font);
	View1->Apply(ScoreView);
*/
//	View2 = new View(Rect(.8f,0,1,.5f));
	View4 = new View(Rect(.75f,0,1,.8f));
//	View2->SetClearState(false);
//	View4->SetClearState(false);

	MeteoritesBitmap = new Bitmap("Textures/test"/*Textures/Title/title"*/,BITMAP_RGB); //Titletv4");
	View *LoadView = new View(Rect(.2f,.2f,1-.2f,1-.2f));
	View4->Apply(MeteoritesBitmap);
View1->Apply(View4);
	// Initialize scene

	null = new Geometry();
	null->SetPosition(Vector(0,0,1000000));

	Back = new Geometry();
	Back->Node::Apply(new Background(Back));
	Back->SetPosition(Vector(0,0,1000000));
	Back->Post();
	null->Node::Apply(Back);

	cam = new Camera();
	cam->SetName("Camera");
	null->Node::Apply(cam);
	camAI = new CameraAI(cam);
	cam->Apply(camAI);

	View1->Attatch(cam);

	PlayerGeometries = new DynamicArray();
	for(n=0; n<5; n++){
		Geometry *Ship = new Geometry();
		char name[1024];
		sprintf(name,"Player%d",n);
		Ship->SetName(name);
		//Ship->SetPosition(Vector(0,0,-800000));
		Ship->Post();
		PlayerGeometries->Add(Ship);
		//AI_Player1 = new PlayerAI(Ship);
		null->Node::Apply(Ship);
		Ship->Node::Apply(new PlayerAI(Ship,(View*)ScoreViews->GetItem(n)));
	}

	//

	printf("Initializing levels.\n");
	//#ifndef _DEBUG
	InitLevels(2);
	NextLevel(10);
	//#endif
	printf("Done.\n");

	printf("------------------------------------------------------------------------\n");
	printf("                       TV-Meteorites initalized\n");
	printf("------------------------------------------------------------------------\n");

	Initialized = true;
}
Meteorites::Meteorites() : Client(), Message(){

	ViewBunch = new DynamicArray();
	BitmapBunch = new DynamicArray();

	SetName("MeteoritesGame");

	printf("------------------------------------------------------------------------\n");
	printf("Initializing TV-Meteorites, Copyright (C) RealityMakers Entertainment as\n");
	printf("------------------------------------------------------------------------\n");

	View1 = new View(Rect(0,0,1,1));
	View1->SetClearState(false);
/*
	Scores = new ScoreViews(View1);
*/
//	191,189
//	101
//	85

	#ifdef TV2
	tv2bm = new Bitmap("Textures/tv2/tv2",BITMAP_RGB);
	tv2v  = new View(Rect(
		1-.075f*.8f-.01f,
		.01f,
		1-.01f,
		.1f*.8f+.01f));
	tv2bm->SetTranslusency(.5f);
	tv2v->Apply(tv2bm);
	tv2v->SetClearState(false);
	View1->Apply(tv2v);
	#endif
	#ifdef SCHIBSTED
	tv2bm = new Bitmap("Textures/tv2/slogo",BITMAP_RGB);
	tv2v  = new View(Rect(
		1-.09f*.8f*1.5f-.01f,
		.01f,
		1-.01f,
		.1f*.8f+.01f));
	tv2bm->SetTranslusency(.5f);
	tv2v->Apply(tv2bm);
	tv2v->SetClearState(false);
	View1->Apply(tv2v);
	#endif
	#ifdef JANCO
	Bitmap *tv2bm = new Bitmap("Textures/tv2/janco",BITMAP_RGB);
	View *tv2v  = new View(Rect(
		.9f,
		0,
		1,
		.1f));
	tv2bm->SetTranslusency(.5f);
	tv2v->Apply(tv2bm);
	tv2v->SetClearState(false);
	View1->Apply(tv2v);
	#endif

	Info1 = new Bitmap("Textures/Interface/Instructions/Inntasting",BITMAP_RGB);
	Info2 = new Bitmap("Textures/Interface/Instructions/Kontroll",BITMAP_RGB);
	Info3 = new Bitmap("Textures/Interface/Instructions/Pickups",BITMAP_RGB);
//printf("%d,%d\n",Info1->GetWidth(),Info1->GetHeight());
//printf("%d,%d\n",Info2->GetWidth(),Info2->GetHeight());
//printf("%d,%d\n",Info3->GetWidth(),Info3->GetHeight());
	View *InfoView = new View(Rect(.75f,.7f,.95f,.9f));
	InfoView->SetClearState(false);
	View *v1 = new View(Rect(0,0,1,1.3f));
	View *v2 = new View(Rect(0,0,1,101.0f/189.0f*1.3f));
	View *v3 = new View(Rect(0,0,1,85.0f/189.0f*1.3f));
	InfoViews = new DynamicArray();
	InfoViews->Add(InfoView);
	InfoViews->Add(v1);
	InfoViews->Add(v2);
	InfoViews->Add(v3);
	v1->Apply(Info1);
	v2->Apply(Info2);
	v3->Apply(Info3);
	v1->SetClearState(false);
	v2->SetClearState(false);
	v3->SetClearState(false);
	InfoView->Apply(v1);
	InfoView->Apply(v2);
	InfoView->Apply(v3);
	View1->Apply(InfoView);


//	Info3->SetTranslusency(.8f);
#if 1
	scene = new Scene(View1);
#else
	Scores = new ScoreViews(View1);

	null = new Geometry();
	null->SetPosition(Vector(0,0,10000));

	Back = new Geometry();
	Back->Node::Apply(new Background(Back));
	Back->SetPosition(Vector(0,0,8000*3));
	Back->Post();
	null->Node::Apply(Back);

	new Nebula(null);
	new	Sun(null);
//	new Planet(null);

	cam = new Camera();
	cam->SetName(String("Camera"));
	null->Node::Apply(cam);
	camAI = new CameraAI(cam);
	cam->Apply(camAI);
	View1->Attatch(cam);
/*
//	PlayerGeometries = new DynamicArray();
	for(int n=0; n<16; n++){
		Geometry *Ship = new Geometry();
		char name[1024];
		sprintf(name,"Player%d",n);
		Ship->SetName(String(name));	// fixme: Optimize!
		//Ship->SetPosition(Vector(0,0,-800000));
		Ship->Post();
//		PlayerGeometries->Add(Ship);
		//AI_Player1 = new PlayerAI(Ship);
		null->Node::Apply(Ship);
		Ship->Node::Apply(new PlayerAI(Ship,Scores,Scores->GetPlayer(n),0));
	}
*/
//#if 0
	for(int n=0; n<10; n++){
		Geometry *Rock = new Geometry();
		Rock->SetName("Rock");
		Rock->Add(Vector(-400,-400,0));
		Rock->Add(Vector( 400,-400,0));
		Rock->Add(Vector( 400, 400,0));
		Rock->Add(Vector(-400, 400,0));
		Rock->Add(Vertex(0,0,0));
		Rock->Add(Vertex(1,1,0));
		Rock->Add(Vertex(2,1,1));
		Rock->Add(Vertex(3,0,1));
		IndexedPolygon *pol = Rock->NewIndexedPolygon();
		pol->Add(0);
		pol->Add(1);
		pol->Add(2);
		pol->Add(3);
		RockAI *AI_Rock = new RockAI(/*this,*/Rock,400.0f);
		Rock->Node::Apply(AI_Rock);
		null->Node::Apply(Rock);
	}
//#endif
	//
#if 0
	printf("Initializing levels.\n");
	//#ifndef _DEBUG
	InitLevels(2);
	NextLevel(10);
	//#endif
	printf("Done.\n");
#endif
#endif
	printf("------------------------------------------------------------------------\n");
	printf("                       TV-Meteorites initalized\n");
	printf("------------------------------------------------------------------------\n");

	Initialized = true;
}
示例#9
0
Sun::Sun(Camera *cam, class Geometry *parent){
	camera = cam;
	mat1 = new Material("Textures/Lens/Halo",Texture::cRGB);
	mat1->SetMode(MATERIAL_SOURCE_DIFFUSE|MATERIAL_DEST_ADD_SOURCE); //MATERIAL_DEST_MULTIPLY_ONE_MINUS_ALPHA);
	mat2 = new Material("Textures/Lens/Sun",Texture::cRGB);
	mat2->SetMode(MATERIAL_SOURCE_DIFFUSE|MATERIAL_DEST_ADD_SOURCE); //MULTIPLY_ONE_MINUS_ALPHA);
//mat1->SetTransparency(.6f);
//mat2->SetTransparency(.8f);
mat1->SetTransparency(.95f);
mat2->SetTransparency(.8f);
	Geometry *g = new Geometry();
	g->SetName(0,"Sun");
	g->Apply(mat1);
/*
	g->Add(Vector(-6000/2/3, 6000/2/3,0));
	g->Add(Vector( 6000/2/3, 6000/2/3,0));
	g->Add(Vector( 6000/2/3,-6000/2/3,0));
	g->Add(Vector(-6000/2/3,-6000/2/3,0));
	g->Add(Vector(-6000*5/2, 6000*5/2,-10000));
	g->Add(Vector( 6000*5/2, 6000*5/2,-10000));
	g->Add(Vector( 6000*5/2,-6000*5/2,-10000));
	g->Add(Vector(-6000*5/2,-6000*5/2,-10000));
*/
	g->Add(Vector(-6000*5/2, 6000*5/2,0));
	g->Add(Vector( 6000*5/2, 6000*5/2,0));
	g->Add(Vector( 6000*5/2,-6000*5/2,0));
	g->Add(Vector(-6000*5/2,-6000*5/2,0));
	g->Add(Vector(-6000*5/2, 6000*5/2,-10000));
	g->Add(Vector( 6000*5/2, 6000*5/2,-10000));
	g->Add(Vector( 6000*5/2,-6000*5/2,-10000));
	g->Add(Vector(-6000*5/2,-6000*5/2,-10000));

	g->Add(Vertex(0,0,0));
	g->Add(Vertex(1,1,0));
	g->Add(Vertex(2,1,1));
	g->Add(Vertex(3,0,1));
	g->Add(Vertex(4,0,0));
	g->Add(Vertex(5,1,0));
	g->Add(Vertex(6,1,1));
	g->Add(Vertex(7,0,1));
	IndexedPolygon *pol;

	pol = new IndexedPolygon(g); //new IndexedPolygon(g);
	pol->Add(0);
	pol->Add(1);
	pol->Add(2);
	pol->Add(3);
//pol->Apply(mat1);

/*	pol = new IndexedPolygon(g); //new IndexedPolygon(g);
	pol->Apply(mat2);
	pol->Add(4);
	pol->Add(5);
	pol->Add(6);
	pol->Add(7);*/
	Intelligence::Apply(g);
	g->Node::Apply(0,this);
	parent->Node::Apply(0,g);
	SetPosition(Vector(0,0,50000));
g->SetSquareRadius(0);
}