@@ -0,0 +1,105 @@
#ifndef _PILL_PUZZLE_H_
#define _PILL_PUZZLE_H_

#include "IState.h"
#include <SFML\Graphics.hpp>

class PillPuzzleState : public IState
{
public:
PillPuzzleState(Application* app);
~PillPuzzleState();

virtual void Update();
virtual void Draw();


private:

sf::Clock _clock;
sf::RectangleShape board[8][16];
unsigned _numViruses;
int blocksX;
int blocksY;
float blockSize;

struct Indexer
{
int x1, x2;
int y1, y2;
sf::Color col1, col2;
bool Horizontal() const
{
if (x1 - x2 != 0)
return true;
return false;
}

void IncrementY()
{
y1++; y2++;
}

int LowestY() const
{
return std::max(y1, y2);
}
int HighestY() const { return std::min(y1, y2); };

int LowestX() const { return std::min(x1, x2); };
sf::Color LowestXColor() const { return x1 < x2 ? col1 : col2; };
sf::Color LowestYColor() const { return y1 > y2 ? col1 : col2; };
sf::Color HighestXColor() const { return x1 > x2 ? col1 : col2; };
sf::Color HighestYColor() const { return y1 < y2 ? col1 : col2; };
int HighestX() const { return std::max(x1, x2); };
void IncrementX() { x1++; x2++; };
void DecrementX() { x1--; x2--; };
void RotateClockWise() {
if (Horizontal())
{
if (x1 < x2)
{
y1 = y2 - 1;
x1 = x2;
}
else
{
y2 = y1 - 1;
x2 = x1;
}
}
else
{
if (y1 < y2)
{
x1 = x2 + 1;
y1 = y2;
}
else
{
x2 = x1 + 1;
y2 = y1;
}
}
}
};
Indexer _indexer;
float _moveDownTime = 0.5f;
float _moveDownAcc = 0.0f;


void RotateCW();
void RotateCCW();
bool MoveDown();
bool MoveRight();
bool MoveLeft();
void UpdateBoard();
void ResetIndexer();



};


#endif

@@ -123,6 +123,7 @@
<ClCompile Include="FontManager.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="MenuState.cpp" />
<ClCompile Include="PillPuzzleState.cpp" />
<ClCompile Include="SelectionList.cpp" />
<ClCompile Include="Snake.cpp" />
<ClCompile Include="SnakeGameState.cpp" />
@@ -134,6 +135,7 @@
<ClInclude Include="IState.h" />
<ClInclude Include="Application.h" />
<ClInclude Include="MenuState.h" />
<ClInclude Include="PillPuzzleState.h" />
<ClInclude Include="SelectionList.h" />
<ClInclude Include="Snake.h" />
<ClInclude Include="SnakeGameState.h" />
@@ -19,6 +19,9 @@
<Filter Include="Source Files\Snake">
<UniqueIdentifier>{f895e937-f3ef-45bf-9f96-206c16b8460c}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\PillPuzzle">
<UniqueIdentifier>{a04ef69f-0c9a-432f-8434-2a840803d7dd}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp">
@@ -48,6 +51,9 @@
<ClCompile Include="SnakeGameState.cpp">
<Filter>Source Files\Snake</Filter>
</ClCompile>
<ClCompile Include="PillPuzzleState.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="TextureManager.h">
@@ -77,5 +83,8 @@
<ClInclude Include="SnakeGameState.h">
<Filter>Header Files\Snake</Filter>
</ClInclude>
<ClInclude Include="PillPuzzleState.h">
<Filter>Header Files\PillPuzzle</Filter>
</ClInclude>
</ItemGroup>
</Project>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.