From d97dab0ecc0e9ebbf3204cd5cf25d160006b9e7e Mon Sep 17 00:00:00 2001 From: Samat Agishev Date: Thu, 1 Feb 2018 19:39:31 +0500 Subject: [PATCH] migrate to TES-engine --- jni/main_code.cpp | 59 +- jni/main_code.h | 5 +- jni/match3/match3field.cpp | 543 +++++++++--------- jni/match3/match3field.h | 154 +++-- windows/Crystal of Rhylil.sln | 95 ++- .../Crystal of Rhylil.vcxproj | 74 ++- windows/Crystal of Rhylil/main.cpp | 18 +- windows/Crystal of Rhylil/main.h | 2 +- 8 files changed, 569 insertions(+), 381 deletions(-) diff --git a/jni/main_code.cpp b/jni/main_code.cpp index 70bcc1d..c544d27 100644 --- a/jni/main_code.cpp +++ b/jni/main_code.cpp @@ -58,35 +58,60 @@ struct TOnClickTest void TMyApplication::InnerInit() { #ifdef TARGET_ANDROID - ResourceManager->PathToResources = ""; + SE::ST::PathToResources = ""; #endif #ifdef TARGET_WIN32 #ifdef DEBUG - ResourceManager->PathToResources = "../../assets/"; + SE::ST::PathToResources = "../../assets/"; #else - ResourceManager->PathToResources = "res/"; + SE::ST::PathToResources = "res/"; #endif #endif #ifdef TARGET_IOS - ResourceManager->PathToResources = "assets/"; + SE::ST::PathToResources = "assets/"; #endif + + if (SE::Console != nullptr) { + *SE::Console << "APP INIT\n"; + } - boost::shared_ptr px = FileToPropertyTree("function_info_list.xml"); + SE::ResourceManager->ShaderManager.AddShader("DefaultShader", "shader1vertex.txt", "shader1fragment.txt"); + SE::ResourceManager->ShaderManager.AddShader("FrameShader", "frameshader_vertex.txt", "frameshader_fragment.txt"); + SE::ResourceManager->ShaderManager.AddShader("BrickShader", "brickshader_vertex.txt", "brickshader_fragment.txt"); + SE::Renderer->PushShader("DefaultShader"); + + const std::string CONST_LOADING_BACKGROUND_BLACK = "loading_background_black"; + const std::string CONST_LOADING_TEXTURE = "loading"; + const std::string CONST_LOGO_SMALL_TEXTURE = "logo_small"; + + SE::ResourceManager->TexList.AddTexture(CONST_LOADING_BACKGROUND_BLACK + ".png", CONST_LOADING_BACKGROUND_BLACK); + SE::ResourceManager->TexList.AddTexture(CONST_LOADING_TEXTURE + ".png", CONST_LOADING_TEXTURE); + SE::ResourceManager->TexList.AddTexture(CONST_LOGO_SMALL_TEXTURE + ".png", CONST_LOGO_SMALL_TEXTURE); + + SE::ResourceManager->TexList.AddTexture("console_bkg.bmp"); + + SE::ResourceManager->FrameManager.AddFrameRenderBuffer("LevelBuffer", 512, 512); + + Inited = true; + + SE::Renderer->SetOrthoProjection(); + + SE::Renderer->SetFullScreenViewport(); - ResourceManager->ScriptManager.Serialize(*px); - px = FileToPropertyTree("shaders.xml"); - ResourceManager->ShaderManager.Serialize(*px); + auto px = SE::FileToPropertyTree("shaders.xml"); + SE::ResourceManager->ShaderManager.Serialize(*px); - HalibutRender->PushShader("DefaultShader"); + px = SE::FileToPropertyTree("textures.xml"); + SE::ResourceManager->TexList.Serialize(*px); - px = FileToPropertyTree("textures.xml"); - ResourceManager->TexList.Serialize(*px); - - px = FileToPropertyTree("fonts.xml"); - ResourceManager->FontManager.Serialize(*px); - ResourceManager->FontManager.PushFont("droid_sans14"); + //this cause exception + //px = SE::FileToPropertyTree("fonts.xml"); + //SE::ResourceManager->FontManager.Serialize(*px); + //SE::ResourceManager->FontManager.PushFont("droid_sans14"); + + /* ResourceManager->GUIManager.AddWidgetAndFill(boost::shared_ptr(new TSquareButton), "ololo", "group1", @@ -104,6 +129,8 @@ void TMyApplication::InnerInit() ResourceManager->GUIManager.MoveWidget("ololo", vec2(-100, 0)); TOnClickTest OnClickTest; + */ + //ResourceManager->GUIManager.GetOnClickSignal("ololo").connect(OnClickTest); @@ -136,6 +163,6 @@ void TMyApplication::InnerDraw() } //What to do on update. timer means how many ms passed since last update -void TMyApplication::InnerUpdate(cardinal timer) +void TMyApplication::InnerUpdate(size_t timer) { } diff --git a/jni/main_code.h b/jni/main_code.h index 0830ff8..17ff304 100644 --- a/jni/main_code.h +++ b/jni/main_code.h @@ -19,6 +19,7 @@ #include "match3/match3field.h" +class TMatch3Field; class TMatch3Controller { @@ -35,7 +36,7 @@ public: //Application class -class TMyApplication : public TApplication +class TMyApplication : public SE::TApplication { public: bool Inited; @@ -53,7 +54,7 @@ public: virtual void InnerDraw(); //What to do on draw - virtual void InnerUpdate(cardinal timer); + virtual void InnerUpdate(size_t timer); //What to do on update. timer means how many ms passed since last update }; diff --git a/jni/match3/match3field.cpp b/jni/match3/match3field.cpp index 09f7147..af17022 100644 --- a/jni/match3/match3field.cpp +++ b/jni/match3/match3field.cpp @@ -1,9 +1,10 @@ -#include "match3/match3field.h" +#include "match3field.h" -#include "main_code.h" +#include "../main_code.h" #include + void TChipTemplateParams::Serialize(boost::property_tree::ptree& propertyTree) { @@ -12,22 +13,22 @@ void TChipTemplateParams::Serialize(boost::property_tree::ptree& propertyTree) std::string selectedNormTexName = propertyTree.get("SelectedNormTexName"); std::string finishingTexName = propertyTree.get("FinishingTexName"); - SelectedRenderParams.ShaderName = selectedShaderName; - SelectedRenderParams.TexName = selectedTexName; - SelectedRenderParams.NormTexName = selectedNormTexName; - SelectedRenderParams.Transparency = 1.f; - - FinishingRenderParams.ShaderName = ""; - FinishingRenderParams.TexName = finishingTexName; - FinishingRenderParams.NormTexName = ""; - FinishingRenderParams.Transparency = 1.f; + //SelectedRenderParams.ShaderName = selectedShaderName; + //SelectedRenderParams.TexName = selectedTexName; + //SelectedRenderParams.NormTexName = selectedNormTexName; + //SelectedRenderParams.Transparency = 1.f; + // + //FinishingRenderParams.ShaderName = ""; + //FinishingRenderParams.TexName = finishingTexName; + //FinishingRenderParams.NormTexName = ""; + //FinishingRenderParams.Transparency = 1.f; std::string selectedAnimFileName = propertyTree.get("SelectedAnimFileName"); std::string finishingAnimFileName = propertyTree.get("FinishingAnimFileName"); - boost::shared_ptr px = FileToPropertyTree(selectedAnimFileName); + auto px = SE::FileToPropertyTree(selectedAnimFileName); SelectedTemplateAnimObject.Serialize(*px); - px = FileToPropertyTree(finishingAnimFileName); + px = SE::FileToPropertyTree(finishingAnimFileName); FinishingTemplateAnimObject.Serialize(*px); } @@ -38,8 +39,8 @@ void TMatch3FieldParams::Serialize(boost::property_tree::ptree& propertyTree) TChipTemplateParams chipTemplateParams; - FieldWidth = propertyTree.get("Match3Params.FieldWidth"); - FieldHeight = propertyTree.get("Match3Params.FieldHeight"); + FieldWidth = propertyTree.get("Match3Params.FieldWidth"); + FieldHeight = propertyTree.get("Match3Params.FieldHeight"); CellWidth = propertyTree.get("Match3Params.CellWidth"); CellHeight = propertyTree.get("Match3Params.CellHeight"); ChipLowestSpeed = propertyTree.get("Match3Params.ChipLowestSpeed"); @@ -47,8 +48,8 @@ void TMatch3FieldParams::Serialize(boost::property_tree::ptree& propertyTree) ChipPositionEpsilon = propertyTree.get("Match3Params.ChipPositionEpsilon"); ChipVelocityEpsilon = propertyTree.get("Match3Params.ChipVelocityEpsilon"); ChipK = propertyTree.get("Match3Params.ChipK"); - ChipMatchTime = propertyTree.get("Match3Params.ChipMatchTime"); - ChipTypeCount = propertyTree.get("Match3Params.ChipTypeCount"); + ChipMatchTime = propertyTree.get("Match3Params.ChipMatchTime"); + ChipTypeCount = propertyTree.get("Match3Params.ChipTypeCount"); BOOST_FOREACH(boost::property_tree::ptree::value_type &v, propertyTree.get_child("Match3Params.ChipList")) { @@ -62,39 +63,43 @@ void TMatch3FieldParams::Serialize(boost::property_tree::ptree& propertyTree) int TChip::StaticAnimationIndex = 0; -TChip::TChip(int chipType, TRenderPairList::iterator renderPair, cardinal vertexListShift, TChipState chipState) +TChip::TChip(int chipType, SE::TRenderPairList::iterator renderPair, size_t vertexListShift, TChipState chipState) : ChipType(chipType) , RenderPair(renderPair) , VertexListShift(vertexListShift) , ChipState(chipState) , Velocity(0) { - AnimName = "test_anim"+tostr(StaticAnimationIndex++); + AnimName = "test_anim"+SE::tostr(StaticAnimationIndex++); } + + TChip::~TChip() { } -vec2 TChip::GetLeftBottomPos() +Eigen::Vector2f TChip::GetLeftBottomPos() { - std::vector::iterator i = RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].begin() + VertexListShift; + std::vector::iterator i = RenderPair->second.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].begin() + VertexListShift; - return vec2(i->v[0], i->v[1]); + return Eigen::Vector2f((*i)[0], (*i)[1]); } -void TChip::SetLeftBottomPos(vec2 newPos) +void TChip::SetLeftBottomPos(Eigen::Vector2f newPos) { - vec2 shift = newPos - GetLeftBottomPos(); + Eigen::Vector2f shift = newPos - GetLeftBottomPos(); MoveLeftBottomPos(shift); } -void TChip::MoveLeftBottomPos(vec2 shift) + + +void TChip::MoveLeftBottomPos(Eigen::Vector2f shift) { for (int i=0; i<6; i++) { - *(RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].begin() + VertexListShift + i) += vec3(shift, 0); + *(RenderPair->second.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].begin() + VertexListShift + i) += Eigen::Vector3f(shift, 0); } } @@ -115,7 +120,7 @@ TMatch3Logic::~TMatch3Logic() } -void TMatch3Logic::FillRandomChipMatrix(std::vector renderPairIteratorVector, vec2 leftBottomPos) +void TMatch3Logic::FillRandomChipMatrix(std::vector renderPairIteratorVector, Eigen::Vector2f leftBottomPos) { RenderPairIteratorVector = renderPairIteratorVector; @@ -126,9 +131,9 @@ void TMatch3Logic::FillRandomChipMatrix(std::vector r ChipMatrix.resize(Match3FieldParams.FieldWidth); - for (cardinal i = 0; i < Match3FieldParams.FieldWidth; ++i) + for (size_t i = 0; i < Match3FieldParams.FieldWidth; ++i) { - for (cardinal j=0; j < Match3FieldParams.FieldHeight; ++j) + for (size_t j=0; j < Match3FieldParams.FieldHeight; ++j) { int chipType = rand() % ChipTypeCount; @@ -146,7 +151,7 @@ void TMatch3Logic::FillRandomChipMatrix(std::vector r - std::vector chipList = GetAvailableMatchingChips(); + std::vector chipList = GetAvailableMatchingChips(); while (chipList.size() != 0) { @@ -157,64 +162,66 @@ void TMatch3Logic::FillRandomChipMatrix(std::vector r } -vec2 TMatch3Logic::GetExpectedLeftBottomPos(cardinal x, cardinal y) + +Eigen::Vector2f TMatch3Logic::GetExpectedLeftBottomPos(size_t x, size_t y) { - return LeftBottomPosField + vec2(x*Match3FieldParams.CellWidth, y*Match3FieldParams.CellHeight); + return LeftBottomPosField + Eigen::Vector2f(x*Match3FieldParams.CellWidth, y*Match3FieldParams.CellHeight); } -void TMatch3Logic::StartAnimateChip(cardinal x, cardinal y) +void TMatch3Logic::StartAnimateChip(size_t x, size_t y) { - ResourceManager->HalibutAnimationManager.StartAnimation(ChipMatrix[x][y].AnimName); + SE::ResourceManager->HalibutAnimationManager.StartAnimation(ChipMatrix[x][y].AnimName); } -void TMatch3Logic::StopAnimateChip(cardinal x, cardinal y) +void TMatch3Logic::StopAnimateChip(size_t x, size_t y) { - ResourceManager->HalibutAnimationManager.StopAnimation(ChipMatrix[x][y].AnimName); + SE::ResourceManager->HalibutAnimationManager.StopAnimation(ChipMatrix[x][y].AnimName); } -bool TMatch3Logic::ChipIsLocked(ivec2 chip) +bool TMatch3Logic::ChipIsLocked(Eigen::Vector2i chip) { - return ChipMatrix[chip.v[0]][chip.v[1]].ChipState == TChip::CS_LOCKED; + return ChipMatrix[chip[0]][chip[1]].ChipState == TChip::CS_LOCKED; } -bool TMatch3Logic::ChipIsFinishing(ivec2 chip) +bool TMatch3Logic::ChipIsFinishing(Eigen::Vector2i chip) { - return ChipMatrix[chip.v[0]][chip.v[1]].ChipState == TChip::CS_FINISHING; + return ChipMatrix[chip[0]][chip[1]].ChipState == TChip::CS_FINISHING; } -bool TMatch3Logic::ChipIsStable(ivec2 chip) +bool TMatch3Logic::ChipIsStable(Eigen::Vector2i chip) { - return ChipMatrix[chip.v[0]][chip.v[1]].ChipState == TChip::CS_STANDBY || - ChipMatrix[chip.v[0]][chip.v[1]].ChipState == TChip::CS_LOCKED; + return ChipMatrix[chip[0]][chip[1]].ChipState == TChip::CS_STANDBY || + ChipMatrix[chip[0]][chip[1]].ChipState == TChip::CS_LOCKED; } -bool TMatch3Logic::ChipCanBeSelected(ivec2 chip) + +bool TMatch3Logic::ChipCanBeSelected(Eigen::Vector2i chip) { - if (ChipMatrix[chip.v[0]][chip.v[1]].ChipState != TChip::CS_STANDBY) + if (ChipMatrix[chip[0]][chip[1]].ChipState != TChip::CS_STANDBY) { return false; } - if (chip.v[1] == 0) + if (chip[1] == 0) { return true; } - int i = chip.v[1] - 1; + int i = chip[1] - 1; - while (i >= 0 && ChipIsStable(ivec2(chip.v[0], i)) && !ChipIsLocked(ivec2(chip.v[0], i))) + while (i >= 0 && ChipIsStable(Eigen::Vector2i(chip[0], i)) && !ChipIsLocked(Eigen::Vector2i(chip[0], i))) { i--; } - if (i < 0 || ChipIsLocked(ivec2(chip.v[0], i))) + if (i < 0 || ChipIsLocked(Eigen::Vector2i(chip[0], i))) { return true; } @@ -223,11 +230,13 @@ bool TMatch3Logic::ChipCanBeSelected(ivec2 chip) } +#if 0 -bool TMatch3Logic::ChipsCanBeSwapped(ivec2 p1, ivec2 p2) + +bool TMatch3Logic::ChipsCanBeSwapped(Eigen::Vector2i p1, Eigen::Vector2i p2) { - float distance_x = static_cast(p1.v[0] - p2.v[0]); - float distance_y = static_cast(p1.v[1] - p2.v[1]); + float distance_x = static_cast(p1[0] - p2[0]); + float distance_y = static_cast(p1[1] - p2[1]); if ((((fabs(distance_x) == 1) && (fabs(distance_y) == 0)) || ((fabs(distance_x) == 0) && (fabs(distance_y) == 1))) && @@ -241,17 +250,17 @@ bool TMatch3Logic::ChipsCanBeSwapped(ivec2 p1, ivec2 p2) return false; } -bool TMatch3Logic::ChipCanBeMatchedUp(ivec2 chip) +bool TMatch3Logic::ChipCanBeMatchedUp(Eigen::Vector2i chip) { - if (chip.v[1] <= Match3FieldParams.FieldHeight - 3) + if (chip[1] <= Match3FieldParams.FieldHeight - 3) { - if ((ChipMatrix[chip.v[0]][chip.v[1]].ChipType == ChipMatrix[chip.v[0]][chip.v[1] + 1].ChipType) - && (ChipMatrix[chip.v[0]][chip.v[1]].ChipType == ChipMatrix[chip.v[0]][chip.v[1] + 2].ChipType)) + if ((ChipMatrix[chip[0]][chip[1]].ChipType == ChipMatrix[chip[0]][chip[1] + 1].ChipType) + && (ChipMatrix[chip[0]][chip[1]].ChipType == ChipMatrix[chip[0]][chip[1] + 2].ChipType)) { - if (ChipMatrix[chip.v[0]][chip.v[1]].ChipState == TChip::CS_STANDBY && - ChipMatrix[chip.v[0]][chip.v[1] + 1].ChipState == TChip::CS_STANDBY && - ChipMatrix[chip.v[0]][chip.v[1] + 2].ChipState == TChip::CS_STANDBY) + if (ChipMatrix[chip[0]][chip[1]].ChipState == TChip::CS_STANDBY && + ChipMatrix[chip[0]][chip[1] + 1].ChipState == TChip::CS_STANDBY && + ChipMatrix[chip[0]][chip[1] + 2].ChipState == TChip::CS_STANDBY) { return true; } @@ -263,16 +272,16 @@ bool TMatch3Logic::ChipCanBeMatchedUp(ivec2 chip) return false; } -bool TMatch3Logic::ChipCanBeMatchedDown(ivec2 chip) +bool TMatch3Logic::ChipCanBeMatchedDown(Eigen::Vector2i chip) { - if (chip.v[1] >= 2) + if (chip[1] >= 2) { - if ((ChipMatrix[chip.v[0]][chip.v[1]].ChipType == ChipMatrix[chip.v[0]][chip.v[1] - 1].ChipType) - && (ChipMatrix[chip.v[0]][chip.v[1]].ChipType == ChipMatrix[chip.v[0]][chip.v[1] - 2].ChipType)) + if ((ChipMatrix[chip[0]][chip[1]].ChipType == ChipMatrix[chip[0]][chip[1] - 1].ChipType) + && (ChipMatrix[chip[0]][chip[1]].ChipType == ChipMatrix[chip[0]][chip[1] - 2].ChipType)) { - if (ChipMatrix[chip.v[0]][chip.v[1]].ChipState == TChip::CS_STANDBY && - ChipMatrix[chip.v[0]][chip.v[1] - 1].ChipState == TChip::CS_STANDBY && - ChipMatrix[chip.v[0]][chip.v[1] - 2].ChipState == TChip::CS_STANDBY) + if (ChipMatrix[chip[0]][chip[1]].ChipState == TChip::CS_STANDBY && + ChipMatrix[chip[0]][chip[1] - 1].ChipState == TChip::CS_STANDBY && + ChipMatrix[chip[0]][chip[1] - 2].ChipState == TChip::CS_STANDBY) { return true; } @@ -282,16 +291,16 @@ bool TMatch3Logic::ChipCanBeMatchedDown(ivec2 chip) return false; } -bool TMatch3Logic::ChipCanBeMatchedLeft(ivec2 chip) +bool TMatch3Logic::ChipCanBeMatchedLeft(Eigen::Vector2i chip) { - if (chip.v[0] >= 2) + if (chip[0] >= 2) { - if ((ChipMatrix[chip.v[0]][chip.v[1]].ChipType == ChipMatrix[chip.v[0] - 1][chip.v[1]].ChipType) - && (ChipMatrix[chip.v[0]][chip.v[1]].ChipType == ChipMatrix[chip.v[0] - 2][chip.v[1]].ChipType)) + if ((ChipMatrix[chip[0]][chip[1]].ChipType == ChipMatrix[chip[0] - 1][chip[1]].ChipType) + && (ChipMatrix[chip[0]][chip[1]].ChipType == ChipMatrix[chip[0] - 2][chip[1]].ChipType)) { - if (ChipMatrix[chip.v[0]][chip.v[1]].ChipState == TChip::CS_STANDBY && - ChipMatrix[chip.v[0] - 1][chip.v[1]].ChipState == TChip::CS_STANDBY && - ChipMatrix[chip.v[0] - 2][chip.v[1]].ChipState == TChip::CS_STANDBY) + if (ChipMatrix[chip[0]][chip[1]].ChipState == TChip::CS_STANDBY && + ChipMatrix[chip[0] - 1][chip[1]].ChipState == TChip::CS_STANDBY && + ChipMatrix[chip[0] - 2][chip[1]].ChipState == TChip::CS_STANDBY) { return true; } @@ -301,16 +310,16 @@ bool TMatch3Logic::ChipCanBeMatchedLeft(ivec2 chip) return false; } -bool TMatch3Logic::ChipCanBeMatchedRight(ivec2 chip) +bool TMatch3Logic::ChipCanBeMatchedRight(Eigen::Vector2i chip) { - if (chip.v[0] <= Match3FieldParams.FieldWidth - 3) + if (chip[0] <= Match3FieldParams.FieldWidth - 3) { - if ((ChipMatrix[chip.v[0]][chip.v[1]].ChipType == ChipMatrix[chip.v[0] + 1][chip.v[1]].ChipType) - && (ChipMatrix[chip.v[0]][chip.v[1]].ChipType == ChipMatrix[chip.v[0] + 2][chip.v[1]].ChipType)) + if ((ChipMatrix[chip[0]][chip[1]].ChipType == ChipMatrix[chip[0] + 1][chip[1]].ChipType) + && (ChipMatrix[chip[0]][chip[1]].ChipType == ChipMatrix[chip[0] + 2][chip[1]].ChipType)) { - if (ChipMatrix[chip.v[0]][chip.v[1]].ChipState == TChip::CS_STANDBY && - ChipMatrix[chip.v[0] + 1][chip.v[1]].ChipState == TChip::CS_STANDBY && - ChipMatrix[chip.v[0] + 2][chip.v[1]].ChipState == TChip::CS_STANDBY) + if (ChipMatrix[chip[0]][chip[1]].ChipState == TChip::CS_STANDBY && + ChipMatrix[chip[0] + 1][chip[1]].ChipState == TChip::CS_STANDBY && + ChipMatrix[chip[0] + 2][chip[1]].ChipState == TChip::CS_STANDBY) { return true; } @@ -321,9 +330,9 @@ bool TMatch3Logic::ChipCanBeMatchedRight(ivec2 chip) } -void TMatch3Logic::UnmatchChips(std::vector chipList) +void TMatch3Logic::UnmatchChips(std::vector chipList) { - std::vector::iterator i; + std::vector::iterator i; for (i = chipList.begin(); i != chipList.end(); ++i) { @@ -332,11 +341,11 @@ void TMatch3Logic::UnmatchChips(std::vector chipList) } } -void TMatch3Logic::ReplaceAnimation(ivec2 p) +void TMatch3Logic::ReplaceAnimation(Eigen::Vector2i p) { - TChip& chip = ChipMatrix[p.v[0]][p.v[1]]; + TChip& chip = ChipMatrix[p[0]][p[1]]; if (ResourceManager->HalibutAnimationManager.AnimationExists(chip.AnimName)) { @@ -357,11 +366,11 @@ void TMatch3Logic::ReplaceAnimation(ivec2 p) } -void TMatch3Logic::MoveVertexListShiftBack(TRenderPairList::iterator renderPairItr, cardinal moveFrom) +void TMatch3Logic::MoveVertexListShiftBack(TRenderPairList::iterator renderPairItr, size_t moveFrom) { - for (cardinal i = 0; i < ChipMatrix.size(); i++) + for (size_t i = 0; i < ChipMatrix.size(); i++) { - for (cardinal j = 0; j < ChipMatrix[i].size(); j++) + for (size_t j = 0; j < ChipMatrix[i].size(); j++) { if (ChipMatrix[i][j].RenderPair == renderPairItr) { @@ -369,21 +378,21 @@ void TMatch3Logic::MoveVertexListShiftBack(TRenderPairList::iterator renderPairI { ChipMatrix[i][j].VertexListShift -= 6; - ReplaceAnimation(ivec2(i, j)); + ReplaceAnimation(Eigen::Vector2i(i, j)); } } } } } -void TMatch3Logic::AddChipToUp(cardinal colNum, int chipType, vec2 spawnPos, TChip::TChipState chipState) +void TMatch3Logic::AddChipToUp(size_t colNum, int chipType, Eigen::Vector2f spawnPos, TChip::TChipState chipState) { - cardinal yPos = ChipMatrix[colNum].size(); + size_t yPos = ChipMatrix[colNum].size(); - vec2 posFrom = spawnPos; - vec2 posTo = posFrom + vec2(Match3FieldParams.CellWidth, Match3FieldParams.CellHeight); + Eigen::Vector2f posFrom = spawnPos; + Eigen::Vector2f posTo = posFrom + Eigen::Vector2f(Match3FieldParams.CellWidth, Match3FieldParams.CellHeight); - cardinal renderPairIndex; + size_t renderPairIndex; if (chipState == TChip::CS_LOCKED) { @@ -398,29 +407,29 @@ void TMatch3Logic::AddChipToUp(cardinal colNum, int chipType, vec2 spawnPos, TCh std::vector vertexCoordArr = MakeVertexCoordVec(posFrom, posTo); - std::vector texCoordArr = MakeTexCoordVec(); + std::vector texCoordArr = MakeTexCoordVec(); triangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].insert(triangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].end(), vertexCoordArr.begin(), vertexCoordArr.end()); triangleList.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].insert(triangleList.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].end(), texCoordArr.begin(), texCoordArr.end()); - cardinal vertexListShift = RenderPairIteratorVector[renderPairIndex]->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].size()-6; + size_t vertexListShift = RenderPairIteratorVector[renderPairIndex]->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].size()-6; ChipMatrix[colNum].push_back(TChip(chipType, RenderPairIteratorVector[renderPairIndex], vertexListShift, chipState)); - ReplaceAnimation(ivec2(colNum, yPos)); + ReplaceAnimation(Eigen::Vector2i(colNum, yPos)); triangleList.NeedRefreshBuffer = true; } -void TMatch3Logic::InsertEmptyChip(cardinal colNum, cardinal rowNum, int chipType) +void TMatch3Logic::InsertEmptyChip(size_t colNum, size_t rowNum, int chipType) { - vec2 posFrom = GetExpectedLeftBottomPos(colNum, rowNum); - vec2 posTo = posFrom + vec2(Match3FieldParams.CellWidth, Match3FieldParams.CellHeight); + Eigen::Vector2f posFrom = GetExpectedLeftBottomPos(colNum, rowNum); + Eigen::Vector2f posTo = posFrom + Eigen::Vector2f(Match3FieldParams.CellWidth, Match3FieldParams.CellHeight); - cardinal renderPairIndex = Match3FieldParams.ChipTypeCount * 2 + chipType; + size_t renderPairIndex = Match3FieldParams.ChipTypeCount * 2 + chipType; TChip::TChipState chipState = TChip::CS_X; @@ -428,34 +437,34 @@ void TMatch3Logic::InsertEmptyChip(cardinal colNum, cardinal rowNum, int chipTyp std::vector vertexCoordArr = MakeVertexCoordVec(posFrom, posTo); - std::vector texCoordArr = MakeTexCoordVec(); + std::vector texCoordArr = MakeTexCoordVec(); triangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].insert(triangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].end(), vertexCoordArr.begin(), vertexCoordArr.end()); triangleList.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].insert(triangleList.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].end(), texCoordArr.begin(), texCoordArr.end()); - cardinal vertexListShift = RenderPairIteratorVector[renderPairIndex]->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].size()-6; + size_t vertexListShift = RenderPairIteratorVector[renderPairIndex]->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].size()-6; ChipMatrix[colNum].insert(ChipMatrix[colNum].begin() + rowNum, TChip(chipType, RenderPairIteratorVector[renderPairIndex], vertexListShift, chipState)); - ReplaceAnimation(ivec2(colNum, rowNum)); + ReplaceAnimation(Eigen::Vector2i(colNum, rowNum)); triangleList.NeedRefreshBuffer = true; - vec2 pos = GetExpectedLeftBottomPos(colNum, rowNum); + Eigen::Vector2f pos = GetExpectedLeftBottomPos(colNum, rowNum); - ChipDeletingVector.push_back(TChipDeletingData(ivec2(colNum, rowNum), pos)); + ChipDeletingVector.push_back(TChipDeletingData(Eigen::Vector2i(colNum, rowNum), pos)); } -void TMatch3Logic::UpdateChipSwapping(cardinal dt) +void TMatch3Logic::UpdateChipSwapping(size_t dt) { std::vector::iterator i = ChipSwappingPairVector.begin(); - std::vector > chipsToSwapAgain; + std::vector > chipsToSwapAgain; while (i != ChipSwappingPairVector.end()) { @@ -465,13 +474,13 @@ void TMatch3Logic::UpdateChipSwapping(cardinal dt) if (i->T >= 1.f) { - ivec2 chip1pos = i->Chip1; - ivec2 chip2pos = i->Chip2; + Eigen::Vector2i chip1pos = i->Chip1; + Eigen::Vector2i chip2pos = i->Chip2; bool isReturning = i->IsReturning; - TChip& chip1 = ChipMatrix[chip1pos.v[0]][chip1pos.v[1]]; - TChip& chip2 = ChipMatrix[chip2pos.v[0]][chip2pos.v[1]]; + TChip& chip1 = ChipMatrix[chip1pos[0]][chip1pos[1]]; + TChip& chip2 = ChipMatrix[chip2pos[0]][chip2pos[1]]; TChip c = chip1; @@ -492,12 +501,12 @@ void TMatch3Logic::UpdateChipSwapping(cardinal dt) //Check if chips do if (!isReturning) { - std::vector matchingChipList = GetAvailableMatchingChips(); + std::vector matchingChipList = GetAvailableMatchingChips(); if (matchingChipList.size() == 0) { //SwapChips(chip1pos, chip2pos); - chipsToSwapAgain.push_back(std::pair(chip1pos, chip2pos)); + chipsToSwapAgain.push_back(std::pair(chip1pos, chip2pos)); } } @@ -505,8 +514,8 @@ void TMatch3Logic::UpdateChipSwapping(cardinal dt) else { - TChip& chip1 = ChipMatrix[i->Chip1.v[0]][i->Chip1.v[1]]; - TChip& chip2 = ChipMatrix[i->Chip2.v[0]][i->Chip2.v[1]]; + TChip& chip1 = ChipMatrix[i->Chip1[0]][i->Chip1[1]]; + TChip& chip2 = ChipMatrix[i->Chip2[0]][i->Chip2[1]]; vec3 newPosChip1 = vec3(i->Chip1RealPosFrom + (i->Chip2RealPosFrom - i->Chip1RealPosFrom) * i->T, 0); vec3 newPosChip2 = vec3(i->Chip2RealPosFrom + (i->Chip1RealPosFrom - i->Chip2RealPosFrom) * i->T, 0); @@ -533,7 +542,7 @@ void TMatch3Logic::UpdateChipSwapping(cardinal dt) } - std::vector >::iterator pairVecItr; + std::vector >::iterator pairVecItr; for (pairVecItr = chipsToSwapAgain.begin(); pairVecItr != chipsToSwapAgain.end(); ++pairVecItr) { @@ -542,12 +551,12 @@ void TMatch3Logic::UpdateChipSwapping(cardinal dt) } -void TMatch3Logic::UpdateChipPosition(cardinal dt) +void TMatch3Logic::UpdateChipPosition(size_t dt) { - for (cardinal i=0; i 0 && ChipIsFinishing(ivec2(i, j-1)))) + if (realPos[1] < expectedPos[1] && chip.Velocity <= 0 && !(j > 0 && ChipIsFinishing(Eigen::Vector2i(i, j-1)))) { chip.Velocity = -chip.Velocity * Match3FieldParams.ChipK; @@ -600,8 +609,8 @@ void TMatch3Logic::UpdateChipPosition(cardinal dt) if (fabs(chip.Velocity) <= Match3FieldParams.ChipVelocityEpsilon) { - if (fabs(expectedPos.v[0] - realPos.v[0]) <= Match3FieldParams.ChipPositionEpsilon && - fabs(expectedPos.v[1] - realPos.v[1]) <= Match3FieldParams.ChipPositionEpsilon + if (fabs(expectedPos[0] - realPos[0]) <= Match3FieldParams.ChipPositionEpsilon && + fabs(expectedPos[1] - realPos[1]) <= Match3FieldParams.ChipPositionEpsilon ) { chip.ChipState = TChip::CS_STANDBY; @@ -613,19 +622,19 @@ void TMatch3Logic::UpdateChipPosition(cardinal dt) chip.RenderPair->second.NeedRefreshBuffer = true; - for (cardinal k = j + 1; k < ChipMatrix[i].size(); k++) + for (size_t k = j + 1; k < ChipMatrix[i].size(); k++) { TChip& chipAbove = ChipMatrix[i][k]; - vec2 posAbove = chipAbove.GetLeftBottomPos(); + Eigen::Vector2f posAbove = chipAbove.GetLeftBottomPos(); - if (chipAbove.GetLeftBottomPos().v[1] - chip.GetLeftBottomPos().v[1] < Match3FieldParams.CellHeight) + if (chipAbove.GetLeftBottomPos()[1] - chip.GetLeftBottomPos()[1] < Match3FieldParams.CellHeight) { - if (!ChipIsLocked(ivec2(i, k)) && !ChipIsFinishing(ivec2(i, k))) + if (!ChipIsLocked(Eigen::Vector2i(i, k)) && !ChipIsFinishing(Eigen::Vector2i(i, k))) { chipAbove.ChipState = TChip::CS_FALLING; - chipAbove.SetLeftBottomPos(chip.GetLeftBottomPos() + vec2(0, Match3FieldParams.CellHeight)); + chipAbove.SetLeftBottomPos(chip.GetLeftBottomPos() + Eigen::Vector2f(0, Match3FieldParams.CellHeight)); chipAbove.Velocity = chip.Velocity; chipAbove.RenderPair->second.NeedRefreshBuffer = true; } @@ -639,14 +648,14 @@ void TMatch3Logic::UpdateChipPosition(cardinal dt) void TMatch3Logic::RemoveBubbles() { - cardinal max_y = ChipMatrix.size()-1; + size_t max_y = ChipMatrix.size()-1; - for (cardinal i=0; i < ChipMatrix[max_y].size(); i++) + for (size_t i=0; i < ChipMatrix[max_y].size(); i++) { if (ChipMatrix[i][max_y].ChipState == TChip::CS_FINISHING) { - DestroyChip(ivec2(i, max_y)); - AddChipToUp(i, rand() % ChipTypeCount, GetExpectedLeftBottomPos(i, ChipMatrix[i].size())+vec2(0, Match3FieldParams.CellHeight)); + DestroyChip(Eigen::Vector2i(i, max_y)); + AddChipToUp(i, rand() % ChipTypeCount, GetExpectedLeftBottomPos(i, ChipMatrix[i].size())+Eigen::Vector2f(0, Match3FieldParams.CellHeight)); } } } @@ -654,63 +663,63 @@ void TMatch3Logic::RemoveBubbles() void TMatch3Logic::TryMatchAllChips() { - std::vector matchingChips = GetAvailableMatchingChips(); + std::vector matchingChips = GetAvailableMatchingChips(); - std::vector::iterator i; + std::vector::iterator i; for (i = matchingChips.begin(); i != matchingChips.end(); ++i) { - ivec2 p = *i; + Eigen::Vector2i p = *i; - int chipType = ChipMatrix[p.v[0]][p.v[1]].ChipType; + int chipType = ChipMatrix[p[0]][p[1]].ChipType; DestroyChip(p); - InsertEmptyChip(p.v[0], p.v[1], chipType); + InsertEmptyChip(p[0], p[1], chipType); } } -void TMatch3Logic::DestroyChip(ivec2 p) +void TMatch3Logic::DestroyChip(Eigen::Vector2i p) { - ChipMatrix[p.v[0]][p.v[1]].RenderPair->second.NeedRefreshBuffer = true; + ChipMatrix[p[0]][p[1]].RenderPair->second.NeedRefreshBuffer = true; - ResourceManager->HalibutAnimationManager.DeleteAnimationObject(ChipMatrix[p.v[0]][p.v[1]].AnimName); + ResourceManager->HalibutAnimationManager.DeleteAnimationObject(ChipMatrix[p[0]][p[1]].AnimName); - ChipMatrix[p.v[0]][p.v[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].erase( - ChipMatrix[p.v[0]][p.v[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].begin() + ChipMatrix[p.v[0]][p.v[1]].VertexListShift, - ChipMatrix[p.v[0]][p.v[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].begin() + ChipMatrix[p.v[0]][p.v[1]].VertexListShift + 6); + ChipMatrix[p[0]][p[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].erase( + ChipMatrix[p[0]][p[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift, + ChipMatrix[p[0]][p[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift + 6); - ChipMatrix[p.v[0]][p.v[1]].RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].erase( - ChipMatrix[p.v[0]][p.v[1]].RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].begin() + ChipMatrix[p.v[0]][p.v[1]].VertexListShift, - ChipMatrix[p.v[0]][p.v[1]].RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].begin() + ChipMatrix[p.v[0]][p.v[1]].VertexListShift + 6); + ChipMatrix[p[0]][p[1]].RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].erase( + ChipMatrix[p[0]][p[1]].RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift, + ChipMatrix[p[0]][p[1]].RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift + 6); - MoveVertexListShiftBack(ChipMatrix[p.v[0]][p.v[1]].RenderPair, ChipMatrix[p.v[0]][p.v[1]].VertexListShift); + MoveVertexListShiftBack(ChipMatrix[p[0]][p[1]].RenderPair, ChipMatrix[p[0]][p[1]].VertexListShift); - ChipMatrix[p.v[0]].erase(ChipMatrix[p.v[0]].begin() + p.v[1]); + ChipMatrix[p[0]].erase(ChipMatrix[p[0]].begin() + p[1]); /* - for (cardinal i=p.v[1]; i < ChipMatrix[p.v[0]].size(); i++) + for (size_t i=p[1]; i < ChipMatrix[p[0]].size(); i++) { - if (!ChipIsLocked(ivec2(p.v[0], i)) && !ChipIsFinishing(ivec2(p.v[0], i))) + if (!ChipIsLocked(Eigen::Vector2i(p[0], i)) && !ChipIsFinishing(Eigen::Vector2i(p[0], i))) { - ChipMatrix[p.v[0]][i].ChipState = TChip::CS_FALLING; + ChipMatrix[p[0]][i].ChipState = TChip::CS_FALLING; } }*/ } -void TMatch3Logic::ChangeChipType(ivec2 p) +void TMatch3Logic::ChangeChipType(Eigen::Vector2i p) { - cardinal newChipType = rand() % ChipTypeCount; + size_t newChipType = rand() % ChipTypeCount; - TChip& chip = ChipMatrix[p.v[0]][p.v[1]]; + TChip& chip = ChipMatrix[p[0]][p[1]]; std::vector::iterator vertexCoordItrBegin = chip.RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].begin() + chip.VertexListShift; std::vector::iterator vertexCoordItrEnd = vertexCoordItrBegin + 6; - std::vector::iterator texCoordItrBegin = chip.RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].begin() + chip.VertexListShift; - std::vector::iterator texCoordItrEnd = texCoordItrBegin + 6; + std::vector::iterator texCoordItrBegin = chip.RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].begin() + chip.VertexListShift; + std::vector::iterator texCoordItrEnd = texCoordItrBegin + 6; std::vector vertexCoordSubVec(vertexCoordItrBegin, vertexCoordItrEnd); - std::vector texCoordSubVec(texCoordItrBegin, texCoordItrEnd); + std::vector texCoordSubVec(texCoordItrBegin, texCoordItrEnd); chip.RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].erase(vertexCoordItrBegin, vertexCoordItrEnd); chip.RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].erase(texCoordItrBegin, texCoordItrEnd); @@ -731,20 +740,20 @@ void TMatch3Logic::ChangeChipType(ivec2 p) //Hack to make sure animation is replaced by new one ResourceManager->HalibutAnimationManager.DeleteAnimationObject(chip.AnimName); - ReplaceAnimation(ivec2(p.v[0], p.v[1])); + ReplaceAnimation(Eigen::Vector2i(p[0], p[1])); } -void TMatch3Logic::SelectChip(ivec2 pos) +void TMatch3Logic::SelectChip(Eigen::Vector2i pos) { - if (!(selectedChip == ivec2(-1, -1))) + if (!(selectedChip == Eigen::Vector2i(-1, -1))) { - StopAnimateChip(selectedChip.v[0], selectedChip.v[1]); + StopAnimateChip(selectedChip[0], selectedChip[1]); } - StartAnimateChip(pos.v[0], pos.v[1]); + StartAnimateChip(pos[0], pos[1]); selectedChip = pos; } @@ -752,27 +761,27 @@ void TMatch3Logic::SelectChip(ivec2 pos) void TMatch3Logic::UnselectChip() { - if (!(selectedChip == ivec2(-1, -1))) + if (!(selectedChip == Eigen::Vector2i(-1, -1))) { - StopAnimateChip(selectedChip.v[0], selectedChip.v[1]); - selectedChip = ivec2(-1, -1); + StopAnimateChip(selectedChip[0], selectedChip[1]); + selectedChip = Eigen::Vector2i(-1, -1); } } -ivec2 TMatch3Logic::GetSelectedChip() +Eigen::Vector2i TMatch3Logic::GetSelectedChip() { return selectedChip; } -std::vector TMatch3Logic::GetAvailableMatchingChips() +std::vector TMatch3Logic::GetAvailableMatchingChips() { - std::vector result; + std::vector result; - for (cardinal x=0; x TMatch3Logic::GetAvailableMatchingChips() result.push_back(chip); } - if (std::find(result.begin(), result.end(), chip + ivec2(0, 1)) == result.end()) + if (std::find(result.begin(), result.end(), chip + Eigen::Vector2i(0, 1)) == result.end()) { - result.push_back(chip + ivec2(0, 1)); + result.push_back(chip + Eigen::Vector2i(0, 1)); } - if (std::find(result.begin(), result.end(), chip + ivec2(0, 2)) == result.end()) + if (std::find(result.begin(), result.end(), chip + Eigen::Vector2i(0, 2)) == result.end()) { - result.push_back(chip + ivec2(0, 2)); + result.push_back(chip + Eigen::Vector2i(0, 2)); } } @@ -802,14 +811,14 @@ std::vector TMatch3Logic::GetAvailableMatchingChips() result.push_back(chip); } - if (std::find(result.begin(), result.end(), chip - ivec2(0, 1)) == result.end()) + if (std::find(result.begin(), result.end(), chip - Eigen::Vector2i(0, 1)) == result.end()) { - result.push_back(chip - ivec2(0, 1)); + result.push_back(chip - Eigen::Vector2i(0, 1)); } - if (std::find(result.begin(), result.end(), chip - ivec2(0, 2)) == result.end()) + if (std::find(result.begin(), result.end(), chip - Eigen::Vector2i(0, 2)) == result.end()) { - result.push_back(chip - ivec2(0, 2)); + result.push_back(chip - Eigen::Vector2i(0, 2)); } } @@ -821,14 +830,14 @@ std::vector TMatch3Logic::GetAvailableMatchingChips() result.push_back(chip); } - if (std::find(result.begin(), result.end(), chip - ivec2(1, 0)) == result.end()) + if (std::find(result.begin(), result.end(), chip - Eigen::Vector2i(1, 0)) == result.end()) { - result.push_back(chip - ivec2(1, 0)); + result.push_back(chip - Eigen::Vector2i(1, 0)); } - if (std::find(result.begin(), result.end(), chip - ivec2(2, 0)) == result.end()) + if (std::find(result.begin(), result.end(), chip - Eigen::Vector2i(2, 0)) == result.end()) { - result.push_back(chip - ivec2(2, 0)); + result.push_back(chip - Eigen::Vector2i(2, 0)); } } @@ -840,14 +849,14 @@ std::vector TMatch3Logic::GetAvailableMatchingChips() result.push_back(chip); } - if (std::find(result.begin(), result.end(), chip + ivec2(1, 0)) == result.end()) + if (std::find(result.begin(), result.end(), chip + Eigen::Vector2i(1, 0)) == result.end()) { - result.push_back(chip + ivec2(1, 0)); + result.push_back(chip + Eigen::Vector2i(1, 0)); } - if (std::find(result.begin(), result.end(), chip + ivec2(2, 0)) == result.end()) + if (std::find(result.begin(), result.end(), chip + Eigen::Vector2i(2, 0)) == result.end()) { - result.push_back(chip + ivec2(2, 0)); + result.push_back(chip + Eigen::Vector2i(2, 0)); } } @@ -860,30 +869,30 @@ std::vector TMatch3Logic::GetAvailableMatchingChips() } -void TMatch3Logic::SwapChips(ivec2 p1, ivec2 p2, bool isReturning) +void TMatch3Logic::SwapChips(Eigen::Vector2i p1, Eigen::Vector2i p2, bool isReturning) { - vec2 chip1PosFrom(LeftBottomPosField.v[0] + p1.v[0]*Match3FieldParams.CellWidth, LeftBottomPosField.v[1] + p1.v[1]*Match3FieldParams.CellHeight); - vec2 chip2PosFrom(LeftBottomPosField.v[0] + p2.v[0]*Match3FieldParams.CellWidth, LeftBottomPosField.v[1] + p2.v[1]*Match3FieldParams.CellHeight); + Eigen::Vector2f chip1PosFrom(LeftBottomPosField[0] + p1[0]*Match3FieldParams.CellWidth, LeftBottomPosField[1] + p1[1]*Match3FieldParams.CellHeight); + Eigen::Vector2f chip2PosFrom(LeftBottomPosField[0] + p2[0]*Match3FieldParams.CellWidth, LeftBottomPosField[1] + p2[1]*Match3FieldParams.CellHeight); ChipSwappingPairVector.push_back(TChipSwappingPair(p1, p2, chip1PosFrom, chip2PosFrom)); (ChipSwappingPairVector.end() - 1)->IsReturning = isReturning; - ChipMatrix[p1.v[0]][p1.v[1]].ChipState = TChip::CS_SWAPPING; - ChipMatrix[p2.v[0]][p2.v[1]].ChipState = TChip::CS_SWAPPING; + ChipMatrix[p1[0]][p1[1]].ChipState = TChip::CS_SWAPPING; + ChipMatrix[p2[0]][p2[1]].ChipState = TChip::CS_SWAPPING; } -void TMatch3Logic::ResetChipPos(ivec2 p) +void TMatch3Logic::ResetChipPos(Eigen::Vector2i p) { - vec2 posFrom(LeftBottomPosField.v[0] + p.v[0]*Match3FieldParams.CellWidth, LeftBottomPosField.v[1] + p.v[1]*Match3FieldParams.CellHeight); - vec2 posTo(LeftBottomPosField.v[0] + (p.v[0] + 1)*Match3FieldParams.CellWidth, LeftBottomPosField.v[1] + (p.v[1] + 1)*Match3FieldParams.CellHeight); + Eigen::Vector2f posFrom(LeftBottomPosField[0] + p[0]*Match3FieldParams.CellWidth, LeftBottomPosField[1] + p[1]*Match3FieldParams.CellHeight); + Eigen::Vector2f posTo(LeftBottomPosField[0] + (p[0] + 1)*Match3FieldParams.CellWidth, LeftBottomPosField[1] + (p[1] + 1)*Match3FieldParams.CellHeight); std::vector vertexCoordVec = MakeVertexCoordVec(posFrom, posTo); - TChip& chip = ChipMatrix[p.v[0]][p.v[1]]; + TChip& chip = ChipMatrix[p[0]][p[1]]; - for (cardinal i = 0; isecond.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][chip.VertexListShift + i] = vertexCoordVec[i]; } @@ -893,7 +902,7 @@ void TMatch3Logic::ResetChipPos(ivec2 p) } -void TMatch3Logic::UpdateLogic(cardinal dt) +void TMatch3Logic::UpdateLogic(size_t dt) { if (dt > 1000) @@ -920,25 +929,25 @@ void TMatch3Logic::UpdateLogic(cardinal dt) i->T = 1.f; } - ivec2 p = i->Chip; - vec2 leftBottomPos = i->Pos; + Eigen::Vector2i p = i->Chip; + Eigen::Vector2f leftBottomPos = i->Pos; - vec2 halfPos = vec2(Match3FieldParams.CellWidth / 2.f, Match3FieldParams.CellHeight / 2.f); + Eigen::Vector2f halfPos = Eigen::Vector2f(Match3FieldParams.CellWidth / 2.f, Match3FieldParams.CellHeight / 2.f); - vec2 centerPos = leftBottomPos + halfPos; + Eigen::Vector2f centerPos = leftBottomPos + halfPos; std::vector vertexCoordArr = MakeVertexCoordVec(centerPos - (1.f - i->T)*halfPos, centerPos + (1.f - i->T)*halfPos); for (int t = 0; t < 6; t++) { - ChipMatrix[p.v[0]][p.v[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][ChipMatrix[p.v[0]][p.v[1]].VertexListShift + t] = vertexCoordArr[t]; + ChipMatrix[p[0]][p[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][ChipMatrix[p[0]][p[1]].VertexListShift + t] = vertexCoordArr[t]; } if (i->T == 1.f) { - ChipMatrix[p.v[0]][p.v[1]].ChipState = TChip::CS_FINISHING; + ChipMatrix[p[0]][p[1]].ChipState = TChip::CS_FINISHING; i = ChipDeletingVector.erase(i); erased = true; @@ -955,20 +964,20 @@ void TMatch3Logic::UpdateLogic(cardinal dt) -void TMatch3Logic::HitFieldWithPattern(ivec2 pos, std::vector > pattern, std::vector > jumpingPattern) +void TMatch3Logic::HitFieldWithPattern(Eigen::Vector2i pos, std::vector > pattern, std::vector > jumpingPattern) { const float CONST_VELOCITY_TO_ADD = 0.2f; - for (cardinal i = 0; i < pattern.size(); i++) + for (size_t i = 0; i < pattern.size(); i++) { for (int j = static_cast(pattern[i].size()-1); j >=0; j--) { - ivec2 fieldPos = pos + ivec2(i,j); + Eigen::Vector2i fieldPos = pos + Eigen::Vector2i(i,j); - if (fieldPos.v[0] >= 0 && fieldPos.v[0] < static_cast(ChipMatrix.size()) && - fieldPos.v[1] >= 0 && fieldPos.v[1] < static_cast(ChipMatrix[fieldPos.v[0]].size())) + if (fieldPos[0] >= 0 && fieldPos[0] < static_cast(ChipMatrix.size()) && + fieldPos[1] >= 0 && fieldPos[1] < static_cast(ChipMatrix[fieldPos[0]].size())) { if (ChipIsStable(fieldPos)) @@ -976,52 +985,52 @@ void TMatch3Logic::HitFieldWithPattern(ivec2 pos, std::vector if (pattern[i][j] > 0) { DestroyChip(fieldPos); - InsertEmptyChip(fieldPos.v[0], fieldPos.v[1], 0); + InsertEmptyChip(fieldPos[0], fieldPos[1], 0); } } if (ChipIsLocked(fieldPos)) { - ChipMatrix[fieldPos.v[0]][fieldPos.v[1]].ChipState = TChip::CS_STANDBY; + ChipMatrix[fieldPos[0]][fieldPos[1]].ChipState = TChip::CS_STANDBY; } } } } - for (cardinal i = 0; i < jumpingPattern.size(); i++) + for (size_t i = 0; i < jumpingPattern.size(); i++) { - ivec2 abovePos = pos + ivec2(i, jumpingPattern[i].size()); + Eigen::Vector2i abovePos = pos + Eigen::Vector2i(i, jumpingPattern[i].size()); - if (abovePos.v[0] >= 0 && abovePos.v[0] < static_cast(ChipMatrix.size()) && - abovePos.v[1] >= 0 && abovePos.v[1] < static_cast(ChipMatrix[i].size())) + if (abovePos[0] >= 0 && abovePos[0] < static_cast(ChipMatrix.size()) && + abovePos[1] >= 0 && abovePos[1] < static_cast(ChipMatrix[i].size())) { - if (ChipMatrix[abovePos.v[0]][abovePos.v[1]].ChipState == TChip::CS_FALLING || - ChipMatrix[abovePos.v[0]][abovePos.v[1]].ChipState == TChip::CS_STANDBY) + if (ChipMatrix[abovePos[0]][abovePos[1]].ChipState == TChip::CS_FALLING || + ChipMatrix[abovePos[0]][abovePos[1]].ChipState == TChip::CS_STANDBY) { - ChipMatrix[abovePos.v[0]][abovePos.v[1]].ChipState = TChip::CS_FALLING; - ChipMatrix[abovePos.v[0]][abovePos.v[1]].Velocity += CONST_VELOCITY_TO_ADD; + ChipMatrix[abovePos[0]][abovePos[1]].ChipState = TChip::CS_FALLING; + ChipMatrix[abovePos[0]][abovePos[1]].Velocity += CONST_VELOCITY_TO_ADD; } } - for (cardinal j = 0; j < jumpingPattern[i].size(); j++) + for (size_t j = 0; j < jumpingPattern[i].size(); j++) { - ivec2 fieldPos = pos + ivec2(i,j); + Eigen::Vector2i fieldPos = pos + Eigen::Vector2i(i,j); - if (fieldPos.v[0] >= 0 && fieldPos.v[0] < static_cast(ChipMatrix.size()) && - fieldPos.v[1] >= 0 && fieldPos.v[1] < static_cast(ChipMatrix[fieldPos.v[0]].size())) + if (fieldPos[0] >= 0 && fieldPos[0] < static_cast(ChipMatrix.size()) && + fieldPos[1] >= 0 && fieldPos[1] < static_cast(ChipMatrix[fieldPos[0]].size())) { - if (ChipMatrix[fieldPos.v[0]][fieldPos.v[1]].ChipState == TChip::CS_FALLING || - ChipMatrix[fieldPos.v[0]][fieldPos.v[1]].ChipState == TChip::CS_STANDBY) + if (ChipMatrix[fieldPos[0]][fieldPos[1]].ChipState == TChip::CS_FALLING || + ChipMatrix[fieldPos[0]][fieldPos[1]].ChipState == TChip::CS_STANDBY) { if (jumpingPattern[i][j] > 0) { - ChipMatrix[fieldPos.v[0]][fieldPos.v[1]].ChipState = TChip::CS_FALLING; - ChipMatrix[fieldPos.v[0]][fieldPos.v[1]].Velocity += CONST_VELOCITY_TO_ADD; + ChipMatrix[fieldPos[0]][fieldPos[1]].ChipState = TChip::CS_FALLING; + ChipMatrix[fieldPos[0]][fieldPos[1]].Velocity += CONST_VELOCITY_TO_ADD; } } } @@ -1040,7 +1049,7 @@ void TMatch3Logic::HitFieldWithPattern(ivec2 pos, std::vector TMatch3Field::TMatch3Field() { - LastTappedPos = vec2(0,0); + LastTappedPos = Eigen::Vector2f(0,0); } TMatch3Field::TMatch3Field(const TMatch3Field& m) @@ -1080,7 +1089,7 @@ void TMatch3Field::FillBasicChipMatrixAndTriangleList() std::vector triangleListVec; - for (cardinal i = 0; i < Match3FieldParams.ChipTypeCount; i++) + for (size_t i = 0; i < Match3FieldParams.ChipTypeCount; i++) { TriangleListVector.push_back(TRenderPair(Match3FieldParams.ChipTemplateParamsArr[i].SelectedRenderParams, TTriangleList())); } @@ -1101,7 +1110,7 @@ void TMatch3Field::FillBasicChipMatrixAndTriangleList() - for (cardinal i = 0; i < Match3FieldParams.ChipTypeCount; i++) + for (size_t i = 0; i < Match3FieldParams.ChipTypeCount; i++) { TriangleListVector.push_back(TRenderPair(Match3FieldParams.ChipTemplateParamsArr[i].FinishingRenderParams, TTriangleList())); } @@ -1113,12 +1122,12 @@ void TMatch3Field::FillBasicChipMatrixAndTriangleList() triangleListVec.push_back(i); } - LeftBottomPos = vec2(150, 0); + LeftBottomPos = Eigen::Vector2f(150, 0); FillRandomChipMatrix(triangleListVec, LeftBottomPos); //Init everything - selectedChip = ivec2(-1, -1); + selectedChip = Eigen::Vector2i(-1, -1); for (TRenderPairList::iterator i = TriangleListVector.begin(); i != TriangleListVector.end(); ++i) { @@ -1129,19 +1138,19 @@ void TMatch3Field::FillBasicChipMatrixAndTriangleList() } -ivec2 TMatch3Field::PosToChip(vec2 pos) +Eigen::Vector2i TMatch3Field::PosToChip(Eigen::Vector2f pos) { int x, y; - vec2 fieldPos = pos - LeftBottomPos; - x = static_cast(fieldPos.v[0] / Match3FieldParams.CellWidth); - y = static_cast(fieldPos.v[1] / Match3FieldParams.CellHeight); + Eigen::Vector2f fieldPos = pos - LeftBottomPos; + x = static_cast(fieldPos[0] / Match3FieldParams.CellWidth); + y = static_cast(fieldPos[1] / Match3FieldParams.CellHeight); - return ivec2(x, y); + return Eigen::Vector2i(x, y); } -void TMatch3Field::Update(cardinal dt) +void TMatch3Field::Update(size_t dt) { TMatch3Logic::UpdateLogic(dt); @@ -1162,14 +1171,14 @@ void TMatch3Field::Update(cardinal dt) } -void TMatch3Field::OnTapDown(vec2 pos) +void TMatch3Field::OnTapDown(Eigen::Vector2f pos) { //See also OnMove LastTappedPos = pos; LastMovePos = LastTappedPos; - ivec2 chip = PosToChip(pos); + Eigen::Vector2i chip = PosToChip(pos); @@ -1196,7 +1205,7 @@ void TMatch3Field::OnTapDown(vec2 pos) jumpingPattern[0][2] = 1; jumpingPattern[1][2] = 0; jumpingPattern[2][2] = 1; - HitFieldWithPattern(chip - ivec2(1, 1), pattern, jumpingPattern); + HitFieldWithPattern(chip - Eigen::Vector2i(1, 1), pattern, jumpingPattern); return;*/ @@ -1226,26 +1235,26 @@ void TMatch3Field::OnTapDown(vec2 pos) } -void TMatch3Field::OnTapUp(vec2 pos) +void TMatch3Field::OnTapUp(Eigen::Vector2f pos) { } -void TMatch3Field::OnMove(vec2 shift) +void TMatch3Field::OnMove(Eigen::Vector2f shift) { - if (selectedChip == ivec2(-1, -1)) + if (selectedChip == Eigen::Vector2i(-1, -1)) { return; } LastMovePos += shift; - if ((LastTappedPos - LastMovePos).v[0] >= Match3FieldParams.CellWidth * 0.5f) + if ((LastTappedPos - LastMovePos)[0] >= Match3FieldParams.CellWidth * 0.5f) { - ivec2 newPosChip = selectedChip + ivec2(1, 0); + Eigen::Vector2i newPosChip = selectedChip + Eigen::Vector2i(1, 0); - if (selectedChip.v[0] <= Match3FieldParams.FieldWidth - 2) + if (selectedChip[0] <= Match3FieldParams.FieldWidth - 2) { if (ChipsCanBeSwapped(selectedChip, newPosChip)) { @@ -1254,11 +1263,11 @@ void TMatch3Field::OnMove(vec2 shift) } } } - else if ((LastMovePos - LastTappedPos).v[0] >= Match3FieldParams.CellWidth * 0.5f) + else if ((LastMovePos - LastTappedPos)[0] >= Match3FieldParams.CellWidth * 0.5f) { - ivec2 newPosChip = selectedChip - ivec2(1, 0); + Eigen::Vector2i newPosChip = selectedChip - Eigen::Vector2i(1, 0); - if (selectedChip.v[0] >= 1) + if (selectedChip[0] >= 1) { if (ChipsCanBeSwapped(selectedChip, newPosChip)) { @@ -1267,11 +1276,11 @@ void TMatch3Field::OnMove(vec2 shift) } } } - else if ((LastMovePos - LastTappedPos).v[1] >= Match3FieldParams.CellHeight * 0.5f) + else if ((LastMovePos - LastTappedPos)[1] >= Match3FieldParams.CellHeight * 0.5f) { - ivec2 newPosChip = selectedChip + ivec2(0, 1); + Eigen::Vector2i newPosChip = selectedChip + Eigen::Vector2i(0, 1); - if (selectedChip.v[1] <= Match3FieldParams.FieldHeight - 2) + if (selectedChip[1] <= Match3FieldParams.FieldHeight - 2) { if (ChipsCanBeSwapped(selectedChip, newPosChip)) { @@ -1280,11 +1289,11 @@ void TMatch3Field::OnMove(vec2 shift) } } } - else if ((LastTappedPos - LastMovePos).v[1] >= Match3FieldParams.CellHeight * 0.5f) + else if ((LastTappedPos - LastMovePos)[1] >= Match3FieldParams.CellHeight * 0.5f) { - ivec2 newPosChip = selectedChip - ivec2(0, 1); + Eigen::Vector2i newPosChip = selectedChip - Eigen::Vector2i(0, 1); - if (selectedChip.v[1] >= 1) + if (selectedChip[1] >= 1) { if (ChipsCanBeSwapped(selectedChip, newPosChip)) { @@ -1297,13 +1306,13 @@ void TMatch3Field::OnMove(vec2 shift) } -bool TMatch3Field::CheckClick(vec2 mousePos) +bool TMatch3Field::CheckClick(Eigen::Vector2f mousePos) { - vec2 fieldPos = mousePos - LeftBottomPos; - if (fieldPos.v[0] >= 0 && fieldPos.v[0] <= Match3FieldParams.FieldWidth*Match3FieldParams.CellWidth) + Eigen::Vector2f fieldPos = mousePos - LeftBottomPos; + if (fieldPos[0] >= 0 && fieldPos[0] <= Match3FieldParams.FieldWidth*Match3FieldParams.CellWidth) { - if (fieldPos.v[1] >= 0 && fieldPos.v[1] <= Match3FieldParams.FieldHeight*Match3FieldParams.CellHeight) + if (fieldPos[1] >= 0 && fieldPos[1] <= Match3FieldParams.FieldHeight*Match3FieldParams.CellHeight) { return true; } @@ -1317,9 +1326,9 @@ bool TMatch3Field::CheckClick(vec2 mousePos) void TMatch3Field::HighlightMatch3() { - std::vector chips = GetAvailableMatchingChips(); + std::vector chips = GetAvailableMatchingChips(); - std::vector::iterator i; + std::vector::iterator i; for (i = chips.begin(); i != chips.end(); ++i) { @@ -1327,3 +1336,5 @@ void TMatch3Field::HighlightMatch3() } } + +#endif \ No newline at end of file diff --git a/jni/match3/match3field.h b/jni/match3/match3field.h index 003a4b7..1b1bb27 100644 --- a/jni/match3/match3field.h +++ b/jni/match3/match3field.h @@ -2,11 +2,12 @@ #define MATCH3FIELD_H_INCLUDED #include "include/Engine.h" +#include -const cardinal CONST_MAX_FIELD_WIDTH = 11; -const cardinal CONST_MAX_FIELD_HEIGHT = 11; +const size_t CONST_MAX_FIELD_WIDTH = 11; +const size_t CONST_MAX_FIELD_HEIGHT = 11; const float CONST_MATCH3_CELL_WIDTH = 42.f; @@ -20,7 +21,7 @@ const float CONST_MATCH3_CELL_HEIGHT = 32.f; const float CONST_CHIP_LOWEST_SPEED = -0.3f; const float CONST_CHIP_ACCELERATION = -0.001f; */ -const cardinal CONST_MATCH_TIME = 150; +const size_t CONST_MATCH_TIME = 150; const float CONST_CHIP_POSITION_EPSILON = 1.f; const float CONST_CHIP_VELOCITY_EPSILON = 0.3f; @@ -28,25 +29,24 @@ const float CONST_CHIP_VELOCITY_EPSILON = 0.3f; const float CONST_CHIP_K = 0.4f; -const cardinal CONST_CHIP_TYPE_COUNT = 4; +const size_t CONST_CHIP_TYPE_COUNT = 4; -struct TChipTemplateParams : public TSerializeInterface +struct TChipTemplateParams : public SE::TSerializeInterface { - THalibutExternalAnimObject SelectedTemplateAnimObject; - THalibutExternalAnimObject FinishingTemplateAnimObject; - TRenderParams SelectedRenderParams; - TRenderParams FinishingRenderParams; + SE::THalibutExternalAnimObject SelectedTemplateAnimObject; + SE::THalibutExternalAnimObject FinishingTemplateAnimObject; + SE::TRenderParams SelectedRenderParams; + SE::TRenderParams FinishingRenderParams; virtual void Serialize(boost::property_tree::ptree& propertyTree); }; - -struct TMatch3FieldParams : public TSerializeInterface +struct TMatch3FieldParams : public SE::TSerializeInterface { - cardinal FieldWidth; - cardinal FieldHeight; + size_t FieldWidth; + size_t FieldHeight; float CellWidth; float CellHeight; float ChipLowestSpeed; @@ -55,9 +55,9 @@ struct TMatch3FieldParams : public TSerializeInterface float ChipPositionEpsilon; float ChipVelocityEpsilon; float ChipK; - cardinal ChipMatchTime; + size_t ChipMatchTime; - cardinal ChipTypeCount; + size_t ChipTypeCount; std::vector ChipTemplateParamsArr; @@ -82,15 +82,14 @@ struct TMatch3FieldParams : public TSerializeInterface }; - struct TChip { int ChipType; // -1 means empty field std::string AnimName; //Generated automatically - TRenderPairList::iterator RenderPair; + SE::TRenderPairList::iterator RenderPair; - cardinal VertexListShift; + size_t VertexListShift; float Velocity; @@ -104,31 +103,32 @@ struct TChip CS_X, } ChipState; - TChip(int chipType, TRenderPairList::iterator renderPair, cardinal vertexListShift, TChipState chipState = CS_FALLING); + TChip(int chipType, SE::TRenderPairList::iterator renderPair, size_t vertexListShift, TChipState chipState = CS_FALLING); ~TChip(); - vec2 GetLeftBottomPos(); - void SetLeftBottomPos(vec2 newPos); - void MoveLeftBottomPos(vec2 shift); + Eigen::Vector2f GetLeftBottomPos(); + void SetLeftBottomPos(Eigen::Vector2f newPos); + void MoveLeftBottomPos(Eigen::Vector2f shift); static int StaticAnimationIndex; }; + struct TChipSwappingPair { float T; - ivec2 Chip1; - ivec2 Chip2; + Eigen::Vector2i Chip1; + Eigen::Vector2i Chip2; - vec2 Chip1RealPosFrom; - vec2 Chip2RealPosFrom; + Eigen::Vector2f Chip1RealPosFrom; + Eigen::Vector2f Chip2RealPosFrom; bool IsReturning; - TChipSwappingPair(ivec2 chip1, ivec2 chip2, vec2 chip1PosFrom, vec2 chip2PosFrom) + TChipSwappingPair(Eigen::Vector2i chip1, Eigen::Vector2i chip2, Eigen::Vector2f chip1PosFrom, Eigen::Vector2f chip2PosFrom) : Chip1(chip1) , Chip2(chip2) , T(0) @@ -143,10 +143,10 @@ struct TChipSwappingPair struct TChipDeletingData { float T; - ivec2 Chip; - vec2 Pos; + Eigen::Vector2i Chip; + Eigen::Vector2f Pos; - TChipDeletingData(ivec2 chip, vec2 pos) + TChipDeletingData(Eigen::Vector2i chip, Eigen::Vector2f pos) : T(0.f) , Chip(chip) , Pos(pos) @@ -154,97 +154,100 @@ struct TChipDeletingData } }; + + class TMatch3Logic { protected: - cardinal ChipTypeCount; + size_t ChipTypeCount; std::vector > ChipMatrix; std::vector ChipSwappingPairVector; std::vector ChipDeletingVector; - std::vector RenderPairIteratorVector; + std::vector RenderPairIteratorVector; - ivec2 selectedChip; + Eigen::Vector2i selectedChip; - vec2 LeftBottomPosField; + Eigen::Vector2f LeftBottomPosField; TMatch3FieldParams Match3FieldParams; - void FillRandomChipMatrix(std::vector renderPairIteratorVector, vec2 leftBottomPos); + void FillRandomChipMatrix(std::vector renderPairIteratorVector, Eigen::Vector2f leftBottomPos); - vec2 GetExpectedLeftBottomPos(cardinal x, cardinal y); + Eigen::Vector2f GetExpectedLeftBottomPos(size_t x, size_t y); - void StartAnimateChip(cardinal x, cardinal y); - void StopAnimateChip(cardinal x, cardinal y); + void StartAnimateChip(size_t x, size_t y); + void StopAnimateChip(size_t x, size_t y); - bool ChipIsLocked(ivec2 chip); - bool ChipIsFinishing(ivec2 chip); - bool ChipIsStable(ivec2 chip); - bool ChipCanBeSelected(ivec2 chip); - bool ChipsCanBeSwapped(ivec2 p1, ivec2 p2); + bool ChipIsLocked(Eigen::Vector2i chip); + bool ChipIsFinishing(Eigen::Vector2i chip); + bool ChipIsStable(Eigen::Vector2i chip); + bool ChipCanBeSelected(Eigen::Vector2i chip); + bool ChipsCanBeSwapped(Eigen::Vector2i p1, Eigen::Vector2i p2); - bool ChipCanBeMatchedUp(ivec2 chip); - bool ChipCanBeMatchedDown(ivec2 chip); - bool ChipCanBeMatchedLeft(ivec2 chip); - bool ChipCanBeMatchedRight(ivec2 chip); + bool ChipCanBeMatchedUp(Eigen::Vector2i chip); + bool ChipCanBeMatchedDown(Eigen::Vector2i chip); + bool ChipCanBeMatchedLeft(Eigen::Vector2i chip); + bool ChipCanBeMatchedRight(Eigen::Vector2i chip); - void UnmatchChips(std::vector chipList); - void UpdateChipPosition(cardinal dt); + void UnmatchChips(std::vector chipList); + void UpdateChipPosition(size_t dt); void RemoveBubbles(); - void ReplaceAnimation(ivec2 p); + void ReplaceAnimation(Eigen::Vector2i p); - void MoveVertexListShiftBack(TRenderPairList::iterator renderPairItr, cardinal moveFrom); - void MoveVertexCoordDown(TRenderPairList::iterator renderPairItr, cardinal moveFrom, float value); + void MoveVertexListShiftBack(SE::TRenderPairList::iterator renderPairItr, size_t moveFrom); + void MoveVertexCoordDown(SE::TRenderPairList::iterator renderPairItr, size_t moveFrom, float value); - void AddChipToUp(cardinal colNum, int chipType, vec2 spawnPos, TChip::TChipState chipState = TChip::CS_FALLING); - void InsertEmptyChip(cardinal colNum, cardinal rowNum, int chipType); + void AddChipToUp(size_t colNum, int chipType, Eigen::Vector2f spawnPos, TChip::TChipState chipState = TChip::CS_FALLING); + void InsertEmptyChip(size_t colNum, size_t rowNum, int chipType); - void UpdateChipSwapping(cardinal dt); + void UpdateChipSwapping(size_t dt); void TryMatchAllChips(); - void DestroyChip(ivec2 p); + void DestroyChip(Eigen::Vector2i p); - void ChangeChipType(ivec2 p); + void ChangeChipType(Eigen::Vector2i p); public: TMatch3Logic(); virtual ~TMatch3Logic(); - void SelectChip(ivec2 pos); + void SelectChip(Eigen::Vector2i pos); void UnselectChip(); - ivec2 GetSelectedChip(); + Eigen::Vector2i GetSelectedChip(); - std::vector GetAvailableMatchingChips(); + std::vector GetAvailableMatchingChips(); - void SwapChips(ivec2 p1, ivec2 p2, bool isReturning = false); + void SwapChips(Eigen::Vector2i p1, Eigen::Vector2i p2, bool isReturning = false); - void ResetChipPos(ivec2 p); + void ResetChipPos(Eigen::Vector2i p); - void UpdateLogic(cardinal dt); + void UpdateLogic(size_t dt); - void HitFieldWithPattern(ivec2 pos, std::vector > pattern, std::vector > jumpingPattern); + void HitFieldWithPattern(Eigen::Vector2i pos, std::vector > pattern, std::vector > jumpingPattern); }; + class TMatch3Controller; -class TMatch3Field : public TMatch3Logic, public TInstancingWidgetAncestor +class TMatch3Field : public TMatch3Logic { protected: void FillBasicChipMatrixAndTriangleList(); //TMatch3Controller& Match3Controller; - vec2 LastTappedPos; - vec2 LastMovePos; + Eigen::Vector2f LastTappedPos; + Eigen::Vector2f LastMovePos; - ivec2 PosToChip(vec2 pos); + Eigen::Vector2i PosToChip(Eigen::Vector2f pos); public: TMatch3Field(); @@ -254,11 +257,11 @@ public: TMatch3Field(TMatch3Controller& match3Controller); ~TMatch3Field(); - virtual void Update(cardinal dt); - virtual void OnTapDown(vec2 pos); - virtual void OnTapUp(vec2 pos); - virtual void OnMove(vec2 shift); - virtual bool CheckClick(vec2 mousePos); + virtual void Update(size_t dt); + virtual void OnTapDown(Eigen::Vector2f pos); + virtual void OnTapUp(Eigen::Vector2f pos); + virtual void OnMove(Eigen::Vector2f shift); + virtual bool CheckClick(Eigen::Vector2f mousePos); void HighlightMatch3(); @@ -268,9 +271,4 @@ public: - - - - - #endif diff --git a/windows/Crystal of Rhylil.sln b/windows/Crystal of Rhylil.sln index 83b9142..7ac83c8 100644 --- a/windows/Crystal of Rhylil.sln +++ b/windows/Crystal of Rhylil.sln @@ -1,32 +1,101 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C++ Express 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Halibut Engine", "..\..\..\Engine\Halibut Engine\Halibut Engine.vcxproj", "{4E274B19-10B2-4987-96C5-76F35A149502}" -EndProject +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Crystal of Rhylil", "Crystal of Rhylil\Crystal of Rhylil.vcxproj", "{0080A3E1-DFBF-4557-B198-E6D5D7724393}" - ProjectSection(ProjectDependencies) = postProject - {4E274B19-10B2-4987-96C5-76F35A149502} = {4E274B19-10B2-4987-96C5-76F35A149502} - EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Engine", "..\..\tes-engine\windows\Engine\Engine.vcxproj", "{534F100C-E611-43BF-B6F3-AD9F9925F703}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "..\..\tes-engine\windows\libpng\libpng.vcxproj", "{03736B28-58F6-4AEA-9D37-B6AC4F5F853B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "..\..\tes-engine\windows\libjpeg\libjpeg.vcxproj", "{A05BADE1-D792-4620-9928-13A7AFD0F195}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug_nosound|Win32 = Debug_nosound|Win32 + Debug_nosound|x64 = Debug_nosound|x64 + Debug_nosound|x86 = Debug_nosound|x86 Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4E274B19-10B2-4987-96C5-76F35A149502}.Debug_nosound|Win32.ActiveCfg = Debug_nosound|Win32 - {4E274B19-10B2-4987-96C5-76F35A149502}.Debug_nosound|Win32.Build.0 = Debug_nosound|Win32 - {4E274B19-10B2-4987-96C5-76F35A149502}.Debug|Win32.ActiveCfg = Debug|Win32 - {4E274B19-10B2-4987-96C5-76F35A149502}.Debug|Win32.Build.0 = Debug|Win32 - {4E274B19-10B2-4987-96C5-76F35A149502}.Release|Win32.ActiveCfg = Release|Win32 - {4E274B19-10B2-4987-96C5-76F35A149502}.Release|Win32.Build.0 = Release|Win32 {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug_nosound|Win32.ActiveCfg = Debug|Win32 {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug_nosound|Win32.Build.0 = Debug|Win32 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug_nosound|x64.ActiveCfg = Debug|x64 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug_nosound|x64.Build.0 = Debug|x64 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug_nosound|x86.ActiveCfg = Debug|Win32 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug_nosound|x86.Build.0 = Debug|Win32 {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug|Win32.ActiveCfg = Debug|Win32 {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug|Win32.Build.0 = Debug|Win32 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug|x64.ActiveCfg = Debug|x64 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug|x64.Build.0 = Debug|x64 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug|x86.ActiveCfg = Debug|Win32 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug|x86.Build.0 = Debug|Win32 {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Release|Win32.ActiveCfg = Release|Win32 {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Release|Win32.Build.0 = Release|Win32 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Release|x64.ActiveCfg = Release|x64 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Release|x64.Build.0 = Release|x64 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Release|x86.ActiveCfg = Release|Win32 + {0080A3E1-DFBF-4557-B198-E6D5D7724393}.Release|x86.Build.0 = Release|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug_nosound|Win32.ActiveCfg = Debug|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug_nosound|Win32.Build.0 = Debug|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug_nosound|x64.ActiveCfg = Debug|x64 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug_nosound|x64.Build.0 = Debug|x64 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug_nosound|x86.ActiveCfg = Debug|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug_nosound|x86.Build.0 = Debug|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug|Win32.ActiveCfg = Debug|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug|Win32.Build.0 = Debug|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug|x64.ActiveCfg = Debug|x64 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug|x64.Build.0 = Debug|x64 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug|x86.ActiveCfg = Debug|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Debug|x86.Build.0 = Debug|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Release|Win32.ActiveCfg = Release|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Release|Win32.Build.0 = Release|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Release|x64.ActiveCfg = Release|x64 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Release|x64.Build.0 = Release|x64 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Release|x86.ActiveCfg = Release|Win32 + {534F100C-E611-43BF-B6F3-AD9F9925F703}.Release|x86.Build.0 = Release|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug_nosound|Win32.ActiveCfg = Debug|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug_nosound|Win32.Build.0 = Debug|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug_nosound|x64.ActiveCfg = Debug|x64 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug_nosound|x64.Build.0 = Debug|x64 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug_nosound|x86.ActiveCfg = Debug|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug_nosound|x86.Build.0 = Debug|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug|Win32.ActiveCfg = Debug|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug|Win32.Build.0 = Debug|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug|x64.ActiveCfg = Debug|x64 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug|x64.Build.0 = Debug|x64 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug|x86.ActiveCfg = Debug|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Debug|x86.Build.0 = Debug|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Release|Win32.ActiveCfg = Release|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Release|Win32.Build.0 = Release|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Release|x64.ActiveCfg = Release|x64 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Release|x64.Build.0 = Release|x64 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Release|x86.ActiveCfg = Release|Win32 + {03736B28-58F6-4AEA-9D37-B6AC4F5F853B}.Release|x86.Build.0 = Release|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug_nosound|Win32.ActiveCfg = Debug|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug_nosound|Win32.Build.0 = Debug|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug_nosound|x64.ActiveCfg = Debug|x64 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug_nosound|x64.Build.0 = Debug|x64 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug_nosound|x86.ActiveCfg = Debug|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug_nosound|x86.Build.0 = Debug|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug|Win32.ActiveCfg = Debug|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug|Win32.Build.0 = Debug|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug|x64.ActiveCfg = Debug|x64 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug|x64.Build.0 = Debug|x64 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug|x86.ActiveCfg = Debug|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Debug|x86.Build.0 = Debug|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Release|Win32.ActiveCfg = Release|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Release|Win32.Build.0 = Release|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Release|x64.ActiveCfg = Release|x64 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Release|x64.Build.0 = Release|x64 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Release|x86.ActiveCfg = Release|Win32 + {A05BADE1-D792-4620-9928-13A7AFD0F195}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/windows/Crystal of Rhylil/Crystal of Rhylil.vcxproj b/windows/Crystal of Rhylil/Crystal of Rhylil.vcxproj index 17de6e2..f5870b1 100644 --- a/windows/Crystal of Rhylil/Crystal of Rhylil.vcxproj +++ b/windows/Crystal of Rhylil/Crystal of Rhylil.vcxproj @@ -1,14 +1,22 @@  - + Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + {0080A3E1-DFBF-4557-B198-E6D5D7724393} @@ -20,12 +28,27 @@ Application true NotSet + v140 + + + Application + true + NotSet + v140 Application false true NotSet + v140 + + + Application + false + true + NotSet + v140 @@ -33,18 +56,33 @@ + + + + + + $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(SalmonEnginePath)include $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;$(SalmonEnginePath)$(Configuration) + + $(VC_IncludePath);$(WindowsSDK_IncludePath) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 + false + $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(SalmonEnginePath)include $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;$(SalmonEnginePath)$(Configuration) + + $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(SalmonEnginePath)include + $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;$(SalmonEnginePath)$(Configuration) + Level3 @@ -58,6 +96,21 @@ $(LibsPath)\boost_1_47_0\boost_windows\libs_engine\$(Configuration);$(LibsPath)\libogg-1.3.0\win32\VS2010\Win32\$(Configuration);$(LibsPath)\libvorbis-1.3.2\win32\VS2010\Win32\$(Configuration);$(LibsPath)\openal\OpenAL11_windows_sdk\libs\Win32;$(LibsPath)\sqplus\lib;$(LibsPath)\DirectXsdk\Lib\x86;$(LibsPath)\lpng1510\projects\vstudio\Debug Library + + + Level3 + Disabled + ../../../eigen;../../../tes-engine;../../../boost_1_63_0/;../../../boost_1_63_0/bin.v2/libs/system/build/msvc-14.0/debug/address-model-64/link-static/threading-multi;../../../boost_1_63_0/bin.v2/libs/date_time/build/msvc-14.0/debug/address-model-64/link-static/threading-multi/;../../../boost_1_63_0/bin.v2/libs/regex/build/msvc-14.0/debug/address-model-64/link-static/threading-multi;../../../boost_1_63_0/bin.v2/libs/thread/build/msvc-14.0/debug/address-model-64/link-static/threading-multi;../../../boost_1_63_0/bin.v2/libs/chrono/build/msvc-14.0/debug/address-model-64/link-static/threading-multi;../../../boost_1_63_0/bin.v2/libs/signals/build/msvc-14.0/debug/address-model-64/link-static/threading-multi;../../../libs/boost-gil-extension;../../../libs/jpeg-9;../../../libs/jpeg-9/vc10;../../../libs/lpng1510 + TARGET_WIN32;DEBUG;_WIN32_WINNT=0x0501;EIGEN_DONT_ALIGN_STATICALLY;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN + 4503 + + + true + libjpeg.lib;libpng.lib;Engine.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + ../../game;../../../tes-engine;../../../eigen;../../../boost_1_63_0/;../../../boost_1_63_0/stage/x64/lib;../../../boost_1_63_0/bin.v2/libs/system/build/msvc-14.0/debug/address-model-64/link-static/threading-multi;../../../boost_1_63_0/bin.v2/libs/date_time/build/msvc-14.0/debug/address-model-64/link-static/threading-multi/;../../../boost_1_63_0/bin.v2/libs/regex/build/msvc-14.0/debug/address-model-64/link-static/threading-multi;../../../boost_1_63_0/bin.v2/libs/thread/build/msvc-14.0/debug/address-model-64/link-static/threading-multi;../../../boost_1_63_0/bin.v2/libs/chrono/build/msvc-14.0/debug/address-model-64/link-static/threading-multi;../../../boost_1_63_0/bin.v2/libs/filesystem/build/msvc-14.0/debug/address-model-64/link-static/threading-multi;../../../boost_1_63_0/bin.v2/libs/signals/build/msvc-14.0/debug/address-model-64/link-static/threading-multi;../../../libs/boost-gil-extension;../../../libs/jpeg-9;../../../libs/jpeg-9/vc10;../../../libs/lpng1510;../x64/Debug + Windows + + Level3 @@ -75,12 +128,31 @@ $(LibsPath)\boost_1_47_0\boost_windows\libs_engine\$(Configuration);$(LibsPath)\libogg-1.3.0\win32\VS2010\Win32\$(Configuration);$(LibsPath)\libvorbis-1.3.2\win32\VS2010\Win32\$(Configuration);$(LibsPath)\openal\OpenAL11_windows_sdk\libs\Win32;$(LibsPath)\sqplus\lib;$(LibsPath)\DirectXsdk\Lib\x86;$(LibsPath)\lpng1510\projects\vstudio\Release Library + + + Level3 + MaxSpeed + true + true + $(SalmonEnginePath);$(LibsPath)\boost_1_47_0;$(LibsPath)\openal\OpenAL11_windows_sdk;$(LibsPath)\libogg-1.3.0\include;$(LibsPath)\libvorbis-1.3.2\include;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include;$(SolutionDir)\..\jni;$(LibsPath)\DirectXsdk\Include;$(LibsPath)\lpng1510 + TARGET_WIN32;TARGET_HALIBUT;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501 + + + true + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;opengl32.lib;glu32.lib;Halibut Engine.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;OpenAL32.lib;zlib.lib;libpng15.lib;sqplus.lib;squirrel.lib;sqdbglib.lib;sqstdlib.lib;dsound.lib;dxguid.lib;%(AdditionalDependencies) + $(LibsPath)\boost_1_47_0\boost_windows\libs_engine\$(Configuration);$(LibsPath)\libogg-1.3.0\win32\VS2010\Win32\$(Configuration);$(LibsPath)\libvorbis-1.3.2\win32\VS2010\Win32\$(Configuration);$(LibsPath)\openal\OpenAL11_windows_sdk\libs\Win32;$(LibsPath)\sqplus\lib;$(LibsPath)\DirectXsdk\Lib\x86;$(LibsPath)\lpng1510\projects\vstudio\Release Library + + TARGET_WIN32;HALIBUT_WIN32;DEBUG;WIN32_LEAN_AND_MEAN + TARGET_WIN32;HALIBUT_WIN32;DEBUG;WIN32_LEAN_AND_MEAN TARGET_WIN32;HALIBUT_WIN32;WIN32_LEAN_AND_MEAN + TARGET_WIN32;HALIBUT_WIN32;WIN32_LEAN_AND_MEAN diff --git a/windows/Crystal of Rhylil/main.cpp b/windows/Crystal of Rhylil/main.cpp index b05cf33..9287157 100644 --- a/windows/Crystal of Rhylil/main.cpp +++ b/windows/Crystal of Rhylil/main.cpp @@ -12,9 +12,19 @@ extern boost::shared_ptr App; int APIENTRY WinMain(HINSTANCE hCurrentInst, HINSTANCE hPreviousInst, LPSTR lpszCmdLine, int nCmdShow) { - App->Height = 480; - App->Width = 800; + int height = 480; + int width = 800; - //Start application - return MainLoop(*App); + if (SE::CreateEngine(width, height)) { + + App->OuterInit(width, height, width, height); + + MainLoop(App.get()); + + App->OuterDeinit(); + + SE::DestroyEngine(); + } + + return 0; } \ No newline at end of file diff --git a/windows/Crystal of Rhylil/main.h b/windows/Crystal of Rhylil/main.h index efe2bfe..552101a 100644 --- a/windows/Crystal of Rhylil/main.h +++ b/windows/Crystal of Rhylil/main.h @@ -1,6 +1,6 @@ #pragma once /* Path to the engine */ -#include "HalibutEngineWindows.h" +#include "include/Engine.h" #include "../../jni/main_code.h"