bool InputGLFW::Initialise()
{
	InitialiseKeymap();

	//init callbacks for glfw
	glfwSetCharCallback( CharCallback );
	glfwSetKeyCallback( KeyCallback );
	glfwSetMouseButtonCallback( MouseButtonCallback );
	glfwSetMousePosCallback( MousePosCallback );
	glfwSetMouseWheelCallback( MouseWheelCallback );

	return true;
}
bool InputWin32::Initialise()
{
	InitialiseKeymap();
	return true;
}
Esempio n. 3
0
Treenity::Treenity(QWidget *parent)
	: QMainWindow(parent), m_running(true)
{
	//Set some utility init things
	Utils::GetInstance()->setParent(this);
	Utils::GetInstance()->setFloating(true);

	// Setup component names in the editor.
	m_componentNames[RootForce::ComponentType::RENDERABLE]			= "Renderable";
	m_componentNames[RootForce::ComponentType::TRANSFORM]			= "Transform";
	m_componentNames[RootForce::ComponentType::POINTLIGHT]			= "Point Light";
	m_componentNames[RootForce::ComponentType::CAMERA]				= "Camera";
	m_componentNames[RootForce::ComponentType::HEALTH]				= "Health";
	m_componentNames[RootForce::ComponentType::PLAYERCONTROL]		= "Player Control";
	m_componentNames[RootForce::ComponentType::PHYSICS]				= "Physics";
	m_componentNames[RootForce::ComponentType::NETWORK]				= "Network";
	m_componentNames[RootForce::ComponentType::LOOKATBEHAVIOR]		= "Look-At Behaviour";
	m_componentNames[RootForce::ComponentType::THIRDPERSONBEHAVIOR] = "Third Person Behaviour";
	m_componentNames[RootForce::ComponentType::SCRIPT]				= "Script";
	m_componentNames[RootForce::ComponentType::COLLISION]			= "Physics";	// Required since the component list searches on name.
	m_componentNames[RootForce::ComponentType::COLLISIONRESPONDER]	= "Collision Responder";
	m_componentNames[RootForce::ComponentType::PLAYER]				= "Player";
	m_componentNames[RootForce::ComponentType::ANIMATION]			= "Animation";
	m_componentNames[RootForce::ComponentType::PARTICLE]			= "Particle";
	m_componentNames[RootForce::ComponentType::TDMRULES]			= "Team-Deathmatch Rules";
	m_componentNames[RootForce::ComponentType::PLAYERACTION]		= "Player Action";
	m_componentNames[RootForce::ComponentType::PLAYERPHYSICS]		= "Player Physics";
	m_componentNames[RootForce::ComponentType::ENTITYSTATE]			= "Entity State";
	m_componentNames[RootForce::ComponentType::SHADOWCASTER]		= "Shadowcaster";
	m_componentNames[RootForce::ComponentType::DIRECTIONALLIGHT]	= "Directional Light";
	m_componentNames[RootForce::ComponentType::SERVERINFORMATION]	= "Server Information";
	m_componentNames[RootForce::ComponentType::CLIENT]				= "Client";
	m_componentNames[RootForce::ComponentType::RAGDOLL]				= "Ragdoll";
	m_componentNames[RootForce::ComponentType::WATERCOLLIDER]		= "Water Collider";
	m_componentNames[RootForce::ComponentType::ABILITYSPAWN]		= "Ability Spawn";
	m_componentNames[RootForce::ComponentType::TRYPICKUPCOMPONENT]	= "Try Pickup";
	m_componentNames[RootForce::ComponentType::SOUND]				= "Sound";
	m_componentNames[RootForce::ComponentType::TIMER]				= "Timer";
	m_componentNames[RootForce::ComponentType::FOLLOW]				= "Follow";
	m_componentNames[RootForce::ComponentType::HOMING]				= "Homing";
	m_componentNames[RootForce::ComponentType::RAY]					= "Ray";
	m_componentNames[RootForce::ComponentType::DAMAGEANDKNOCKBACK]	= "Damage and Knockback";
	m_componentNames[RootForce::ComponentType::SCALABLE]			= "Scalable";
	m_componentNames[RootForce::ComponentType::STATCHANGE]			= "Stat Change";
	m_componentNames[RootForce::ComponentType::KILLANNOUNCEMENT]	= "Kill Announcement";
	m_componentNames[RootForce::ComponentType::CONTROLLERACTIONS]	= "Controller Action";

	// Setup the main UI.
	ui.setupUi(this);

	setCorner( Qt::TopRightCorner, Qt::RightDockWidgetArea );
	setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea );

	m_compView = new ComponentView();
	m_scrollArea = new VerticalScrollArea();
	m_scrollArea->setWidget(m_compView);
	m_scrollArea->setFrameStyle(QFrame::Plain);
	// Setup the component view and its items.
	
	ui.verticalLayout->addWidget(m_scrollArea);
	m_componentViews[RootForce::ComponentType::TRANSFORM]			= new TransformView();
	m_componentViews[RootForce::ComponentType::RENDERABLE]			= new RenderableView();	
	m_componentViews[RootForce::ComponentType::COLLISION]			= new PhysicsView();
	m_componentViews[RootForce::ComponentType::WATERCOLLIDER]		= new WaterColliderView();
	m_componentViews[RootForce::ComponentType::SCRIPT]				= new ScriptView();
	m_componentViews[RootForce::ComponentType::COLLISIONRESPONDER]	= new CollisionResponderView();
	m_componentViews[RootForce::ComponentType::PARTICLE]			= new ParticleView();

	// Block component views from updates while in game mode.
	m_componentViews[RootForce::ComponentType::RENDERABLE]->SetReceiveUpdates(false);

	for (auto it : m_componentViews)
	{
		it.second->SetEditorInterface(this);
	}
	
	ui.treeView_entityOutliner->SetEditorInterface(this);

	//Set up water tool
	m_waterToolDockable = new WaterTool(this);

	// Match signals with slots.
	connect(ui.actionNew,							SIGNAL(triggered()),		this,					SLOT(New()));
	connect(ui.actionOpen_Project,					SIGNAL(triggered()),		this,					SLOT(OpenProject()));
	connect(ui.action_saveAs,						SIGNAL(triggered()),		this,					SLOT(SaveAs()));
	connect(ui.action_save,							SIGNAL(triggered()),		this,					SLOT(Save()));
	connect(ui.actionExit,							SIGNAL(triggered()),		this,					SLOT(close()));
	connect(ui.actionLog,							SIGNAL(triggered()),		Utils::GetInstance(),	SLOT(Show()));
	connect(ui.action_addEntity,					SIGNAL(triggered()),		this,					SLOT(CreateEntity()));
	connect(ui.action_removeEntity,					SIGNAL(triggered()),		this,					SLOT(DestroyEntity()));
	connect(ui.lineEdit_entityName,					SIGNAL(editingFinished()),	this,					SLOT(RenameEntity()));
	connect(ui.action_addRenderable,				SIGNAL(triggered()),		this,					SLOT(AddRenderable()));
	connect(ui.action_addPhysics,					SIGNAL(triggered()),		this,					SLOT(AddPhysics()));
	connect(ui.action_addWaterCollider,				SIGNAL(triggered()),		this,					SLOT(AddWaterCollider()));
	connect(ui.action_addScript,					SIGNAL(triggered()),		this,					SLOT(AddScriptComponent()));
	connect(ui.action_collisionResponder,			SIGNAL(triggered()),		this,					SLOT(AddCollisionResponder()));
	connect(ui.action_addParticle,					SIGNAL(triggered()),		this,					SLOT(AddParticleComponent()));
	connect(ui.actionPlay,							SIGNAL(triggered()),		this,					SLOT(Play()));
	connect(ui.pushButton_translateMode,			SIGNAL(clicked()),			this,					SLOT(SetTranslateTool()));
	connect(ui.pushButton_rotateMode,				SIGNAL(clicked()),			this,					SLOT(SetRotateTool()));
	connect(ui.pushButton_scaleMode,				SIGNAL(clicked()),			this,					SLOT(SetResizeTool()));
	connect(ui.comboBox_mode,						SIGNAL(currentIndexChanged(int)), this,				SLOT(ChangeToolMode(int)));
	connect(ui.actionWaterSetting,					SIGNAL(triggered()),		m_waterToolDockable,	SLOT(Show()));

	connect(m_componentViews[RootForce::ComponentType::RENDERABLE],			SIGNAL(deleted(ECS::Entity*)), this, SLOT(RemoveRenderable(ECS::Entity*)));
	connect(m_componentViews[RootForce::ComponentType::COLLISION],			SIGNAL(deleted(ECS::Entity*)), this, SLOT(RemovePhysics(ECS::Entity*))); 
	connect(m_componentViews[RootForce::ComponentType::WATERCOLLIDER],		SIGNAL(deleted(ECS::Entity*)), this, SLOT(RemoveWaterCollider(ECS::Entity*))); 
	connect(m_componentViews[RootForce::ComponentType::SCRIPT],				SIGNAL(deleted(ECS::Entity*)), this, SLOT(RemoveScriptComponent(ECS::Entity*))); 
	connect(m_componentViews[RootForce::ComponentType::COLLISIONRESPONDER], SIGNAL(deleted(ECS::Entity*)), this, SLOT(RemoveCollisionResponder(ECS::Entity*))); 

	// Setup Qt-to-SDL keymatching.
	InitialiseKeymap();

	ui.widget_canvas3D->SetEditorInterface(this);
	// Set tool mode.
	m_toolMode = ToolMode::LOCAL;
}
Esempio n. 4
0
bool InputMacOSX::Initialise()
{
	InitialiseKeymap();
	return true;
}