mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-08-12 03:45:50 -05:00
Create initial main menu setup
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <condition_variable>
|
||||
#include <chrono>
|
||||
#include <queue>
|
||||
#include <cmath>
|
||||
|
||||
bool is_big_endian(void) {
|
||||
union {
|
||||
@@ -14,6 +15,24 @@ bool is_big_endian(void) {
|
||||
return value.c[0] == 1;
|
||||
}
|
||||
|
||||
std::string get_float_str_decimals(float value, int decimals) {
|
||||
float approx_factor = pow(0.1, decimals) * (0.5);
|
||||
int int_part = (int)(value + approx_factor);
|
||||
int dec_part = (int)((value + approx_factor - int_part) * pow(10, decimals));
|
||||
std::string return_text = std::to_string(int_part);
|
||||
|
||||
if(decimals > 0) {
|
||||
if(!dec_part) {
|
||||
return_text += ".";
|
||||
for(int i = 0; i < decimals; i++)
|
||||
return_text += "0";
|
||||
}
|
||||
else
|
||||
return_text += "." + std::to_string(dec_part);
|
||||
}
|
||||
|
||||
return return_text;
|
||||
}
|
||||
//============================================================================
|
||||
|
||||
ConsumerMutex::ConsumerMutex() {
|
||||
|
||||
Reference in New Issue
Block a user