示例#1
0
void MapScene::Resize()
{
	PositionStd( &okay, 0 );

//	const Screenport& port = lumosGame->GetScreenport();
	LayoutCalculator layout = DefaultLayout();
	
	layout.PosAbs( &gridTravel, 1, -1, 2, 1 );
	layout.PosAbs( &viewButton, 3, -1, 2, 1 );
	layout.PosAbs(&warButton, -4, -1, 2, 1);
	layout.PosAbs(&peaceButton, -2, -1, 2, 1);

	float y  = layout.GutterY();
	float dy = okay.Y() - layout.GutterY() - y;
	float x = layout.GutterX();
	float dx = gamui2D.Width()*0.5f - 1.5f*layout.GutterX();
	dx = dy = Min( dx, dy );

	mapImage.SetSize( dx, dy );
	mapImage2.SetSize( dx, dy );

	mapImage.SetPos( x, y );
	mapImage2.SetPos( gamui2D.Width()*0.5f + 0.5f*layout.GutterX(), y );

	for (int i = 0; i < 2; ++i) {
		const float MARK_SIZE = 5;
		const float SQUAD_MARK_SIZE = 20;
		playerMark[i].SetSize(MARK_SIZE, MARK_SIZE);
		for (int k = 0; k < MAX_SQUADS; ++k) {
			squadMark[i][k].SetSize(SQUAD_MARK_SIZE, SQUAD_MARK_SIZE);
		}
	}
//	travelMark.SetSize(dx / float(NUM_SECTORS), dy / float(NUM_SECTORS));
	homeMark[0].SetSize(dx / float(NUM_SECTORS), dy / float(NUM_SECTORS));
	homeMark[1].SetSize(dx / float(MAP2_SIZE), dy / float(MAP2_SIZE));
	selectionMark.SetSize(float(MAP2_SIZE) * dx / float(NUM_SECTORS), float(MAP2_SIZE) *dx / float(NUM_SECTORS));

	webCanvas.SetPos(mapImage.X(), mapImage.Y());

	for (int i = 0; i < NUM_SECTORS; ++i) {
		float dx = gamui2D.TextHeightVirtual() * 0.5f;
		float dy = gamui2D.TextHeightVirtual() * 0.5f;

		float x = dx + mapImage.X() + mapImage.Width() * i / NUM_SECTORS;
		float y = dy + mapImage.Y();
		letters[i].SetPos(x, y);

		x = dx + mapImage.X();
		y = dy + mapImage.Y() + mapImage.Height() * i / NUM_SECTORS;
		numbers[i].SetPos(x, y);
	}

	DrawMap();
	EnableButtons();
}
示例#2
0
void FluidTestScene::Resize()
{
	PositionStd(&okay, 0);
	LayoutCalculator layout = DefaultLayout();

	int x = 0;
	int y = 0;
	for (int i = 0; i < NUM_BUTTONS; ++i) {
		layout.PosAbs(&buildButton[i], x, -3+y);
		++x;
		if (x == 10) {
			x = 0;
			++y;
		}
	}
	layout.PosAbs(&saveButton, 1, -1);
	layout.PosAbs(&loadButton, 2, -1);
}
示例#3
0
void ParticleScene::Resize()
{
//	LumosGame* lumosGame = static_cast<LumosGame*>( game );
	PositionStd( &okay, 0 );

	LayoutCalculator layout = DefaultLayout();
	layout.SetSize( LAYOUT_SIZE_X*0.75f, LAYOUT_SIZE_Y*0.5f );
	int x=0;
	int y=1;
	for( int i=0; i<buttonArr.Size(); ++i ) {
		layout.PosAbs( buttonArr[i], x*2, y );
		++x;
		if ( x == 6 ) {
			++y; x = 0;
		}
	}
}
示例#4
0
void TitleScene::Resize()
{
	const Screenport& port = game->GetScreenport();

	// Dowside of a local Engine: need to resize it.
	if (engine) {
		engine->GetScreenportMutable()->Resize(port.PhysicalWidth(), port.PhysicalHeight());
		for (int i = 0; i < NUM_MODELS; ++i) {
			if (model[i])
				model[i]->SetFlag(Model::MODEL_INVISIBLE);
		}
	}
	background.SetPos( 0, 0 );

	float aspect = gamui2D.AspectRatio();
	float factor = 0.5;
	if ( aspect >= 0.5f ) {
		background.SetSize(gamui2D.Width()*factor, gamui2D.Width()*0.5f*factor);
	}
	else {
		background.SetSize(gamui2D.Height()*2.0f*factor, gamui2D.Height()*factor);
	}
	background.SetCenterPos(gamui2D.Width()*0.5f, gamui2D.Height()*0.5f*factor);

	bool visible = game->GetDebugUI();
	LayoutCalculator layout = DefaultLayout();
	int c = 0;
	for( int i=0; i<NUM_TESTS; ++i ) {
		testScene[i].SetVisible( visible );

		int y = c / TESTS_PER_ROW;
		int x = c - y*TESTS_PER_ROW;
		layout.PosAbs( &testScene[i], x, y );
		++c;
	}
	layout.SetSize( LAYOUT_SIZE_X, LAYOUT_SIZE_Y );

	layout.PosAbs(&gameScene[GENERATE_WORLD], -2, -1, 2, 1);
	layout.PosAbs(&gameScene[CONTINUE], 0, -1, 2, 1);

	gameScene[CONTINUE].SetEnabled( false );
//	const char* datPath = game->GamePath( "game", 0, "dat" );
	const char* mapPath = game->GamePath( "map",  0, "dat" );

	GLString fullpath;
	GetSystemPath(GAME_SAVE_DIR, mapPath, &fullpath);
	FILE* fp = fopen(fullpath.c_str(), "rb");
	if (fp) {
		StreamReader reader(fp);
		if (reader.Version() == CURRENT_FILE_VERSION) {
			gameScene[CONTINUE].SetEnabled(true);
		}
		fclose(fp);
	}

	layout.PosAbs( &note, 0, -2 );
	note.SetVisible(!visible);
	note.SetBounds( gamui2D.Width() -(layout.GutterX() * 2.0f), 0 );

	layout.PosAbs(&audioButton, -1, 0);
	layout.PosAbs(&mouseTouchButton, -2, 0);
	layout.PosAbs(&creditsButton, -3, 0);

	testCanvas.SetPos(gamui2D.Width() - 100, gamui2D.Height() - 100);
	testCanvas.SetVisible(false);
}