diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp index 2b67c714..a6e03194 100644 --- a/src/level/robotmain.cpp +++ b/src/level/robotmain.cpp @@ -230,7 +230,7 @@ CRobotMain::CRobotMain() m_movieInfoIndex = -1; - m_tooltipPos = Math::Point(0.0f, 0.0f); + m_tooltipPos = { 0.0f, 0.0f }; m_tooltipName.clear(); m_tooltipTime = 0.0f; @@ -469,7 +469,7 @@ void CRobotMain::ChangePhase(Phase phase) } ClearInterface(); - Math::Point dim, pos; + glm::vec2 dim, pos; // Creates and hide the command console. dim.x = 200.0f/640.0f; @@ -585,7 +585,7 @@ void CRobotMain::ChangePhase(Phase phase) CreateScene(false, true, false); // sets scene pos.x = ox+sx*1; pos.y = oy+sy*1; - Math::Point ddim; + glm::vec2 ddim; ddim.x = dim.x*2; ddim.y = dim.y*2; m_interface->CreateButton(pos, ddim, 16, EVENT_BUTTON_OK); @@ -629,7 +629,7 @@ void CRobotMain::ChangePhase(Phase phase) CreateScene(false, true, false); // sets scene pos.x = ox+sx*1; pos.y = oy+sy*1; - Math::Point ddim; + glm::vec2 ddim; ddim.x = dim.x*2; ddim.y = dim.y*2; m_interface->CreateButton(pos, ddim, 16, EVENT_BUTTON_OK); m_displayText->DisplayError(INFO_LOST, Math::Vector(0.0f,0.0f,0.0f), 15.0f, 60.0f, 1000.0f); @@ -1760,7 +1760,7 @@ void CRobotMain::StartDisplayVisit(EventType event) // Creates the "continue" button. if (m_interface->SearchControl(EVENT_DT_END) == nullptr) { - Math::Point pos, dim; + glm::vec2 pos, dim; pos.x = 10.0f/640.0f; pos.y = 10.0f/480.0f; dim.x = 50.0f/640.0f; @@ -1820,7 +1820,7 @@ void CRobotMain::FrameVisit(float rTime) float level = m_terrain->GetFloorLevel(pos)+2.0f; if (pos.y < level) pos.y = level; // not below the ground Math::Vector speed(0.0f, 0.0f, 0.0f); - Math::Point dim; + glm::vec2 dim; dim.x = 30.0f; dim.y = dim.x; m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISHOW, 2.0f); @@ -2024,7 +2024,7 @@ CObject* CRobotMain::GetSelect() } //! Detects the object aimed by the mouse -CObject* CRobotMain::DetectObject(Math::Point pos) +CObject* CRobotMain::DetectObject(const glm::vec2& pos) { Math::Vector p; int objRank = m_engine->DetectObject(pos, p); @@ -2112,7 +2112,7 @@ void CRobotMain::HiliteClear() } //! Highlights the object with the mouse hovers over -void CRobotMain::HiliteObject(Math::Point pos) +void CRobotMain::HiliteObject(const glm::vec2& pos) { if (m_fixScene && m_phase != PHASE_APPERANCE) return; if (m_movieLock) return; @@ -2195,13 +2195,15 @@ void CRobotMain::HiliteFrame(float rTime) } //! Creates a tooltip -void CRobotMain::CreateTooltip(Math::Point pos, const std::string& text) +void CRobotMain::CreateTooltip(const glm::vec2& position, const std::string& text) { - Math::Point corner; + glm::vec2 pos = position; + + glm::vec2 corner; corner.x = pos.x+0.022f; corner.y = pos.y-0.052f; - Math::Point start, end; + glm::vec2 start, end; m_engine->GetText()->SizeText(text, Gfx::FONT_COMMON, Gfx::FONT_SIZE_SMALL, corner, Gfx::TEXT_ALIGN_LEFT, @@ -2215,11 +2217,11 @@ void CRobotMain::CreateTooltip(Math::Point pos, const std::string& text) pos.x = start.x; pos.y = start.y; - Math::Point dim; + glm::vec2 dim; dim.x = end.x-start.x; dim.y = end.y-start.y; - Math::Point offset; + glm::vec2 offset; offset.x = 0.0f; offset.y = 0.0f; if (pos.x+dim.x > 1.0f) offset.x = 1.0f-(pos.x+dim.x); @@ -2517,7 +2519,7 @@ bool CRobotMain::EventFrame(const Event &event) Ui::CControl* pc = m_interface->SearchControl(EVENT_OBJECT_MOVIELOCK); if (pc != nullptr) { - Math::Point pos, dim; + glm::vec2 pos, dim; dim.x = 32.0f/640.0f; dim.y = 32.0f/480.0f; @@ -2541,7 +2543,7 @@ bool CRobotMain::EventFrame(const Event &event) Ui::CControl* pc = m_interface->SearchControl(EVENT_OBJECT_EDITLOCK); if (pc != nullptr) { - Math::Point pos, dim; + glm::vec2 pos, dim; if (m_editFull || m_editLock) { @@ -2571,7 +2573,7 @@ bool CRobotMain::EventFrame(const Event &event) Ui::CControl* pc = m_interface->SearchControl(EVENT_OBJECT_SAVING); if (pc != nullptr) { - Math::Point pos, dim; + glm::vec2 pos, dim; if (m_shotSaving <= 0) { @@ -2671,7 +2673,7 @@ void CRobotMain::ShowSaveIndicator(bool show) Ui::CControl* pc = m_interface->SearchControl(EVENT_OBJECT_SAVING); if (pc != nullptr) { - Math::Point pos, dim; + glm::vec2 pos, dim; if (!show) { @@ -3159,13 +3161,13 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) uv1 = line->GetParam("uv1")->AsPoint(); uv2 = line->GetParam("uv2")->AsPoint(); m_planet->Create(line->GetParam("mode")->AsPlanetType(), - Math::Point(ppos.x, ppos.z), + { ppos.x, ppos.z }, line->GetParam("dim")->AsFloat(0.2f), line->GetParam("speed")->AsFloat(0.0f), line->GetParam("dir")->AsFloat(0.0f), line->GetParam("image")->AsPath("textures"), - Math::Point(uv1.x, uv1.z), - Math::Point(uv2.x, uv2.z), + { uv1.x, uv1.z }, + { uv2.x, uv2.z }, line->GetParam("image")->AsPath("textures").find("planet") != std::string::npos // TODO: add transparent op or modify textures ); continue; @@ -3336,8 +3338,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_terrain->AddMaterial(line->GetParam("id")->AsInt(0), name.c_str(), - Math::Point(line->GetParam("u")->AsFloat(), - line->GetParam("v")->AsFloat()), + { line->GetParam("u")->AsFloat(), + line->GetParam("v")->AsFloat() }, line->GetParam("up")->AsInt(), line->GetParam("right")->AsInt(), line->GetParam("down")->AsInt(), @@ -3497,7 +3499,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) float delay = line->GetParam("delay")->AsFloat(2.0f); m_terrain->AdjustToFloor(pos); pos.y += height; - Math::Point dim; + glm::vec2 dim; dim.x = ddim; dim.y = dim.x; m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, type, delay, 0.0f, 0.0f); @@ -3962,8 +3964,8 @@ void CRobotMain::ChangeColor() // Player texture - Math::Point ts = Math::Point(0.0f, 0.0f); - Math::Point ti = Math::Point(1.0f, 1.0f); // the entire image + glm::vec2 ts = { 0.0f, 0.0f }; + glm::vec2 ti = { 1.0f, 1.0f }; // the entire image Gfx::Color colorRef1, colorNew1, colorRef2, colorNew2; @@ -3979,13 +3981,13 @@ void CRobotMain::ChangeColor() colorRef2.b = 1.0f/256.0f; // orange colorNew2 = m_playerProfile->GetApperance().colorBand; - Math::Point exclu[6]; - exclu[0] = Math::Point(192.0f/256.0f, 0.0f/256.0f); - exclu[1] = Math::Point(256.0f/256.0f, 64.0f/256.0f); // crystals + cylinders - exclu[2] = Math::Point(208.0f/256.0f, 224.0f/256.0f); - exclu[3] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // SatCom screen - exclu[4] = Math::Point(0.0f, 0.0f); - exclu[5] = Math::Point(0.0f, 0.0f); // terminator + glm::vec2 exclu[6]; + exclu[0] = { 192.0f / 256.0f, 0.0f / 256.0f }; + exclu[1] = { 256.0f / 256.0f, 64.0f / 256.0f }; // crystals + cylinders + exclu[2] = { 208.0f / 256.0f, 224.0f / 256.0f }; + exclu[3] = { 256.0f / 256.0f, 256.0f / 256.0f }; // SatCom screen + exclu[4] = { 0.0f, 0.0f }; + exclu[5] = { 0.0f, 0.0f }; // terminator m_engine->ChangeTextureColor("textures/objects/human.png", colorRef1, colorNew1, colorRef2, colorNew2, 0.30f, 0.01f, ts, ti, exclu); float tolerance; @@ -4029,10 +4031,10 @@ void CRobotMain::ChangeColor() char name[100]; sprintf(name, "textures/objects/face%.2d.png", face+1); - exclu[0] = Math::Point(105.0f/256.0f, 47.0f/166.0f); - exclu[1] = Math::Point(153.0f/256.0f, 79.0f/166.0f); // blue canister - exclu[2] = Math::Point(0.0f, 0.0f); - exclu[3] = Math::Point(0.0f, 0.0f); // terminator + exclu[0] = { 105.0f / 256.0f, 47.0f / 166.0f }; + exclu[1] = { 153.0f / 256.0f, 79.0f / 166.0f }; // blue canister + exclu[2] = { 0.0f, 0.0f }; + exclu[3] = { 0.0f, 0.0f }; // terminator m_engine->ChangeTextureColor(name, colorRef1, colorNew1, colorRef2, colorNew2, tolerance, 0.00f, ts, ti, exclu); colorRef2.r = 0.0f; @@ -4044,7 +4046,7 @@ void CRobotMain::ChangeColor() // VehicleColor - for (auto it : m_colorNewBot) + for (const auto& it : m_colorNewBot) { int team = it.first; Gfx::Color newColor = it.second; @@ -4060,27 +4062,27 @@ void CRobotMain::ChangeColor() m_engine->ChangeTextureColor("textures/objects/search.png"+teamStr, "textures/objects/search.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true); m_engine->ChangeTextureColor("textures/objects/rollert.png"+teamStr, "textures/objects/rollert.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true); - exclu[0] = Math::Point( 0.0f/256.0f, 160.0f/256.0f); - exclu[1] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // pencils - exclu[2] = Math::Point(0.0f, 0.0f); - exclu[3] = Math::Point(0.0f, 0.0f); // terminator + exclu[0] = { 0.0f / 256.0f, 160.0f / 256.0f }; + exclu[1] = { 256.0f / 256.0f, 256.0f / 256.0f }; // pencils + exclu[2] = { 0.0f, 0.0f }; + exclu[3] = { 0.0f, 0.0f }; // terminator m_engine->ChangeTextureColor("textures/objects/drawer.png"+teamStr, "textures/objects/drawer.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true); - exclu[0] = Math::Point(237.0f/256.0f, 176.0f/256.0f); - exclu[1] = Math::Point(256.0f/256.0f, 220.0f/256.0f); // blue canister - exclu[2] = Math::Point(106.0f/256.0f, 150.0f/256.0f); - exclu[3] = Math::Point(130.0f/256.0f, 214.0f/256.0f); // safe location - exclu[4] = Math::Point(0.0f, 0.0f); - exclu[5] = Math::Point(0.0f, 0.0f); // terminator + exclu[0] = { 237.0f / 256.0f, 176.0f / 256.0f }; + exclu[1] = { 256.0f / 256.0f, 220.0f / 256.0f }; // blue canister + exclu[2] = { 106.0f / 256.0f, 150.0f / 256.0f }; + exclu[3] = { 130.0f / 256.0f, 214.0f / 256.0f }; // safe location + exclu[4] = { 0.0f, 0.0f }; + exclu[5] = { 0.0f, 0.0f }; // terminator m_engine->ChangeTextureColor("textures/objects/subm.png"+teamStr, "textures/objects/subm.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true); } // AlienColor - exclu[0] = Math::Point(128.0f/256.0f, 160.0f/256.0f); - exclu[1] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // SatCom - exclu[2] = Math::Point(0.0f, 0.0f); - exclu[3] = Math::Point(0.0f, 0.0f); // terminator + exclu[0] = { 128.0f / 256.0f, 160.0f / 256.0f }; + exclu[1] = { 256.0f / 256.0f, 256.0f / 256.0f }; // SatCom + exclu[2] = { 0.0f, 0.0f }; + exclu[3] = { 0.0f, 0.0f }; // terminator m_engine->ChangeTextureColor("textures/objects/ant.png", COLOR_REF_ALIEN, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti, exclu); m_engine->ChangeTextureColor("textures/objects/mother.png", COLOR_REF_ALIEN, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti); @@ -4090,13 +4092,13 @@ void CRobotMain::ChangeColor() // water color // PARTIPLOUF0 and PARTIDROP : - ts = Math::Point(0.500f, 0.500f); - ti = Math::Point(0.875f, 0.750f); + ts = { 0.500f, 0.500f }; + ti = { 0.875f, 0.750f }; m_engine->ChangeTextureColor("textures/effect00.png", COLOR_REF_WATER, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, nullptr, m_colorShiftWater, true); // PARTIFLIC : - ts = Math::Point(0.00f, 0.75f); - ti = Math::Point(0.25f, 1.00f); + ts = { 0.00f, 0.75f }; + ti = { 0.25f, 1.00f }; m_engine->ChangeTextureColor("textures/effect02.png", COLOR_REF_WATER, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, nullptr, m_colorShiftWater, true); } @@ -4163,10 +4165,10 @@ bool CRobotMain::FreeSpace(Math::Vector ¢er, float minRadius, float maxRadiu float ia = space/radius; for (float angle = 0.0f; angle < Math::PI*2.0f; angle += ia) { - Math::Point p; + glm::vec2 p; p.x = center.x+radius; p.y = center.z; - p = Math::RotatePoint(Math::Point(center.x, center.z), angle, p); + p = Math::RotatePoint({ center.x, center.z }, angle, p); Math::Vector pos; pos.x = p.x; pos.z = p.y; @@ -4192,10 +4194,10 @@ bool CRobotMain::FreeSpace(Math::Vector ¢er, float minRadius, float maxRadiu float ia = space/radius; for (float angle=0.0f ; angleGetWorldMatrix(0); pos = Math::Transform(*mat, Math::Vector(2.0f, 3.0f, 0.0f)); @@ -6088,7 +6090,7 @@ void CRobotMain::CreateCodeBattleInterface() { if (m_phase == PHASE_SIMUL) { - Math::Point pos, ddim; + glm::vec2 pos, ddim; float offset = (ceil(m_viewpoints.size() / 2.0f) * 50); int numTeams = m_scoreboard ? GetAllTeams().size() : 0; diff --git a/src/level/robotmain.h b/src/level/robotmain.h index ceddcb78..358bd35c 100644 --- a/src/level/robotmain.h +++ b/src/level/robotmain.h @@ -501,11 +501,11 @@ protected: int CreateLight(Math::Vector direction, Gfx::Color color); void HiliteClear(); - void HiliteObject(Math::Point pos); + void HiliteObject(const glm::vec2& pos); void HiliteFrame(float rTime); - void CreateTooltip(Math::Point pos, const std::string& text); + void CreateTooltip(const glm::vec2& pos, const std::string& text); void ClearTooltip(); - CObject* DetectObject(Math::Point pos); + CObject* DetectObject(const glm::vec2& pos); void ChangeCamera(); void AbortMovie(); //! \brief Select an object, without deselecting the previous one @@ -640,7 +640,7 @@ protected: ActivePause* m_suspend = nullptr; - Math::Point m_tooltipPos; + glm::vec2 m_tooltipPos; std::string m_tooltipName; float m_tooltipTime = 0.0f; diff --git a/src/object/object_factory.cpp b/src/object/object_factory.cpp index 803dbc30..06cd6b0a 100644 --- a/src/object/object_factory.cpp +++ b/src/object/object_factory.cpp @@ -1184,7 +1184,7 @@ CObjectUPtr CObjectFactory::CreateTeen(const ObjectCreateParams& params) Math::Matrix* mat = obj->GetWorldMatrix(0); pos = Math::Transform(*mat, Math::Vector(-56.0f, 22.0f, 0.0f)); - m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(20.0f, 20.0f), Gfx::PARTISELY, 1.0f, 0.0f, 0.0f); + m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), { 20.0f, 20.0f }, Gfx::PARTISELY, 1.0f, 0.0f, 0.0f); pos = Math::Transform(*mat, Math::Vector(-65.0f, 40.0f, 0.0f)); Gfx::Color color; @@ -1446,7 +1446,7 @@ CObjectUPtr CObjectFactory::CreateTeen(const ObjectCreateParams& params) Math::Matrix* mat = obj->GetWorldMatrix(0); pos = Math::Transform(*mat, Math::Vector(0.0f, 50.0f, 0.0f)); - m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(100.0f, 100.0f), Gfx::PARTISELY, 1.0f, 0.0f, 0.0f); + m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), { 100.0f, 100.0f }, Gfx::PARTISELY, 1.0f, 0.0f, 0.0f); pos = Math::Transform(*mat, Math::Vector(0.0f, 50.0f, 0.0f)); Gfx::Color color; @@ -1834,8 +1834,8 @@ CObjectUPtr CObjectFactory::CreateQuartz(const ObjectCreateParams& params) pos.y += 16.0f; radius = 8.0f; } - m_particle->CreateParticle(pos, pos, Math::Point(2.0f, 2.0f), Gfx::PARTIQUARTZ, 0.7f+Math::Rand()*0.7f, radius, 0.0f); - m_particle->CreateParticle(pos, pos, Math::Point(2.0f, 2.0f), Gfx::PARTIQUARTZ, 0.7f+Math::Rand()*0.7f, radius, 0.0f); + m_particle->CreateParticle(pos, pos, { 2.0f, 2.0f }, Gfx::PARTIQUARTZ, 0.7f + Math::Rand() * 0.7f, radius, 0.0f); + m_particle->CreateParticle(pos, pos, { 2.0f, 2.0f }, Gfx::PARTIQUARTZ, 0.7f + Math::Rand() * 0.7f, radius, 0.0f); return std::move(obj); } diff --git a/src/object/old_object.cpp b/src/object/old_object.cpp index cd715aeb..e508e389 100644 --- a/src/object/old_object.cpp +++ b/src/object/old_object.cpp @@ -1368,14 +1368,14 @@ void COldObject::SetFloorHeight(float height) void COldObject::FloorAdjust() { Math::Vector pos, n; - Math::Point nn; + glm::vec2 nn; float a; pos = GetPosition(); if ( m_terrain->GetNormal(n, pos) ) { a = GetRotationY(); - nn = Math::RotatePoint(-a, Math::Point(n.z, n.x)); + nn = Math::RotatePoint(-a, { n.z, n.x }); SetRotationX( sinf(nn.x)); SetRotationZ(-sinf(nn.y)); } @@ -2304,7 +2304,7 @@ void COldObject::VirusFrame(float rTime) speed.x = (Math::Rand()-0.5f)*2.0f; speed.z = (Math::Rand()-0.5f)*2.0f; speed.y = Math::Rand()*4.0f+4.0f; - Math::Point dim; + glm::vec2 dim; dim.x = Math::Rand()*0.3f+0.3f; dim.y = dim.x; @@ -2921,7 +2921,7 @@ float COldObject::GetShowLimitRadius() void COldObject::CreateSelectParticle() { Math::Vector pos, speed; - Math::Point dim; + glm::vec2 dim; int i; // Removes particles preceding. @@ -2989,7 +2989,7 @@ void COldObject::CreateSelectParticle() void COldObject::UpdateSelectParticle() { Math::Vector pos[4]; - Math::Point dim[4]; + glm::vec2 dim[4]; float zoom[4]; float angle; int i; diff --git a/src/object/subclass/base_building.cpp b/src/object/subclass/base_building.cpp index 9aea847d..46aa563f 100644 --- a/src/object/subclass/base_building.cpp +++ b/src/object/subclass/base_building.cpp @@ -197,7 +197,7 @@ std::unique_ptr CBaseBuilding::Create( obj->SetObjectRank(1+i, rank); obj->SetObjectParent(1+i, 0); modelManager->AddModelReference("base2.mod", false, rank, params.team); - Math::Point p = Math::RotatePoint(-Math::PI/4.0f*i, 27.8f); + glm::vec2 p = Math::RotatePoint(-Math::PI/4.0f*i, 27.8f); obj->SetPartPosition(1+i, Math::Vector(p.x, 30.0f, p.y)); obj->SetPartRotationY(1+i, Math::PI/4.0f*i); obj->SetPartRotationZ(1+i, Math::PI/2.0f); diff --git a/src/object/subclass/exchange_post.cpp b/src/object/subclass/exchange_post.cpp index 228c993e..5e7858dc 100644 --- a/src/object/subclass/exchange_post.cpp +++ b/src/object/subclass/exchange_post.cpp @@ -313,7 +313,7 @@ void CAutoInfo::Start(int param) m_goal = m_object->GetPosition(); Math::Vector pos, speed; - Math::Point dim; + glm::vec2 dim; if (m_phase == Phase::Send) { @@ -411,7 +411,7 @@ bool CAutoInfo::EventProcess(const Event &event) speed.z = (Math::Rand()-0.5f)*50.0f; speed.y = (Math::Rand()-0.5f)*50.0f; speed *= 0.5f+m_progress*0.5f; - Math::Point dim(0.6f, 0.6f); + glm::vec2 dim(0.6f, 0.6f); float duration = Math::Rand()*0.5f+0.5f; m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK6, duration, 0.0f, @@ -458,7 +458,7 @@ bool CAutoInfo::EventProcess(const Event &event) pos.z += (Math::Rand()-0.5f)*40.0f; speed = (speed-pos)*1.0f; //? speed *= 0.5f+m_progress*0.5f; - Math::Point dim(0.6f, 0.6f); + glm::vec2 dim(0.6f, 0.6f); float duration = Math::Rand()*0.5f+0.5f; m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK6, duration, 0.0f, @@ -500,7 +500,7 @@ bool CAutoInfo::EventProcess(const Event &event) speed.x = (Math::Rand()-0.5f)*5.0f; speed.z = (Math::Rand()-0.5f)*5.0f; speed.y = 5.0f+Math::Rand()*5.0f; - Math::Point dim; + glm::vec2 dim; dim.x = 5.0f+Math::Rand()*5.0f; dim.y = dim.x; float duration = 4.0f; @@ -578,7 +578,7 @@ bool CAutoInfo::CreateInterface(bool select) float sx = 33.0f/640.0f; float sy = 33.0f/480.0f; - Math::Point pos, ddim; + glm::vec2 pos, ddim; pos.x = ox+sx*7.0f; pos.y = oy+sy*0.0f; diff --git a/src/script/script.cpp b/src/script/script.cpp index 14aa3057..cb1861fb 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -985,7 +985,7 @@ bool CScript::SendScript(const char* text) if ( !CheckToken() ) return false; if ( !Compile() ) return false;*/ - Ui::CEdit* edit = m_interface->CreateEdit(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 0, EVENT_EDIT9); + Ui::CEdit* edit = m_interface->CreateEdit({ 0.0f, 0.0f }, { 0.0f, 0.0f }, 0, EVENT_EDIT9); edit->SetAutoIndent(m_engine->GetEditIndentMode()); edit->SetText(text, true); GetScript(edit); @@ -1004,7 +1004,7 @@ bool CScript::ReadScript(const char* filename) m_script.reset(); - edit = m_interface->CreateEdit(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 0, EVENT_EDIT9); + edit = m_interface->CreateEdit({ 0.0f, 0.0f }, { 0.0f, 0.0f }, 0, EVENT_EDIT9); edit->SetAutoIndent(m_engine->GetEditIndentMode()); edit->ReadText(filename); GetScript(edit); @@ -1022,7 +1022,7 @@ bool CScript::WriteScript(const char* filename) return false; } - Ui::CEdit* edit = m_interface->CreateEdit(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 0, EVENT_EDIT9); + Ui::CEdit* edit = m_interface->CreateEdit({ 0.0f, 0.0f }, { 0.0f, 0.0f }, 0, EVENT_EDIT9); edit->SetAutoIndent(m_engine->GetEditIndentMode()); edit->SetText(m_script.get()); edit->WriteText(filename); diff --git a/src/ui/debug_menu.cpp b/src/ui/debug_menu.cpp index a45e3190..751c8ca3 100644 --- a/src/ui/debug_menu.cpp +++ b/src/ui/debug_menu.cpp @@ -64,7 +64,7 @@ void CDebugMenu::ToggleInterface() if (!IsActive()) { CreateInterface(); - CLabel* pl = m_interface->CreateLabel(Math::Point(0.0f, 0.9f), Math::Point(1.0f, 0.1f), -1, EVENT_LABEL19, "??"); + CLabel* pl = m_interface->CreateLabel({ 0.0f, 0.9f }, { 1.0f, 0.1f }, -1, EVENT_LABEL19, "??"); pl->SetFontType(Gfx::FONT_STUDIO); } else @@ -74,14 +74,14 @@ void CDebugMenu::ToggleInterface() } } -const Math::Point dim = Math::Point(33.0f/640.0f, 33.0f/480.0f); -const float ox = 3.0f/640.0f, oy = 3.0f/480.0f; -const float /*sx = 33.0f/640.0f,*/ sy = 33.0f/480.0f; +constexpr glm::vec2 dim = { 33.0f / 640.0f, 33.0f / 480.0f }; +constexpr float ox = 3.0f/640.0f, oy = 3.0f/480.0f; +constexpr float /*sx = 33.0f/640.0f,*/ sy = 33.0f/480.0f; void CDebugMenu::CreateInterface() { - CWindow* pw = m_interface->CreateWindows(Math::Point(), Math::Point(), 0, EVENT_WINDOW7); - Math::Point pos, ddim; + CWindow* pw = m_interface->CreateWindows({ 0, 0 }, { 0, 0 }, 0, EVENT_WINDOW7); + glm::vec2 pos, ddim; CCheck* pc; CButton* pb; @@ -128,8 +128,8 @@ void CDebugMenu::CreateInterface() void CDebugMenu::CreateSpawnInterface() { - CWindow* pw = m_interface->CreateWindows(Math::Point(), Math::Point(), 0, EVENT_WINDOW7); - Math::Point pos, ddim; + CWindow* pw = m_interface->CreateWindows({ 0, 0 }, { 0, 0 }, 0, EVENT_WINDOW7); + glm::vec2 pos, ddim; CButton* pb; ddim.x = 4*dim.x+4*ox; @@ -391,7 +391,7 @@ bool CDebugMenu::EventProcess(const Event &event) return true; } -bool CDebugMenu::HandleSpawnObject(ObjectType type, Math::Point mousePos) +bool CDebugMenu::HandleSpawnObject(ObjectType type, const glm::vec2& mousePos) { Math::Vector pos; if (m_engine->DetectObject(mousePos, pos, true) == -1) @@ -414,7 +414,7 @@ bool CDebugMenu::HandleSpawnObject(ObjectType type, Math::Point mousePos) return true; } -bool CDebugMenu::HandleLightning(Math::Point mousePos) +bool CDebugMenu::HandleLightning(const glm::vec2& mousePos) { Math::Vector pos; if (m_engine->DetectObject(mousePos, pos, true) == -1) @@ -428,7 +428,7 @@ bool CDebugMenu::HandleLightning(Math::Point mousePos) return true; } -bool CDebugMenu::HandleTeleport(Math::Point mousePos) +bool CDebugMenu::HandleTeleport(const glm::vec2& mousePos) { CObject* select = m_main->GetSelect(); @@ -465,7 +465,7 @@ void CDebugMenu::HandleFrameUpdate(const Event &event) pl->SetName(str.c_str()); } -bool CDebugMenu::HandleCopy(Math::Point mousePos) +bool CDebugMenu::HandleCopy(const glm::vec2& mousePos) { Math::Vector pos; if (m_engine->DetectObject(mousePos, pos, true) == -1) diff --git a/src/ui/debug_menu.h b/src/ui/debug_menu.h index cc299a63..ac8778fe 100644 --- a/src/ui/debug_menu.h +++ b/src/ui/debug_menu.h @@ -19,10 +19,10 @@ #pragma once -#include "math/point.h" - #include "object/object_type.h" +#include + class CRobotMain; class CObjectManager; class CSoundInterface; @@ -76,16 +76,16 @@ protected: //! Handle spawning a new object at mouse position //! \return true on success, false on error - bool HandleSpawnObject(ObjectType type, Math::Point mousePos); + bool HandleSpawnObject(ObjectType type, const glm::vec2& mousePos); //! Handle lightning at position //! \return true on success, false on error - bool HandleLightning(Math::Point mousePos); + bool HandleLightning(const glm::vec2& mousePos); //! Handle teleport to position //! \return true on success, false on error - bool HandleTeleport(Math::Point mousePos); + bool HandleTeleport(const glm::vec2& mousePos); //! Handle ctrl+c (copy coordinates under cursor to clipboard) //! \return true on success, false on error - bool HandleCopy(Math::Point mousePos); + bool HandleCopy(const glm::vec2& mousePos); protected: CRobotMain* m_main; diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp index c07001e3..d734b5ea 100644 --- a/src/ui/displaytext.cpp +++ b/src/ui/displaytext.cpp @@ -179,7 +179,7 @@ void CDisplayText::DisplayText(const char *text, Math::Vector goal, float height Ui::CButton* button; Ui::CGroup* group; Ui::CLabel* label; - Math::Point pos, ppos, dim; + glm::vec2 pos, ppos, dim; SoundType sound; float hLine, hBox; int nLine, icon, i; diff --git a/src/ui/object_interface.cpp b/src/ui/object_interface.cpp index dbfdefcf..3690b2c8 100644 --- a/src/ui/object_interface.cpp +++ b/src/ui/object_interface.cpp @@ -762,7 +762,7 @@ void CObjectInterface::StopEditScript(bool closeWithErrors) void CObjectInterface::GroundFlat() { Math::Vector pos, speed; - Math::Point dim; + glm::vec2 dim; Error err; float level; @@ -807,7 +807,7 @@ bool CObjectInterface::CreateInterface(bool bSelect) CColor* pc; CTarget* pt; CLabel* pl; - Math::Point pos, dim, ddim; + glm::vec2 pos, dim, ddim; float ox, oy, sx, sy; pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); @@ -1547,7 +1547,7 @@ void CObjectInterface::UpdateInterface(float rTime) CGroup* pgr; CTarget* ptg; Math::Vector pos, hPos; - Math::Point ppos; + glm::vec2 ppos; float range; int icon; bool bOnBoard;