Refactored Math::Point in CSettings, CParticle, CPyro, CInterface, CMainUserInterface and CScreen

dev
Tomasz Kapuściński 2021-12-24 03:45:59 +01:00
parent a806bb2657
commit 3fabdad1fe
10 changed files with 118 additions and 116 deletions

View File

@ -43,12 +43,12 @@ CSettings::CSettings()
m_focusLostMute = true; m_focusLostMute = true;
m_fontSize = 19.0f; m_fontSize = 19.0f;
m_windowPos = Math::Point(0.15f, 0.17f); m_windowPos = { 0.15f, 0.17f };
m_windowDim = Math::Point(0.70f, 0.66f); m_windowDim = { 0.70f, 0.66f };
m_windowMax = false; m_windowMax = false;
m_IOPublic = false; m_IOPublic = false;
m_IODim = Math::Point(320.0f / 640.0f, (121.0f + 18.0f * 8) / 480.0f); m_IODim = { 320.0f / 640.0f, (121.0f + 18.0f * 8) / 480.0f };
m_IOPos.x = (1.0f - m_IODim.x) / 2.0f; // in the middle m_IOPos.x = (1.0f - m_IODim.x) / 2.0f; // in the middle
m_IOPos.y = (1.0f - m_IODim.y) / 2.0f; m_IOPos.y = (1.0f - m_IODim.y) / 2.0f;
@ -396,7 +396,7 @@ float CSettings::GetFontSize()
return m_fontSize; return m_fontSize;
} }
void CSettings::SetWindowPos(Math::Point pos) void CSettings::SetWindowPos(const glm::vec2& pos)
{ {
m_windowPos = pos; m_windowPos = pos;
GetConfigFile().SetFloatProperty("Edit", "WindowPosX", m_windowPos.x); GetConfigFile().SetFloatProperty("Edit", "WindowPosX", m_windowPos.x);
@ -404,12 +404,12 @@ void CSettings::SetWindowPos(Math::Point pos)
GetConfigFile().Save(); GetConfigFile().Save();
} }
Math::Point CSettings::GetWindowPos() glm::vec2 CSettings::GetWindowPos()
{ {
return m_windowPos; return m_windowPos;
} }
void CSettings::SetWindowDim(Math::Point dim) void CSettings::SetWindowDim(const glm::vec2& dim)
{ {
m_windowDim = dim; m_windowDim = dim;
GetConfigFile().SetFloatProperty("Edit", "WindowDimX", m_windowDim.x); GetConfigFile().SetFloatProperty("Edit", "WindowDimX", m_windowDim.x);
@ -417,7 +417,7 @@ void CSettings::SetWindowDim(Math::Point dim)
GetConfigFile().Save(); GetConfigFile().Save();
} }
Math::Point CSettings::GetWindowDim() glm::vec2 CSettings::GetWindowDim()
{ {
return m_windowDim; return m_windowDim;
} }
@ -446,7 +446,7 @@ bool CSettings::GetIOPublic()
return m_IOPublic; return m_IOPublic;
} }
void CSettings::SetIOPos(Math::Point pos) void CSettings::SetIOPos(const glm::vec2& pos)
{ {
m_IOPos = pos; m_IOPos = pos;
GetConfigFile().SetFloatProperty("Edit", "IOPosX", m_IOPos.x); GetConfigFile().SetFloatProperty("Edit", "IOPosX", m_IOPos.x);
@ -454,12 +454,12 @@ void CSettings::SetIOPos(Math::Point pos)
GetConfigFile().Save(); GetConfigFile().Save();
} }
Math::Point CSettings::GetIOPos() glm::vec2 CSettings::GetIOPos()
{ {
return m_IOPos; return m_IOPos;
} }
void CSettings::SetIODim(Math::Point dim) void CSettings::SetIODim(const glm::vec2& dim)
{ {
m_IODim = dim; m_IODim = dim;
GetConfigFile().SetFloatProperty("Edit", "IODimX", m_IODim.x); GetConfigFile().SetFloatProperty("Edit", "IODimX", m_IODim.x);
@ -467,7 +467,7 @@ void CSettings::SetIODim(Math::Point dim)
GetConfigFile().Save(); GetConfigFile().Save();
} }
Math::Point CSettings::GetIODim() glm::vec2 CSettings::GetIODim()
{ {
return m_IODim; return m_IODim;
} }

View File

@ -22,7 +22,7 @@
#include "common/language.h" #include "common/language.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "math/point.h" #include <glm/glm.hpp>
namespace Gfx namespace Gfx
{ {
@ -68,11 +68,11 @@ public:
//! Managing the size of the default window //! Managing the size of the default window
//@{ //@{
void SetWindowPos(Math::Point pos); void SetWindowPos(const glm::vec2& pos);
Math::Point GetWindowPos(); glm::vec2 GetWindowPos();
void SetWindowDim(Math::Point dim); void SetWindowDim(const glm::vec2& dim);
Math::Point GetWindowDim(); glm::vec2 GetWindowDim();
void SetWindowMax(bool max); void SetWindowMax(bool max);
bool GetWindowMax(); bool GetWindowMax();
@ -83,11 +83,11 @@ public:
void SetIOPublic(bool mode); void SetIOPublic(bool mode);
bool GetIOPublic(); bool GetIOPublic();
void SetIOPos(Math::Point pos); void SetIOPos(const glm::vec2& pos);
Math::Point GetIOPos(); glm::vec2 GetIOPos();
void SetIODim(Math::Point dim); void SetIODim(const glm::vec2& dim);
Math::Point GetIODim(); glm::vec2 GetIODim();
//@} //@}
void SetLanguage(Language language); void SetLanguage(Language language);
@ -103,13 +103,13 @@ protected:
bool m_focusLostMute; bool m_focusLostMute;
float m_fontSize; float m_fontSize;
Math::Point m_windowPos; glm::vec2 m_windowPos;
Math::Point m_windowDim; glm::vec2 m_windowDim;
bool m_windowMax; bool m_windowMax;
bool m_IOPublic; bool m_IOPublic;
Math::Point m_IOPos; glm::vec2 m_IOPos;
Math::Point m_IODim; glm::vec2 m_IODim;
Language m_language; Language m_language;
}; };

View File

@ -2716,7 +2716,7 @@ void CParticle::DrawParticleNorm(int i)
Math::Vector n(0.0f, 0.0f, -1.0f); Math::Vector n(0.0f, 0.0f, -1.0f);
Math::Point dim; glm::vec2 dim;
dim.x = m_particle[i].dim.x * zoom; dim.x = m_particle[i].dim.x * zoom;
dim.y = m_particle[i].dim.y * zoom; dim.y = m_particle[i].dim.y * zoom;
@ -2767,7 +2767,7 @@ void CParticle::DrawParticleNorm(int i)
Math::Vector n(0.0f, 0.0f, -1.0f); Math::Vector n(0.0f, 0.0f, -1.0f);
Math::Point dim; glm::vec2 dim;
dim.x = m_particle[i].dim.x * zoom; dim.x = m_particle[i].dim.x * zoom;
dim.y = m_particle[i].dim.y * zoom; dim.y = m_particle[i].dim.y * zoom;
@ -2829,7 +2829,7 @@ void CParticle::DrawParticleFlat(int i)
Math::Vector n(0.0f, 0.0f, -1.0f); Math::Vector n(0.0f, 0.0f, -1.0f);
Math::Point dim; glm::vec2 dim;
dim.x = m_particle[i].dim.x * m_particle[i].zoom; dim.x = m_particle[i].dim.x * m_particle[i].zoom;
dim.y = m_particle[i].dim.y * m_particle[i].zoom; dim.y = m_particle[i].dim.y * m_particle[i].zoom;
@ -2867,11 +2867,11 @@ void CParticle::DrawParticleFog(int i)
Math::Vector pos = m_particle[i].pos; Math::Vector pos = m_particle[i].pos;
Math::Point dim; glm::vec2 dim;
dim.x = m_particle[i].dim.x; dim.x = m_particle[i].dim.x;
dim.y = m_particle[i].dim.y; dim.y = m_particle[i].dim.y;
Math::Point zoom; glm::vec2 zoom;
if ( m_particle[i].type == PARTIFOG0 || if ( m_particle[i].type == PARTIFOG0 ||
m_particle[i].type == PARTIFOG2 || m_particle[i].type == PARTIFOG2 ||
@ -2979,7 +2979,7 @@ void CParticle::DrawParticleRay(int i)
Math::Vector n(0.0f, 0.0f, left ? 1.0f : -1.0f); Math::Vector n(0.0f, 0.0f, left ? 1.0f : -1.0f);
Math::Point dim; glm::vec2 dim;
dim.x = m_particle[i].dim.x * m_particle[i].zoom; dim.x = m_particle[i].dim.x * m_particle[i].zoom;
dim.y = m_particle[i].dim.y * m_particle[i].zoom; dim.y = m_particle[i].dim.y * m_particle[i].zoom;
@ -3080,8 +3080,8 @@ void CParticle::DrawParticleRay(int i)
if (rank >= first && rank <= last) if (rank >= first && rank <= last)
{ {
Math::Point texInf = m_particle[i].texInf; glm::vec2 texInf = m_particle[i].texInf;
Math::Point texSup = m_particle[i].texSup; glm::vec2 texSup = m_particle[i].texSup;
int r = rand() % 16; int r = rand() % 16;
texInf.x += 0.25f*(r/4); texInf.x += 0.25f*(r/4);
@ -3135,7 +3135,7 @@ void CParticle::DrawParticleSphere(int i)
m_device->SetTransform(TRANSFORM_WORLD, mat); m_device->SetTransform(TRANSFORM_WORLD, mat);
Math::Point ts, ti; glm::vec2 ts, ti;
ts.x = m_particle[i].texSup.x; ts.x = m_particle[i].texSup.x;
ts.y = m_particle[i].texSup.y; ts.y = m_particle[i].texSup.y;
ti.x = m_particle[i].texInf.x; ti.x = m_particle[i].texInf.x;
@ -3232,7 +3232,7 @@ void CParticle::DrawParticleCylinder(int i)
mat.Set(3, 4, m_particle[i].pos.z); mat.Set(3, 4, m_particle[i].pos.z);
m_device->SetTransform(TRANSFORM_WORLD, mat); m_device->SetTransform(TRANSFORM_WORLD, mat);
Math::Point ts, ti; glm::vec2 ts, ti;
ts.x = m_particle[i].texSup.x; ts.x = m_particle[i].texSup.x;
ts.y = m_particle[i].texSup.y; ts.y = m_particle[i].texSup.y;
ti.x = m_particle[i].texInf.x; ti.x = m_particle[i].texInf.x;
@ -3334,8 +3334,8 @@ void CParticle::DrawParticleWheel(int i)
Math::Vector n(0.0f, 1.0f, 0.0f); Math::Vector n(0.0f, 1.0f, 0.0f);
Math::Point ts(160.0f/256.0f, 224.0f/256.0f); glm::vec2 ts(160.0f/256.0f, 224.0f/256.0f);
Math::Point ti(ts.x+16.0f/256.0f, ts.y+16.0f/256.0f); glm::vec2 ti(ts.x+16.0f/256.0f, ts.y+16.0f/256.0f);
float dp = (1.0f/256.0f)/2.0f; float dp = (1.0f/256.0f)/2.0f;
ts.x = ts.x+dp; ts.x = ts.x+dp;

View File

@ -502,7 +502,7 @@ bool CPyro::Create(PyroType type, CObject* obj, float force)
speed.x = (Math::Rand()-0.5f)*30.0f; speed.x = (Math::Rand()-0.5f)*30.0f;
speed.z = (Math::Rand()-0.5f)*30.0f; speed.z = (Math::Rand()-0.5f)*30.0f;
speed.y = Math::Rand()*30.0f; speed.y = Math::Rand()*30.0f;
Math::Point dim; glm::vec2 dim;
dim.x = 1.0f; dim.x = 1.0f;
dim.y = dim.x; dim.y = dim.x;
float duration = Math::Rand()*3.0f+2.0f; float duration = Math::Rand()*3.0f+2.0f;
@ -524,7 +524,7 @@ bool CPyro::Create(PyroType type, CObject* obj, float force)
m_terrain->AdjustToFloor(pos); m_terrain->AdjustToFloor(pos);
pos.y += 1.0f; pos.y += 1.0f;
} }
Math::Point dim; glm::vec2 dim;
dim.x = m_size*0.4f; dim.x = m_size*0.4f;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, Math::Vector(0.0f,0.0f,0.0f), dim, PARTISPHERE0, 2.0f, 0.0f, 0.0f); m_particle->CreateParticle(pos, Math::Vector(0.0f,0.0f,0.0f), dim, PARTISPHERE0, 2.0f, 0.0f, 0.0f);
@ -542,7 +542,7 @@ bool CPyro::Create(PyroType type, CObject* obj, float force)
speed.x = (Math::Rand()-0.5f)*30.0f; speed.x = (Math::Rand()-0.5f)*30.0f;
speed.z = (Math::Rand()-0.5f)*30.0f; speed.z = (Math::Rand()-0.5f)*30.0f;
speed.y = Math::Rand()*50.0f; speed.y = Math::Rand()*50.0f;
Math::Point dim; glm::vec2 dim;
dim.x = 1.0f; dim.x = 1.0f;
dim.y = dim.x; dim.y = dim.x;
float duration = Math::Rand()*1.0f+0.8f; float duration = Math::Rand()*1.0f+0.8f;
@ -558,7 +558,7 @@ bool CPyro::Create(PyroType type, CObject* obj, float force)
speed.x = (Math::Rand()-0.5f)*30.0f; speed.x = (Math::Rand()-0.5f)*30.0f;
speed.z = (Math::Rand()-0.5f)*30.0f; speed.z = (Math::Rand()-0.5f)*30.0f;
speed.y = Math::Rand()*50.0f; speed.y = Math::Rand()*50.0f;
Math::Point dim; glm::vec2 dim;
dim.x = 1.0f; dim.x = 1.0f;
dim.y = dim.x; dim.y = dim.x;
float duration = Math::Rand()*2.0f+1.4f; float duration = Math::Rand()*2.0f+1.4f;
@ -580,7 +580,7 @@ bool CPyro::Create(PyroType type, CObject* obj, float force)
speed.x = (Math::Rand()-0.5f)*24.0f; speed.x = (Math::Rand()-0.5f)*24.0f;
speed.z = (Math::Rand()-0.5f)*24.0f; speed.z = (Math::Rand()-0.5f)*24.0f;
speed.y = 10.0f+Math::Rand()*10.0f; speed.y = 10.0f+Math::Rand()*10.0f;
Math::Point dim; glm::vec2 dim;
dim.x = 1.0f; dim.x = 1.0f;
dim.y = dim.x; dim.y = dim.x;
int channel = m_particle->CreateParticle(pos, speed, dim, PARTIGUN3, 2.0f+Math::Rand()*2.0f, 10.0f); int channel = m_particle->CreateParticle(pos, speed, dim, PARTIGUN3, 2.0f+Math::Rand()*2.0f, 10.0f);
@ -597,7 +597,7 @@ bool CPyro::Create(PyroType type, CObject* obj, float force)
speed.x = (Math::Rand()-0.5f)*24.0f; speed.x = (Math::Rand()-0.5f)*24.0f;
speed.z = (Math::Rand()-0.5f)*24.0f; speed.z = (Math::Rand()-0.5f)*24.0f;
speed.y = 7.0f+Math::Rand()*7.0f; speed.y = 7.0f+Math::Rand()*7.0f;
Math::Point dim; glm::vec2 dim;
dim.x = 1.0f; dim.x = 1.0f;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateTrack(pos, speed, dim, PARTITRACK3, m_particle->CreateTrack(pos, speed, dim, PARTITRACK3,
@ -614,7 +614,7 @@ bool CPyro::Create(PyroType type, CObject* obj, float force)
{ {
pos = m_pos; pos = m_pos;
Math::Vector speed(0.0f, 0.0f, 0.0f); Math::Vector speed(0.0f, 0.0f, 0.0f);
Math::Point dim; glm::vec2 dim;
dim.x = m_size; dim.x = m_size;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTICHOC, 2.0f); m_particle->CreateParticle(pos, speed, dim, PARTICHOC, 2.0f);
@ -660,7 +660,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*radius*0.5f; speed.x = (Math::Rand()-0.5f)*radius*0.5f;
speed.z = (Math::Rand()-0.5f)*radius*0.5f; speed.z = (Math::Rand()-0.5f)*radius*0.5f;
speed.y = Math::Rand()*radius*1.0f; speed.y = Math::Rand()*radius*1.0f;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*radius*0.5f+radius*0.75f*m_force; dim.x = Math::Rand()*radius*0.5f+radius*0.75f*m_force;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTISMOKE1, 3.0f); m_particle->CreateParticle(pos, speed, dim, PARTISMOKE1, 3.0f);
@ -674,7 +674,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*m_size*0.1f; speed.x = (Math::Rand()-0.5f)*m_size*0.1f;
speed.z = (Math::Rand()-0.5f)*m_size*0.1f; speed.z = (Math::Rand()-0.5f)*m_size*0.1f;
speed.y = Math::Rand()*m_size*0.2f; speed.y = Math::Rand()*m_size*0.2f;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*m_size/10.0f+m_size/10.0f*m_force; dim.x = Math::Rand()*m_size/10.0f+m_size/10.0f*m_force;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTISMOKE1, 3.0f); m_particle->CreateParticle(pos, speed, dim, PARTISMOKE1, 3.0f);
@ -696,7 +696,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*5.0f; speed.x = (Math::Rand()-0.5f)*5.0f;
speed.z = (Math::Rand()-0.5f)*5.0f; speed.z = (Math::Rand()-0.5f)*5.0f;
speed.y = Math::Rand()*1.0f; speed.y = Math::Rand()*1.0f;
Math::Point dim; glm::vec2 dim;
dim.x = 1.0f; dim.x = 1.0f;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTIBLOOD, Math::Rand()*3.0f+3.0f, Math::Rand()*10.0f+15.0f, 0.5f); m_particle->CreateParticle(pos, speed, dim, PARTIBLOOD, Math::Rand()*3.0f+3.0f, Math::Rand()*10.0f+15.0f, 0.5f);
@ -719,7 +719,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*40.0f; speed.x = (Math::Rand()-0.5f)*40.0f;
speed.z = (Math::Rand()-0.5f)*40.0f; speed.z = (Math::Rand()-0.5f)*40.0f;
speed.y = Math::Rand()*40.0f; speed.y = Math::Rand()*40.0f;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*8.0f+8.0f*m_force; dim.x = Math::Rand()*8.0f+8.0f*m_force;
dim.y = dim.x; dim.y = dim.x;
@ -743,7 +743,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*radius*0.5f; speed.x = (Math::Rand()-0.5f)*radius*0.5f;
speed.z = (Math::Rand()-0.5f)*radius*0.5f; speed.z = (Math::Rand()-0.5f)*radius*0.5f;
speed.y = Math::Rand()*radius*1.0f; speed.y = Math::Rand()*radius*1.0f;
Math::Point dim; glm::vec2 dim;
dim.x = 1.0f*m_force; dim.x = 1.0f*m_force;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTIBLITZ, 0.5f, 0.0f, 0.0f); m_particle->CreateParticle(pos, speed, dim, PARTIBLITZ, 0.5f, 0.0f, 0.0f);
@ -757,7 +757,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*m_size*0.1f; speed.x = (Math::Rand()-0.5f)*m_size*0.1f;
speed.z = (Math::Rand()-0.5f)*m_size*0.1f; speed.z = (Math::Rand()-0.5f)*m_size*0.1f;
speed.y = Math::Rand()*m_size*0.2f; speed.y = Math::Rand()*m_size*0.2f;
Math::Point dim; glm::vec2 dim;
dim.x = 1.0f*m_force; dim.x = 1.0f*m_force;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTIBLITZ, 0.5f, 0.0f, 0.0f); m_particle->CreateParticle(pos, speed, dim, PARTIBLITZ, 0.5f, 0.0f, 0.0f);
@ -777,7 +777,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = 0.0f; speed.x = 0.0f;
speed.z = 0.0f; speed.z = 0.0f;
speed.y = 10.0f+Math::Rand()*10.0f; speed.y = 10.0f+Math::Rand()*10.0f;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*2.5f+2.0f*m_force; dim.x = Math::Rand()*2.5f+2.0f*m_force;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTICRASH, 4.0f); m_particle->CreateParticle(pos, speed, dim, PARTICRASH, 4.0f);
@ -794,7 +794,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*m_size*1.0f; speed.x = (Math::Rand()-0.5f)*m_size*1.0f;
speed.z = (Math::Rand()-0.5f)*m_size*1.0f; speed.z = (Math::Rand()-0.5f)*m_size*1.0f;
speed.y = Math::Rand()*m_size*0.50f; speed.y = Math::Rand()*m_size*0.50f;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*m_size/5.0f+m_size/5.0f; dim.x = Math::Rand()*m_size/5.0f+m_size/5.0f;
dim.y = dim.x; dim.y = dim.x;
@ -807,7 +807,7 @@ bool CPyro::EventProcess(const Event &event)
{ {
m_lastParticleSmoke = m_time; m_lastParticleSmoke = m_time;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*m_size/3.0f+m_size/3.0f; dim.x = Math::Rand()*m_size/3.0f+m_size/3.0f;
dim.y = dim.x; dim.y = dim.x;
Math::Vector pos = m_pos; Math::Vector pos = m_pos;
@ -838,7 +838,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*m_size*2.0f; speed.x = (Math::Rand()-0.5f)*m_size*2.0f;
speed.z = (Math::Rand()-0.5f)*m_size*2.0f; speed.z = (Math::Rand()-0.5f)*m_size*2.0f;
speed.y = Math::Rand()*m_size*1.0f; speed.y = Math::Rand()*m_size*1.0f;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*m_size/2.0f+m_size/2.0f; dim.x = Math::Rand()*m_size/2.0f+m_size/2.0f;
dim.y = dim.x; dim.y = dim.x;
@ -856,7 +856,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*m_size*1.0f; speed.x = (Math::Rand()-0.5f)*m_size*1.0f;
speed.z = (Math::Rand()-0.5f)*m_size*1.0f; speed.z = (Math::Rand()-0.5f)*m_size*1.0f;
speed.y = Math::Rand()*m_size*0.50f; speed.y = Math::Rand()*m_size*0.50f;
Math::Point dim; glm::vec2 dim;
dim.x = 1.0f; dim.x = 1.0f;
dim.y = dim.x; dim.y = dim.x;
@ -877,7 +877,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = 0.0f; speed.x = 0.0f;
speed.z = 0.0f; speed.z = 0.0f;
speed.y = 4.0f+Math::Rand()*4.0f; speed.y = 4.0f+Math::Rand()*4.0f;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*2.5f+2.0f; dim.x = Math::Rand()*2.5f+2.0f;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTICRASH, 4.0f); m_particle->CreateParticle(pos, speed, dim, PARTICRASH, 4.0f);
@ -904,7 +904,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = 0.0f; speed.x = 0.0f;
speed.z = 0.0f; speed.z = 0.0f;
speed.y = 5.0f+Math::Rand()*5.0f; speed.y = 5.0f+Math::Rand()*5.0f;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*1.5f+1.5f; dim.x = Math::Rand()*1.5f+1.5f;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTIGLINT, 2.0f); m_particle->CreateParticle(pos, speed, dim, PARTIGLINT, 2.0f);
@ -943,7 +943,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*2.0f; speed.x = (Math::Rand()-0.5f)*2.0f;
speed.z = (Math::Rand()-0.5f)*2.0f; speed.z = (Math::Rand()-0.5f)*2.0f;
speed.y = 2.0f+Math::Rand()*2.0f; speed.y = 2.0f+Math::Rand()*2.0f;
Math::Point dim; glm::vec2 dim;
dim.x = (Math::Rand()*1.0f+1.0f)*(0.2f+m_progress*0.8f); dim.x = (Math::Rand()*1.0f+1.0f)*(0.2f+m_progress*0.8f);
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.0f); m_particle->CreateParticle(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.0f);
@ -974,7 +974,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*2.0f; speed.x = (Math::Rand()-0.5f)*2.0f;
speed.z = (Math::Rand()-0.5f)*2.0f; speed.z = (Math::Rand()-0.5f)*2.0f;
speed.y = 2.0f+Math::Rand()*2.0f; speed.y = 2.0f+Math::Rand()*2.0f;
Math::Point dim; glm::vec2 dim;
dim.x = (Math::Rand()*1.0f+1.0f)*(0.2f+m_progress*0.8f); dim.x = (Math::Rand()*1.0f+1.0f)*(0.2f+m_progress*0.8f);
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.5f); m_particle->CreateParticle(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.5f);
@ -1005,7 +1005,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = 0.0f; speed.x = 0.0f;
speed.z = 0.0f; speed.z = 0.0f;
speed.y = 5.0f+Math::Rand()*5.0f; speed.y = 5.0f+Math::Rand()*5.0f;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*2.0f+2.0f; dim.x = Math::Rand()*2.0f+2.0f;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTIGLINTb, 2.0f); m_particle->CreateParticle(pos, speed, dim, PARTIGLINTb, 2.0f);
@ -1050,7 +1050,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*2.0f; speed.x = (Math::Rand()-0.5f)*2.0f;
speed.z = (Math::Rand()-0.5f)*2.0f; speed.z = (Math::Rand()-0.5f)*2.0f;
speed.y = 4.0f+Math::Rand()*4.0f; speed.y = 4.0f+Math::Rand()*4.0f;
Math::Point dim; glm::vec2 dim;
dim.x = (Math::Rand()*3.0f+3.0f)*(1.0f-m_progress*0.9f); dim.x = (Math::Rand()*3.0f+3.0f)*(1.0f-m_progress*0.9f);
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.5f); m_particle->CreateParticle(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.5f);
@ -1079,7 +1079,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = 0.0f; speed.x = 0.0f;
speed.z = 0.0f; speed.z = 0.0f;
speed.y = 0.0f; speed.y = 0.0f;
Math::Point dim; glm::vec2 dim;
dim.x = (Math::Rand()*2.5f+1.0f)*factor; dim.x = (Math::Rand()*2.5f+1.0f)*factor;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTIFLAME, 2.0f, 0.0f, 0.2f); m_particle->CreateParticle(pos, speed, dim, PARTIFLAME, 2.0f, 0.0f, 0.2f);
@ -1140,7 +1140,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = (Math::Rand()-0.5f)*10.0f; speed.x = (Math::Rand()-0.5f)*10.0f;
speed.z = (Math::Rand()-0.5f)*10.0f; speed.z = (Math::Rand()-0.5f)*10.0f;
speed.y = 8.0f+Math::Rand()*8.0f; speed.y = 8.0f+Math::Rand()*8.0f;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*0.2f+0.2f; dim.x = Math::Rand()*0.2f+0.2f;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateTrack(pos, speed, dim, m_particle->CreateTrack(pos, speed, dim,
@ -1164,7 +1164,7 @@ bool CPyro::EventProcess(const Event &event)
speed.x = 0.0f; speed.x = 0.0f;
speed.z = 0.0f; speed.z = 0.0f;
speed.y = 1.0f+Math::Rand()*1.0f; speed.y = 1.0f+Math::Rand()*1.0f;
Math::Point dim; glm::vec2 dim;
dim.x = Math::Rand()*1.0f+1.0f; dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTISMOKE1, 8.0f, 0.0f, 0.0f); m_particle->CreateParticle(pos, speed, dim, PARTISMOKE1, 8.0f, 0.0f, 0.0f);
@ -2368,7 +2368,7 @@ void CPyro::FallProgress(float rTime)
if (obj->GetType() == OBJECT_MOBILErs && dynamic_cast<CShielder&>(*obj).GetActiveShieldRadius() > 0.0f) // protected by shield? if (obj->GetType() == OBJECT_MOBILErs && dynamic_cast<CShielder&>(*obj).GetActiveShieldRadius() > 0.0f) // protected by shield?
{ {
m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f),
Math::Point(6.0f, 6.0f), PARTIGUNDEL, 2.0f, 0.0f, 0.0f); { 6.0f, 6.0f }, PARTIGUNDEL, 2.0f, 0.0f, 0.0f);
m_sound->Play(SOUND_GUNDEL); m_sound->Play(SOUND_GUNDEL);
DeleteObject(true, true); // removes the ball DeleteObject(true, true); // removes the ball

View File

@ -84,7 +84,7 @@ int CInterface::GetNextFreeControl()
} }
template <typename ControlClass> template <typename ControlClass>
ControlClass* CInterface::CreateControl(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) ControlClass* CInterface::CreateControl(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
if (eventMsg == EVENT_NULL) if (eventMsg == EVENT_NULL)
eventMsg = GetUniqueEventType(); eventMsg = GetUniqueEventType();
@ -103,7 +103,7 @@ ControlClass* CInterface::CreateControl(Math::Point pos, Math::Point dim, int ic
// Creates a new button. // Creates a new button.
CWindow* CInterface::CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CWindow* CInterface::CreateWindows(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
if (eventMsg == EVENT_NULL) if (eventMsg == EVENT_NULL)
eventMsg = GetUniqueEventType(); eventMsg = GetUniqueEventType();
@ -137,49 +137,49 @@ CWindow* CInterface::CreateWindows(Math::Point pos, Math::Point dim, int icon, E
// Creates a new button. // Creates a new button.
CButton* CInterface::CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CButton* CInterface::CreateButton(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CButton>(pos, dim, icon, eventMsg); return CreateControl<CButton>(pos, dim, icon, eventMsg);
} }
// Creates a new button. // Creates a new button.
CColor* CInterface::CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CColor* CInterface::CreateColor(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CColor>(pos, dim, icon, eventMsg); return CreateControl<CColor>(pos, dim, icon, eventMsg);
} }
// Creates a new button. // Creates a new button.
CCheck* CInterface::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CCheck* CInterface::CreateCheck(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CCheck>(pos, dim, icon, eventMsg); return CreateControl<CCheck>(pos, dim, icon, eventMsg);
} }
// Creates a new button. // Creates a new button.
CKey* CInterface::CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CKey* CInterface::CreateKey(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CKey>(pos, dim, icon, eventMsg); return CreateControl<CKey>(pos, dim, icon, eventMsg);
} }
// Creates a new button. // Creates a new button.
CGroup* CInterface::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CGroup* CInterface::CreateGroup(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CGroup>(pos, dim, icon, eventMsg); return CreateControl<CGroup>(pos, dim, icon, eventMsg);
} }
// Creates a new button. // Creates a new button.
CImage* CInterface::CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CImage* CInterface::CreateImage(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CImage>(pos, dim, icon, eventMsg); return CreateControl<CImage>(pos, dim, icon, eventMsg);
} }
// Creates a new label. // Creates a new label.
CLabel* CInterface::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, std::string name) CLabel* CInterface::CreateLabel(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg, std::string name)
{ {
CLabel* pc = CreateControl<CLabel>(pos, dim, icon, eventMsg); CLabel* pc = CreateControl<CLabel>(pos, dim, icon, eventMsg);
if (pc != nullptr) if (pc != nullptr)
@ -189,13 +189,13 @@ CLabel* CInterface::CreateLabel(Math::Point pos, Math::Point dim, int icon, Even
// Creates a new pave editable. // Creates a new pave editable.
CEdit* CInterface::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CEdit* CInterface::CreateEdit(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CEdit>(pos, dim, icon, eventMsg); return CreateControl<CEdit>(pos, dim, icon, eventMsg);
} }
// Creates a new editable area. // Creates a new editable area.
CEditValue* CInterface::CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CEditValue* CInterface::CreateEditValue(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
CEditValue* ev = CreateControl<CEditValue>(pos, dim, icon, eventMsg); CEditValue* ev = CreateControl<CEditValue>(pos, dim, icon, eventMsg);
ev->SetInterface(this); ev->SetInterface(this);
@ -204,19 +204,19 @@ CEditValue* CInterface::CreateEditValue(Math::Point pos, Math::Point dim, int ic
// Creates a new lift. // Creates a new lift.
CScroll* CInterface::CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CScroll* CInterface::CreateScroll(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CScroll>(pos, dim, icon, eventMsg); return CreateControl<CScroll>(pos, dim, icon, eventMsg);
} }
// Creates a new cursor. // Creates a new cursor.
CSlider* CInterface::CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CSlider* CInterface::CreateSlider(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CSlider>(pos, dim, icon, eventMsg); return CreateControl<CSlider>(pos, dim, icon, eventMsg);
} }
CEnumSlider* CInterface::CreateEnumSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CEnumSlider* CInterface::CreateEnumSlider(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CEnumSlider>(pos, dim, icon, eventMsg); return CreateControl<CEnumSlider>(pos, dim, icon, eventMsg);
} }
@ -226,7 +226,7 @@ CEnumSlider* CInterface::CreateEnumSlider(Math::Point pos, Math::Point dim, int
// and try to scale items to some size, so that dim of the list would not change after // and try to scale items to some size, so that dim of the list would not change after
// adjusting // adjusting
CList* CInterface::CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand) CList* CInterface::CreateList(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg, float expand)
{ {
if (eventMsg == EVENT_NULL) if (eventMsg == EVENT_NULL)
eventMsg = GetUniqueEventType(); eventMsg = GetUniqueEventType();
@ -244,21 +244,21 @@ CList* CInterface::CreateList(Math::Point pos, Math::Point dim, int icon, EventT
// Creates a new shortcut. // Creates a new shortcut.
CShortcut* CInterface::CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CShortcut* CInterface::CreateShortcut(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CShortcut>(pos, dim, icon, eventMsg); return CreateControl<CShortcut>(pos, dim, icon, eventMsg);
} }
// Creates a new target. // Creates a new target.
CTarget* CInterface::CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CTarget* CInterface::CreateTarget(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CTarget>(pos, dim, icon, eventMsg); return CreateControl<CTarget>(pos, dim, icon, eventMsg);
} }
// Creates a new map. // Creates a new map.
CMap* CInterface::CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) CMap* CInterface::CreateMap(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
return CreateControl<CMap>(pos, dim, icon, eventMsg); return CreateControl<CMap>(pos, dim, icon, eventMsg);
} }
@ -318,7 +318,7 @@ bool CInterface::EventProcess(const Event &event)
// Gives the tooltip binding to the window. // Gives the tooltip binding to the window.
bool CInterface::GetTooltip(Math::Point pos, std::string &name) bool CInterface::GetTooltip(const glm::vec2& pos, std::string &name)
{ {
for (auto& control : boost::adaptors::reverse(m_controls)) for (auto& control : boost::adaptors::reverse(m_controls))
{ {

View File

@ -21,7 +21,7 @@
#include "common/event.h" #include "common/event.h"
#include "math/point.h" #include <glm/glm.hpp>
#include <array> #include <array>
#include <memory> #include <memory>
@ -63,27 +63,27 @@ public:
~CInterface(); ~CInterface();
bool EventProcess(const Event &event); bool EventProcess(const Event &event);
bool GetTooltip(Math::Point pos, std::string &name); bool GetTooltip(const glm::vec2& pos, std::string &name);
void Flush(); void Flush();
CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CButton* CreateButton(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CColor* CreateColor(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CCheck* CreateCheck(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CKey* CreateKey(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CGroup* CreateGroup(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CImage* CreateImage(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CEdit* CreateEdit(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CEditValue* CreateEditValue(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CScroll* CreateScroll(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CSlider* CreateSlider(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CEnumSlider* CreateEnumSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CEnumSlider* CreateEnumSlider(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CShortcut* CreateShortcut(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CTarget* CreateTarget(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CMap* CreateMap(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CWindow* CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); CWindow* CreateWindows(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand=1.2f); CList* CreateList(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg, float expand=1.2f);
CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, std::string name); CLabel* CreateLabel(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg, std::string name);
bool DeleteControl(EventType eventMsg); bool DeleteControl(EventType eventMsg);
CControl* SearchControl(EventType eventMsg); CControl* SearchControl(EventType eventMsg);
@ -96,7 +96,7 @@ protected:
int GetNextFreeControl(); int GetNextFreeControl();
template <typename ControlClass> template <typename ControlClass>
ControlClass* CreateControl(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); ControlClass* CreateControl(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg);
CEventQueue* m_event; CEventQueue* m_event;
Gfx::CEngine* m_engine; Gfx::CEngine* m_engine;

View File

@ -97,7 +97,7 @@ CMainUserInterface::CMainUserInterface()
m_phase = PHASE_PLAYER_SELECT; m_phase = PHASE_PLAYER_SELECT;
m_glintMouse = Math::Point(0.0f, 0.0f); m_glintMouse = { 0.0f, 0.0f };
m_glintTime = 1000.0f; m_glintTime = 1000.0f;
m_shotDelay = 0; m_shotDelay = 0;
} }
@ -278,7 +278,7 @@ void CMainUserInterface::GlintMove()
{ {
CWindow* pw; CWindow* pw;
CGroup* pg; CGroup* pg;
Math::Point pos, dim, zoom; glm::vec2 pos, dim, zoom;
if ( m_phase == PHASE_SIMUL ) return; if ( m_phase == PHASE_SIMUL ) return;
@ -424,7 +424,7 @@ void CMainUserInterface::GlintMove()
// Returns the position for a sound. // Returns the position for a sound.
static Math::Vector SoundPos(Math::Point pos) static Math::Vector SoundPos(const glm::vec2& pos)
{ {
Math::Vector s; Math::Vector s;
@ -453,7 +453,7 @@ static Math::Vector SoundRand()
void CMainUserInterface::FrameParticle(float rTime) void CMainUserInterface::FrameParticle(float rTime)
{ {
Math::Vector pos, speed; Math::Vector pos, speed;
Math::Point dim; glm::vec2 dim;
float *pParti, *pGlint; float *pParti, *pGlint;
int nParti, nGlint; int nParti, nGlint;
int i, r, ii; int i, r, ii;
@ -728,11 +728,11 @@ void CMainUserInterface::FrameParticle(float rTime)
} }
} }
void CMainUserInterface::CreateMouseParticles(Math::Point mousePosition, bool buttonPressed) void CMainUserInterface::CreateMouseParticles(const glm::vec2& mousePosition, bool buttonPressed)
{ {
if (isAllowedToCreateMouseParticles()) if (isAllowedToCreateMouseParticles())
{ {
m_mouseParticlesGenerator->GenerateMouseParticles(Math::Point(mousePosition.x, mousePosition.y), buttonPressed); m_mouseParticlesGenerator->GenerateMouseParticles({ mousePosition.x, mousePosition.y }, buttonPressed);
} }
} }

View File

@ -23,6 +23,8 @@
#include "ui/particles_generator.h" #include "ui/particles_generator.h"
#include <glm/glm.hpp>
#include <array> #include <array>
#include <string> #include <string>
#include <vector> #include <vector>
@ -97,7 +99,7 @@ public:
protected: protected:
void GlintMove(); void GlintMove();
void FrameParticle(float rTime); void FrameParticle(float rTime);
void CreateMouseParticles(Math::Point mousePosition, bool buttonPressed); void CreateMouseParticles(const glm::vec2& mousePosition, bool buttonPressed);
CScreenSetup* GetSetupScreen(Phase phase); CScreenSetup* GetSetupScreen(Phase phase);
protected: protected:
@ -133,14 +135,14 @@ protected:
int m_shotDelay; // number of frames before copy int m_shotDelay; // number of frames before copy
std::string m_shotName; // generate a file name std::string m_shotName; // generate a file name
Math::Point m_glintMouse; glm::vec2 m_glintMouse;
float m_glintTime; float m_glintTime;
struct Particle struct Particle
{ {
int phase = 0; int phase = 0;
float time = 0.0f; float time = 0.0f;
Math::Point pos; glm::vec2 pos = { 0, 0 };
}; };
std::array<Particle, 10> m_particles; std::array<Particle, 10> m_particles;

View File

@ -64,7 +64,7 @@ void CScreen::CreateVersionDisplay()
CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if (pw != nullptr) if (pw != nullptr)
{ {
Math::Point pos, ddim; glm::vec2 pos, ddim;
pos.x = 540.0f/640.0f; pos.x = 540.0f/640.0f;
pos.y = 9.0f/480.0f; pos.y = 9.0f/480.0f;

View File

@ -19,10 +19,10 @@
#pragma once #pragma once
#include "math/point.h"
#include <string> #include <string>
#include <glm/glm.hpp>
class CRobotMain; class CRobotMain;
class CApplication; class CApplication;
class CEventQueue; class CEventQueue;
@ -60,7 +60,7 @@ protected:
Gfx::CEngine* m_engine; Gfx::CEngine* m_engine;
CSoundInterface* m_sound; CSoundInterface* m_sound;
const Math::Point dim = Math::Point(32.0f/640.0f, 32.0f/480.0f); const glm::vec2 dim = { 32.0f / 640.0f, 32.0f / 480.0f };
const float ox = 3.0f/640.0f, oy = 3.0f/480.0f; const float ox = 3.0f/640.0f, oy = 3.0f/480.0f;
const float sx = (32.0f+2.0f)/640.0f, sy = (32.0f+2.0f)/480.0f; const float sx = (32.0f+2.0f)/640.0f, sy = (32.0f+2.0f)/480.0f;
}; };