Files
dilemmaker/source/misc.cpp
Raimon Zamora 546ab9aa55 - [NEW] Updatats de nou els Yamals de les habitacions
- [NEW] Es mostren les propietats dels enemics i els items quan els selecciones.
- [NEW] misc::floatToString()
2025-11-19 13:58:45 +01:00

24 lines
697 B
C++

#include "misc.h"
#include <SDL3/SDL.h>
#include <sstream>
#include <iomanip>
#include <string>
namespace misc
{
std::string colors[17] = { "black", "bright_black", "blue", "bright_blue", "red", "bright_red", "magenta", "bright_magenta", "green", "bright_green", "cyan", "bright_cyan", "yellow", "bright_yellow", "white", "bright_white", "transparent" };
int getColorByName(std::string color)
{
for (int i=0; i<17; ++i) if (colors[i] == color) return i;
return 0;
}
std::string floatToString(float value, int decimals)
{
std::ostringstream oss;
oss << std::fixed << std::setprecision(decimals) << value;
return oss.str();
}
}