Commit 50fc0271 authored by Robert Goddard's avatar Robert Goddard
Browse files

Revert "Upload New File"

This reverts commit ff48d481
parent 605b6a1f
#include "imageform.h"
//Posts the random forms
void Form::postRandom()
{
myfont.drawString("Occupation: " + RandomOcc,600,180);
myfont.drawString("Hobby: " + RandomHob,600,280);
myfont.drawString("Wealth: " + RandomWea,600,380);
myfont.drawString("Dislikes: " + RandomDis,600,480);
};
//This adds a random result to the print out
void Form::updateRandom()
{
RandomOcc = Occupation[ofRandom(Occupation.size())];
RandomHob = Hobby[ofRandom(Hobby.size())];
RandomWea = Wealth[ofRandom(Wealth.size())];
RandomDis = Dislikes[ofRandom(Dislikes.size())];
};
//This fills the vectors with results with which to draw from, Lots of code so it goes in it's own function
void Form::updateFields()
{
if (FanMode && !SciMode)
{
myfont.load("mael.ttf", 24);
Occupation = scanFiles("Occupation_Fan.txt");
Hobby = scanFiles("Hobby_Fan.txt");
}
else if (!FanMode && SciMode)
{
myfont.load("alienencounters.ttf", 24);
Occupation = scanFiles("Occupation_Sci.txt");
Hobby = scanFiles("Hobby_Sci.txt");
}
else if (!FanMode && !SciMode)
{
myfont.load("arial.ttf", 24);
Occupation = scanFiles("Occupation.txt");
Hobby = scanFiles("Hobby.txt");
}
else
{
myfont.load("arial.ttf", 24);
Occupation = scanFiles("Occupation.txt");
Hobby = scanFiles("Hobby.txt");
}
Wealth = scanFiles("Wealth.txt");
Dislikes = scanFiles("Dislikes.txt");
};
std::vector<std::string> Form::scanFiles(std::string filename)
{
std::vector<std::string> array;
ofBuffer buffer = ofBufferFromFile(filename);
for (auto line : buffer.getLines()){
array.push_back(line);
}
return array;
}
std::vector<std::string> Form::addFiles(std::vector<std::string> results, std::string filename)
{
ofBuffer buffer = ofBufferFromFile(filename);
for (auto line : buffer.getLines()) {
results.push_back(line);
}
return results;
}
//Code below re-updates the fields so they are re-randomized, re-clicking a mode you're already in works like a "Re-randomize" button
void Form::startFanMode()
{
SciMode = false;
FanMode = true;
updateFields();
updateRandom();
}
void Form::startSciMode()
{
FanMode = false;
SciMode = true;
updateFields();
updateRandom();
}
void Form::startRegMode()
{
FanMode = false;
SciMode = false;
updateFields();
updateRandom();
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment