OpenSaveDialog::OpenSaveDialog()
{
	using namespace MyGUI;

	BFG::Path path;
	std::string layout = path.Expand("OpenSaveDialog.layout");
	mContainer = LayoutManager::getInstance().load(layout);

	Gui* gui = Gui::getInstancePtr();

	mWindow = gui->findWidget<Window>("OpenSaveDialog");
	mFilesList = gui->findWidget<List>("FilesList");
	mFileNameEdit = gui->findWidget<Edit>("FileNameEdit");
	mCurrentFolderEdit = gui->findWidget<Edit>("CurrentFolderEdit");
	mOpenSaveButton = gui->findWidget<Button>("OpenSaveButton");

	mWindow->eventWindowButtonPressed = 
		newDelegate(this, &OpenSaveDialog::notifyWindowButtonPressed);
	mFilesList->eventListChangePosition = 
		newDelegate(this, &OpenSaveDialog::notifyListChangePosition);
	mFilesList->eventListSelectAccept = 
		newDelegate(this, &OpenSaveDialog::notifyListSelectAccept);
	mFileNameEdit->eventEditSelectAccept = 
		newDelegate(this, &OpenSaveDialog::notifyEditSelectAccept);
	mFileNameEdit->eventEditTextChange =
		newDelegate(this, &OpenSaveDialog::notifyEditTextChanged);

	mCurrentFolder = boost::filesystem::current_path().string();

	update();
	setVisible(false);
}
示例#2
0
void initController(BFG::GameHandle stateHandle, BFG::Event::Lane& lane)
{
	BFG::Controller_::ActionMapT actions;
	actions[A_SHIP_AXIS_Y] = "A_SHIP_AXIS_Y";
	actions[A_FPS]         = "A_FPS";
	actions[A_QUIT]        = "A_QUIT";
	actions[A_CONSOLE]     = "A_CONSOLE";
	BFG::Controller_::fillWithDefaultActions(actions);
	BFG::Controller_::sendActionsToController(lane, actions);

	BFG::Path path;
	const std::string configPath = path.Expand("Pong.xml");
	const std::string stateName = "Pong";

	BFG::View::WindowAttributes wa;
	BFG::View::queryWindowAttributes(wa);

	BFG::Controller_::StateInsertion si(configPath, stateName, stateHandle, true, wa);
	lane.emit(BFG::ID::CE_LOAD_STATE, si);
}
示例#3
0
	SynchronizationTestState(GameHandle handle, BFG::Event::Lane& lane) :
	State(lane),
	mSubLane(lane.createSubLane()),
	mStateHandle(handle),
	mPlayer1(BFG::NULL_HANDLE),
	mPlayer2(BFG::NULL_HANDLE),
	mEnvironment(new BFG::Environment)
	{
		BFG::Path p;
		std::string def = p.Get(BFG::ID::P_SCRIPTS_LEVELS) + "default/";
		std::string level = p.Get(BFG::ID::P_SCRIPTS_LEVELS) + "pong/";

		BFG::LevelConfig lc;

		lc.mModules.push_back(def + "Object.xml");
		lc.mAdapters.push_back(def + "Adapter.xml");
		lc.mConcepts.push_back(def + "Concept.xml");
		lc.mProperties.push_back(def + "Value.xml");

		lc.mModules.push_back(level + "Object.xml");
		lc.mAdapters.push_back(level + "Adapter.xml");
		lc.mConcepts.push_back(level + "Concept.xml");
		lc.mProperties.push_back(level + "Value.xml");

		using BFG::Property::ValueId;

		BFG::PluginId spId = ValueId::ENGINE_PLUGIN_ID;
		BFG::PluginId ppId = BFG::Property::generatePluginId<BFG::PluginId>();

		boost::shared_ptr<BFG::SpacePlugin> sp(new BFG::SpacePlugin(spId));
		boost::shared_ptr<PongPlugin> pp(new PongPlugin(ppId));
		mPluginMap.insert(sp);
		mPluginMap.insert(pp);

		mGof.reset(new BFG::GameObjectFactory(lane, lc, mPluginMap, mEnvironment, mStateHandle));

		mSector.reset(new BFG::Sector(lane, 1, "Blah", mGof));
	}
	ChatWindow(EventLoop* loop) :
	View::HudElement("ChatWindow.layout", "ChatWindow"),
	mControllerAdapter(generateHandle(), loop)
	{
		BFG::Controller_::ActionMapT actions;
		BFG::Controller_::fillWithDefaultActions(actions);
		BFG::Controller_::sendActionsToController(loop, actions);
	
		BFG::Path path;
		const std::string config_path = path.Expand("MyGUI.xml");
		const std::string state_name = "Chat";

		BFG::View::WindowAttributes wa;
		BFG::View::queryWindowAttributes(wa);

		BFG::Controller_::StateInsertion si(config_path, state_name, generateHandle(), true, wa);

		BFG::EventFactory::Create<BFG::Controller_::ControlEvent>
		(
			loop,
			BFG::ID::CE_LOAD_STATE,
			si
		);
	}