[ADD] convert number to digits
This commit is contained in:
@@ -270,6 +270,15 @@ namespace scene
|
|||||||
|
|
||||||
collision::CheckCollisions(collision_entities);
|
collision::CheckCollisions(collision_entities);
|
||||||
update_hand_detection();
|
update_hand_detection();
|
||||||
|
std::vector<int> res;
|
||||||
|
toolbox::GetDigitsFromNumber(1234567890, res);
|
||||||
|
std::cout << "number 1234567890 in digits: " << std::endl;
|
||||||
|
for (int i : res)
|
||||||
|
{
|
||||||
|
std::cout << i << " , ";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//manages the key input in the game scene
|
//manages the key input in the game scene
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ namespace scene
|
|||||||
//pause_guis is a list of components that will be rendered when the game is paused.
|
//pause_guis is a list of components that will be rendered when the game is paused.
|
||||||
std::vector<gui::GuiTexture*> pause_guis;
|
std::vector<gui::GuiTexture*> pause_guis;
|
||||||
|
|
||||||
|
std::vector<gui::GuiTexture*> score_guis;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief renders the objects/gui models
|
* @brief renders the objects/gui models
|
||||||
* @param
|
* @param
|
||||||
|
|||||||
@@ -56,4 +56,12 @@ namespace toolbox
|
|||||||
}
|
}
|
||||||
return min + rand() % ((max + 1) - min);
|
return min + rand() % ((max + 1) - min);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetDigitsFromNumber(int number, std::vector<int>& result_vector)
|
||||||
|
{
|
||||||
|
if (number >= 10)
|
||||||
|
GetDigitsFromNumber(number / 10, result_vector);
|
||||||
|
|
||||||
|
result_vector.push_back(number % 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "../entities/camera.h"
|
#include "../entities/camera.h"
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace toolbox
|
namespace toolbox
|
||||||
{
|
{
|
||||||
@@ -78,4 +79,13 @@ namespace toolbox
|
|||||||
* @return: The random number
|
* @return: The random number
|
||||||
*/
|
*/
|
||||||
int Random(const int min, const int max);
|
int Random(const int min, const int max);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief gets the separate digits from the number.
|
||||||
|
*
|
||||||
|
* @param number the number to get the digits from
|
||||||
|
* @param result_vector the vector to hold the individual digits.
|
||||||
|
*/
|
||||||
|
void GetDigitsFromNumber(int number, std::vector<int>& result_vector);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user