1
#include "VirtualBasicUserInterface.hpp"
3
void VirtualBasicUserInterface::loadUIConfig(){
4
std::ifstream uisettings;
5
uisettings.open(uicfgpath.c_str());
6
if(!uisettings.good()){
8
throw Hexception( std::string("Error loading config file: '")
10
+ std::string("'. Will use default values.\n")
15
std::string descripiton;
16
while(uisettings.good()){
18
for(int i=0; i<11 ; i++){
19
uisettings >> tmpchar;
20
descripiton.push_back(tmpchar);
22
if(descripiton == "sfullscreen")
24
if(descripiton == "screenwidth")
26
if(descripiton == "screenhight")
28
if(descripiton == "scolordepth")
30
if(descripiton == "framepersec")
33
if(size.x <= 0 || size.y <= 0){
35
throw Hexception( "Error: Invalid configuration. "
36
"Will use default values.\n");
41
void VirtualBasicUserInterface::setFullscreen(bool full){
45
void VirtualBasicUserInterface::setResolution(Coordinates res, int depth){
50
void VirtualBasicUserInterface::prepareUICfgPath(){
51
uicfgpath = fsh->getSettingsDir();
53
fsh->prepareDirectory(uicfgpath);
56
fsh->prepareDirectory(uicfgpath);
58
uicfgpath /= "/uisettings.cfg";
61
void VirtualBasicUserInterface::setDefaultConfig()
70
void VirtualBasicUserInterface:: saveUIConfig(){
71
std::ofstream uisettings;
72
uisettings.open(uicfgpath.c_str());
73
uisettings << "screenwidth " << size.x << std::endl;
74
uisettings << "screenhight " << size.y << std::endl;
75
uisettings << "sfullscreen " << SFull << std::endl;
76
uisettings << "scolordepth " << SDepth << std::endl;
77
uisettings << "framepersec " << FPS << std::endl;