Just now, rip-off said:Can you show us your current code, after you tried making the variable global?
I'm getting settings(variables) from this code :
void GetSettings()
{
ifstream nameFileout;
nameFileout.open("Settings.conf");
string line;
if (!nameFileout.is_open())
{
exit(0);
}
while (std::getline(nameFileout, line))
{
string parse = "[Zoom]-10";
stringstream ss(parse);
string temp = "[Zoom]";
getline(ss, temp, ']');
getline(ss, temp, '[');
double Result;
stringstream convert(temp);
double Z2 = atof(temp.c_str());
AllocConsole();
freopen("CONOUT$", "w", stdout);
std::cout << line << std::endl;
}
nameFileout.close();
}
This function's output is here :
double Z2 = -10;
But i wan't use this Z2 like this global variables :
//Global Variables
double rotated_y = 0.0;
double rotated_x = 0.0;
double rotate_y = 0.0;
double rotate_x = -65.0;
double zoom = 90.0;
//String Variables
string Var1 = "[Zoom]";
string null = "\0";
//Camera Variables
double X2 = 0.0f;
double Y2 = 0.0f;
// double Z2 need to be here.
//Movement Variables
double X1 = 0.0f; // ←→
double Y1 = 0.0f; // ↕
double Z1 = 0.0f; //
double speed = 1.0f;
//Colission Variables
bool CanMoveToLeft = true;
bool CanMoveToRight = true;
bool CanMoveToUp = true;
bool CanMoveToDown = true;