Entity is now sent with the click events.
Fixed small things
This commit is contained in:
@@ -7,7 +7,8 @@ namespace Events
|
||||
{
|
||||
|
||||
struct ButtonClicked : public Event {
|
||||
std::string EntityName = "DEFAULT STRING USED";
|
||||
std::string EntityName;
|
||||
EntityWrapper Entity;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ namespace Events
|
||||
{
|
||||
|
||||
struct ButtonPressed : public Event {
|
||||
std::string EntityName = "DEFAULT STRING USED";
|
||||
std::string EntityName;
|
||||
EntityWrapper Entity;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct ButtonReleased : public Event { };
|
||||
struct ButtonReleased : public Event {
|
||||
EntityWrapper Entity;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ struct ModelJob : RenderJob
|
||||
EndIndex = matGroup->EndIndex;
|
||||
Matrix = matrix;
|
||||
Color = modelComponent["Color"];
|
||||
GlowIntencity = ((double)modelComponent["GlowIntensity"]);
|
||||
GlowIntensity = ((double)modelComponent["GlowIntensity"]);
|
||||
Entity = modelComponent.EntityID;
|
||||
glm::vec3 abspos = Transform::AbsolutePosition(world, modelComponent.EntityID);
|
||||
glm::vec3 worldpos = glm::vec3(camera->ViewMatrix() * glm::vec4(abspos, 1));
|
||||
@@ -171,7 +171,7 @@ struct ModelJob : RenderJob
|
||||
::Skeleton::AnimationOffset AnimationOffset;
|
||||
|
||||
|
||||
float GlowIntencity = 8.0;
|
||||
float GlowIntensity = 8.0;
|
||||
glm::vec4 DiffuseColor;
|
||||
glm::vec4 SpecularColor;
|
||||
glm::vec4 IncandescenceColor;
|
||||
|
||||
@@ -38,6 +38,7 @@ bool ButtonSystem::OnMousePress(const Events::MousePress& e)
|
||||
|
||||
//You have clicked on a button entity, send pressed event.
|
||||
Events::ButtonPressed ePressed;
|
||||
ePressed.Entity = m_PickEntity;
|
||||
ePressed.EntityName = m_PickEntity.Name();
|
||||
m_EventBroker->Publish(ePressed);
|
||||
}
|
||||
@@ -50,15 +51,19 @@ bool ButtonSystem::OnMouseRelease(const Events::MouseRelease& e)
|
||||
{
|
||||
if(!m_MouseIsLocked) {
|
||||
//Mouse is not locked, send release event.
|
||||
Events::ButtonReleased eReleased;
|
||||
m_EventBroker->Publish(eReleased);
|
||||
m_PickData = m_Renderer->Pick(glm::vec2(e.X, e.Y));
|
||||
if(m_PickData.Entity != EntityID_Invalid && m_PickData.World == m_World) {
|
||||
EntityWrapper ent = EntityWrapper(m_World, m_PickData.Entity);
|
||||
|
||||
Events::ButtonReleased eReleased;
|
||||
eReleased.Entity = ent;
|
||||
m_EventBroker->Publish(eReleased);
|
||||
|
||||
if(m_World->HasComponent(m_PickData.Entity, "Button")) {
|
||||
EntityWrapper ent = EntityWrapper(m_World, m_PickData.Entity);
|
||||
if (ent == m_PickEntity) {
|
||||
//The entity you released the mouse button on is the same as you pressed it on. "Clicked"
|
||||
Events::ButtonClicked eClicked;
|
||||
eClicked.Entity = m_PickEntity;
|
||||
eClicked.EntityName = m_PickEntity.Name();
|
||||
m_EventBroker->Publish(eClicked);
|
||||
}
|
||||
|
||||
@@ -736,7 +736,7 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
|
||||
GLERROR("Bind 19 uniform");
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor));
|
||||
GLERROR("Bind 20 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "GlowIntensity"), job->GlowIntencity);
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "GlowIntensity"), job->GlowIntensity);
|
||||
GLERROR("END");
|
||||
}
|
||||
|
||||
@@ -775,7 +775,7 @@ void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptr<Model
|
||||
GLERROR("Bind 10 uniform");
|
||||
GLint Location_GlowIntensity = glGetUniformLocation(shaderHandle, "GlowIntensity");
|
||||
|
||||
glUniform1f(Location_GlowIntensity, job->GlowIntencity);
|
||||
glUniform1f(Location_GlowIntensity, job->GlowIntensity);
|
||||
|
||||
GLERROR("END");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user