示例#1
0
void ParticleEditor::SetupMenu()
{
	m_fileMenu.SetupMenu(m_provider->GetVideo(), m_provider->GetInput(), GS_L("Menu"), m_menuSize*m_menuScale, m_menuWidth*2, true);
	m_fileMenu.AddButton(SAVE_SYSTEM);
	m_fileMenu.AddButton(SAVE_SYSTEM_AS);
	m_fileMenu.AddButton(OPEN_SYSTEM);
	//m_fileMenu.AddButton(ALPHA_ADD);
	//m_fileMenu.AddButton(ALPHA_PIXEL);
	m_fileMenu.AddButton(LOAD_BMP);
	m_fileMenu.AddButton(LOAD_SOUND);
	m_fileMenu.AddButton(LOAD_XSOUND);
	m_fileMenu.AddButton(LOAD_BG);
	m_fileMenu.AddButton(_S_GOTO_PROJ);

	m_alphaModes.SetupMenu(m_provider->GetVideo(), m_provider->GetInput(), m_menuSize, m_menuWidth*2, true, false, false);
	m_alphaModes.AddButton(ALPHA_MODE_PIXEL, true);
	m_alphaModes.AddButton(ALPHA_MODE_ADD, false);
	m_alphaModes.AddButton(ALPHA_MODE_MODULATE, false);

	m_animationModes.SetupMenu(m_provider->GetVideo(), m_provider->GetInput(), m_menuSize, m_menuWidth*2, true, false, false);
	m_animationModes.AddButton(ANIMATION_MODE_ANIMATE, true);
	m_animationModes.AddButton(ANIMATION_MODE_PICK, false);

	SetMenuConstants();
}
示例#2
0
void ParticleEditor::Clear()
{
	m_system.Reset();
	ResetSystem();
	SetMenuConstants();

	SetCurrentFile(_BASEEDITOR_DEFAULT_UNTITLED_FILE);
	m_untitled = true;
}
示例#3
0
void ParticleEditor::ParticlePanel()
{
	std::string programPath = GetCurrentProjectPath(false);
	const VideoPtr& video = m_provider->GetVideo();
	const InputPtr& input = m_provider->GetInput();

	GSGUI_BUTTON file_r = m_fileMenu.PlaceMenu(Vector2(0,m_menuSize*2));
	if (file_r.text == LOAD_BMP)
	{
		char path[___OUTPUT_LENGTH], file[___OUTPUT_LENGTH];
		if (OpenParticleBMP(path, file))
		{
			ETHGlobal::CopyFileToProject(programPath, path, ETHDirectories::GetParticlesDirectory(), m_provider->GetFileManager());
			m_system.bitmapFile = file;
			m_provider->GetGraphicResourceManager()->ReleaseResource(m_system.bitmapFile);
			m_manager = ETHParticleManagerPtr(
				new ETHParticleManager(m_provider, m_system, m_v2Pos, Vector3(m_v2Pos, 0), m_systemAngle, 1.0f));
		}
	}

	if (file_r.text == SAVE_SYSTEM)
	{
		if (m_untitled)
			SaveAs();
		else
			Save();
	}

	if (file_r.text == SAVE_SYSTEM_AS)
	{
		SaveAs();
	}

	if (file_r.text == LOAD_BG)
	{
		char path[___OUTPUT_LENGTH], file[___OUTPUT_LENGTH];
		if (OpenParticleBMP(path, file))
		{
			m_backgroundSprite = video->CreateSprite(path);
		}	
	}

	if (file_r.text == OPEN_SYSTEM)
	{
		m_systemAngle = 0.0f;
		char path[___OUTPUT_LENGTH], file[___OUTPUT_LENGTH];
		if (OpenSystem(path, file))
		{
			m_manager = ETHParticleManagerPtr(
				new ETHParticleManager(m_provider, path, m_v2Pos, Vector3(m_v2Pos, 0), m_systemAngle));
			m_manager->SetZPosition(0.0f);
			m_manager->Kill(false);
			m_system = *m_manager->GetSystem();
			SetMenuConstants();

			SetCurrentFile(path);
			m_untitled = false;
		}
	}

	if (file_r.text == _S_GOTO_PROJ)
	{
		m_projManagerRequested = true;
	}

	if (input->GetKeyState(GSK_K) == GSKS_HIT)
		m_manager->Kill(!m_manager->Killed());
	
	if (!m_fileMenu.IsActive())
	{
		Vector2 v2ScreenDim = video->GetScreenSizeF();
		float menu = m_menuSize*m_menuScale+(m_menuSize*2);

		// places the alpha mode menu
		ShadowPrint(Vector2(v2ScreenDim.x-m_alphaModes.GetWidth(), menu), GS_L("Alpha mode:"), GS_L("Verdana14_shadow.fnt"), gs2d::constant::WHITE);
		menu += m_menuSize;
		m_alphaModes.PlaceMenu(Vector2(v2ScreenDim.x-m_alphaModes.GetWidth(), menu)); menu += m_alphaModes.GetNumButtons()*m_menuSize;

		// sets the alpha mode according to the selected item
		if (m_alphaModes.GetButtonStatus(ALPHA_MODE_PIXEL))
			m_system.alphaMode = Video::AM_PIXEL;
		if (m_alphaModes.GetButtonStatus(ALPHA_MODE_ADD))
			m_system.alphaMode = Video::AM_ADD;
		if (m_alphaModes.GetButtonStatus(ALPHA_MODE_MODULATE))
			m_system.alphaMode = Video::AM_MODULATE;

		// places the sprite cut fields to the right
		menu += m_menuSize/2;
		ShadowPrint(Vector2(v2ScreenDim.x-m_alphaModes.GetWidth(), menu), GS_L("Sprite cut:"), GS_L("Verdana14_shadow.fnt"), gs2d::constant::WHITE);
		menu += m_menuSize;
		m_system.spriteCut.x = Max(1, static_cast<int>(m_spriteCut[0].PlaceInput(Vector2(v2ScreenDim.x-m_alphaModes.GetWidth(),menu)))); menu += m_menuSize;
		m_system.spriteCut.y = Max(1, static_cast<int>(m_spriteCut[1].PlaceInput(Vector2(v2ScreenDim.x-m_alphaModes.GetWidth(),menu)))); menu += m_menuSize;

		// if there is sprite animation in the particle system, places the animation mode selector
		if (m_system.spriteCut.x > 1 || m_system.spriteCut.y > 1)
		{
			menu += m_menuSize/2;
			m_animationModes.PlaceMenu(Vector2(v2ScreenDim.x-m_animationModes.GetWidth(), menu)); menu += m_animationModes.GetNumButtons()*m_menuSize;

			if (m_animationModes.GetButtonStatus(ANIMATION_MODE_ANIMATE))
				m_system.animationMode = ETHParticleSystem::PLAY_ANIMATION;
			if (m_animationModes.GetButtonStatus(ANIMATION_MODE_PICK))
				m_system.animationMode = ETHParticleSystem::PICK_RANDOM_FRAME;
		}

		// inputs all data
		menu = m_menuSize*m_menuScale+(m_menuSize*2);
		menu += m_menuSize/2;
		ShadowPrint(Vector2(0.0f,menu), GS_L("Particles:"), GS_L("Verdana14_shadow.fnt"), gs2d::constant::WHITE);
		int nParticles = m_particles.PlaceInput(Vector2(m_menuWidth,menu)); menu += m_menuSize;

		ShadowPrint(Vector2(0.0f,menu), GS_L("Repeats:"), GS_L("Verdana14_shadow.fnt"), gs2d::constant::WHITE);
		m_system.repeat = m_repeats.PlaceInput(Vector2(m_menuWidth,menu)); menu += m_menuSize;
		menu += m_menuSize/2;

		if (nParticles != m_system.nParticles && nParticles > 0)
		{
			m_system.nParticles = nParticles;
			m_manager = ETHParticleManagerPtr(
				new ETHParticleManager(m_provider, m_system, m_v2Pos, Vector3(m_v2Pos, 0), m_systemAngle, 1.0f));
			m_manager->Kill(false);
		}

		m_system.gravityVector.x = m_gravity[0].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.gravityVector.y = m_gravity[1].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;

		m_system.directionVector.x = m_direction[0].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.directionVector.y = m_direction[1].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;

		m_system.randomizeDir.x = m_randDir[0].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.randomizeDir.y = m_randDir[1].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		menu += m_menuSize/2;

		m_system.boundingSphere = m_boundingSphere.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.allAtOnce = (bool)(m_allAtOnce.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize) != 0); menu += m_menuSize;
		menu += m_menuSize/2;

		m_system.startPoint.x = m_startPoint[0].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.startPoint.y = m_startPoint[1].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		menu += m_menuSize/2;

		m_system.randStartPoint.x = m_randStart[0].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.randStartPoint.y = m_randStart[1].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		menu += m_menuSize/2;

		m_system.color0.w = m_color0[0].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.color0.x = m_color0[1].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.color0.y = m_color0[2].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.color0.z = m_color0[3].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		menu += m_menuSize/2;

		m_system.color1.w = m_color1[0].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.color1.x = m_color1[1].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.color1.y = m_color1[2].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.color1.z = m_color1[3].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		menu += m_menuSize/2;

		m_system.size = m_size.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.growth = m_growth.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.randomizeSize = m_randSize.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		menu += m_menuSize/2;

		m_system.lifeTime = m_lifeTime.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.randomizeLifeTime = m_randLifeTime.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		menu += m_menuSize/2;

		m_system.angleStart = m_angleStart.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.angleDir = m_angle.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.randAngle = m_randAngle.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.randAngleStart = m_randAngleStart.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		menu += m_menuSize/2;

		m_system.minSize = m_minSize.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.maxSize = m_maxSize.PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		menu += m_menuSize/2;

		m_system.emissive.x = m_luminance[0].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.emissive.y = m_luminance[1].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		m_system.emissive.z = m_luminance[2].PlaceInput(Vector2(0.0f,menu), Vector2(0.0f, v2ScreenDim.y-m_menuSize), m_menuSize); menu += m_menuSize;
		menu += m_menuSize/2;

		m_manager->SetSystem(m_system);
	}
}