Compare commits

..

3 Commits

Author SHA1 Message Date
verysecrethero 6f739e22f3 Crash fix for: if you delete a team component in editor. 2016-01-22 10:10:39 +01:00
Jace 8cf83454d7 Fixed input going through editor UI 2016-01-21 17:45:20 +01:00
William Moberg 41f0daaf3f Merge pull request #45 from teamfisk/ShootEvent
Changed some files so it works with the changes in master. (weaponsys…
2016-01-21 17:40:57 +01:00
4 changed files with 15 additions and 7 deletions
+3 -3
View File
@@ -9,7 +9,7 @@
#include "../Core/EntityFilePreprocessor.h"
#include "../Core/EntityFileParser.h"
#include "../Core/EntityFileWriter.h"
#include "../Core/EMouseRelease.h"
#include "../Core/EMousePress.h"
#include "EditorGUI.h"
#include "EditorStats.h"
@@ -52,8 +52,8 @@ private:
void OnComponentDelete(EntityWrapper entity, const std::string& componentType);
// Events
EventRelay<EditorSystem, Events::MouseRelease> m_EMouseRelease;
bool OnMouseRelease(const Events::MouseRelease& e);
EventRelay<EditorSystem, Events::MousePress> m_EMousePress;
bool OnMousePress(const Events::MousePress& e);
EventRelay<EditorSystem, Events::WidgetDelta> m_EWidgetDelta;
bool OnWidgetDelta(const Events::WidgetDelta& e);
};
+4 -3
View File
@@ -31,7 +31,7 @@ EditorSystem::EditorSystem(World* world, EventBroker* eventBroker, IRenderer* re
m_EditorGUI->SetComponentDeleteCallback(std::bind(&EditorSystem::OnComponentDelete, this, std::placeholders::_1, std::placeholders::_2));
m_EditorGUI->SetWidgetModeCallback(std::bind(&EditorSystem::setWidgetMode, this, std::placeholders::_1));
EVENT_SUBSCRIBE_MEMBER(m_EMouseRelease, &EditorSystem::OnMouseRelease);
EVENT_SUBSCRIBE_MEMBER(m_EMousePress, &EditorSystem::OnMousePress);
EVENT_SUBSCRIBE_MEMBER(m_EWidgetDelta, &EditorSystem::OnWidgetDelta);
m_EditorStats = new EditorStats();
@@ -121,9 +121,10 @@ void EditorSystem::OnComponentDelete(EntityWrapper entity, const std::string& co
}
}
bool EditorSystem::OnMouseRelease(const Events::MouseRelease& e)
bool EditorSystem::OnMousePress(const Events::MousePress& e)
{
if (e.Button == GLFW_MOUSE_BUTTON_1) {
ImGuiIO& io = ImGui::GetIO();
if (!io.WantCaptureMouse && !io.WantCaptureKeyboard && e.Button == GLFW_MOUSE_BUTTON_1) {
PickData pick = m_Renderer->Pick(glm::vec2(e.X, e.Y));
if (pick.World == m_World) {
m_CurrentSelection = EntityWrapper(m_World, pick.Entity);
+2 -1
View File
@@ -58,7 +58,8 @@ bool EditorWidgetSystem::OnMouseMove(const Events::MouseMove& e)
bool EditorWidgetSystem::OnMousePress(const Events::MousePress & e)
{
if (e.Button == GLFW_MOUSE_BUTTON_1) {
ImGuiIO& io = ImGui::GetIO();
if (!io.WantCaptureMouse && !io.WantCaptureKeyboard && e.Button == GLFW_MOUSE_BUTTON_1) {
m_PickData = m_Renderer->Pick(glm::vec2(e.X, e.Y));
if (m_PickData.Entity != EntityID_Invalid && m_PickData.World == m_World) {
m_PickEntity = EntityWrapper(m_World, m_PickData.Entity);
+6
View File
@@ -66,6 +66,9 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper
nextPossibleCapturePoint["Blue"] = -1;
for (size_t i = 0; i < m_NumberOfCapturePoints; i++)
{
if (!m_World->HasComponent(m_CapturePointNumberToEntityIDMap[i], "Team")) {
continue;
}
ComponentWrapper& capturePointOwnedBy = m_World->GetComponent(m_CapturePointNumberToEntityIDMap[i], "Team");
if ((int)capturePointOwnedBy["Team"] == redTeam && m_RedTeamHomeCapturePoint == 0) {
nextPossibleCapturePoint["Red"] = i + 1;
@@ -76,6 +79,9 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper
}
for (int i = m_NumberOfCapturePoints - 1; i >= 0; i--)
{
if (!m_World->HasComponent(m_CapturePointNumberToEntityIDMap[i], "Team")) {
continue;
}
ComponentWrapper& capturePointOwnedBy = m_World->GetComponent(m_CapturePointNumberToEntityIDMap[i], "Team");
if ((int)capturePointOwnedBy["Team"] == redTeam && m_RedTeamHomeCapturePoint != 0) {
nextPossibleCapturePoint["Red"] = i - 1;