#include "imageform.h" 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); }; void Form::updateRandom() { RandomOcc = Occupation[ofRandom(Occupation.size())]; RandomHob = Hobby[ofRandom(Hobby.size())]; RandomWea = Wealth[ofRandom(Wealth.size())]; RandomDis = Dislikes[ofRandom(Dislikes.size())]; }; 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 Form::scanFiles(std::string filename) { std::vector array; ofBuffer buffer = ofBufferFromFile(filename); for (auto line : buffer.getLines()){ array.push_back(line); } return array; } std::vector Form::addFiles(std::vector results, std::string filename) { ofBuffer buffer = ofBufferFromFile(filename); for (auto line : buffer.getLines()) { results.push_back(line); } return results; } 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(); }