fix some warnings
This commit is contained in:
parent
69175cf189
commit
de93325371
|
|
@ -2,17 +2,17 @@
|
|||
#include <Fruit.h>
|
||||
#include <Random.h>
|
||||
|
||||
Fruit::Fruit(sf::Vector2i gridPos_in, const Color& color_in)
|
||||
Fruit::Fruit(const sf::Vector2i gridPos_in, const Color& color_in)
|
||||
: gridPos(gridPos_in)
|
||||
, color(color_in)
|
||||
{ }
|
||||
|
||||
sf::Vector2f Fruit::windowPos(sf::Vector2f gameBoundsOrigin, float size) const
|
||||
sf::Vector2f Fruit::windowPos(sf::Vector2f gameBoundsOrigin, const float size) const
|
||||
{
|
||||
return {gameBoundsOrigin.x + (gridPos.x * size), gameBoundsOrigin.y + (gridPos.y * size)};
|
||||
return {gameBoundsOrigin.x + (static_cast<float>(gridPos.x) * size), gameBoundsOrigin.y + (static_cast<float>(gridPos.y) * size)};
|
||||
}
|
||||
|
||||
void Fruit::respawn(const std::vector<SnakeNode>& body_in, unsigned int gridCount_in)
|
||||
void Fruit::respawn(const std::vector<SnakeNode>& body_in, const unsigned int gridCount_in)
|
||||
{
|
||||
unsigned int tempX;
|
||||
unsigned int tempY;
|
||||
|
|
@ -20,8 +20,8 @@ void Fruit::respawn(const std::vector<SnakeNode>& body_in, unsigned int gridCoun
|
|||
do
|
||||
{
|
||||
valid = true;
|
||||
tempX = Random::get(0, gridCount_in - 1);
|
||||
tempY = Random::get(0, gridCount_in - 1);
|
||||
tempX = Random::get(0u, gridCount_in - 1);
|
||||
tempY = Random::get(0u, gridCount_in - 1);
|
||||
for (const auto& node : body_in)
|
||||
{
|
||||
if (node.gridPos.x == tempX and node.gridPos.y == tempY)
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ bool Game::parseConfigFile()
|
|||
if (inputBuff == "gridCount")
|
||||
{
|
||||
configFile >> config.gridCount;
|
||||
config.gridCountBuffer = config.gridCount;
|
||||
config.gridCountBuffer = static_cast<int>(config.gridCount);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -598,8 +598,4 @@ void Game::run()
|
|||
}
|
||||
|
||||
ImGui::SFML::Shutdown();
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ SnakeNode::SnakeNode(sf::Vector2u gridPos_in, const Color& color_in)
|
|||
|
||||
sf::Vector2f SnakeNode::windowPos(const sf::Vector2f gameBoundsOrigin, float size) const
|
||||
{
|
||||
return {gameBoundsOrigin.x + (gridPos.x * size), gameBoundsOrigin.y + (gridPos.y * size)};
|
||||
return {gameBoundsOrigin.x + (static_cast<float>(gridPos.x) * size), gameBoundsOrigin.y + (static_cast<float>(gridPos.y) * size)};
|
||||
}
|
||||
|
||||
SnakeNode& Player::head()
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
LOG("\n\n\033[32mTODO: ");
|
||||
LOG("-Implement game config via imgui");
|
||||
LOG("\033[0m");
|
||||
|
||||
Game game(useImgui);
|
||||
|
|
|
|||
Loading…
Reference in New Issue