This is a minor build system bugfix release which allows GVars3 to work properly on modern MinGW corss environments and DERSTIR builds.
This is a minor build system bugfix release which allows GVars3 to be build headless and single threaded more easily on all platforms, especially MinGW.
Features:
std::vector<T>
TooN::Matrix<>
In addition, numerous bugfixes have been performed including keeping the build files up to date with VS2008, GCC >=4.4 and MinGW.
#include <gvars3/instances.h>
#include <iostream>
#include <cstdlib>
using namespace GVars3;
using namespace std;
int main(int argc, char** argv)
{
//Load a configuration file (optional)
GUI.LoadFile("foo.cfg");
//Process commandline arguments (optional)
cout << "An integer = " << GV3::get<int>("wurble") << endl;
cout << "A float = " << GV3::get<float>("fobble") << endl;
//Make an easier to use binding to a gvar:
gvar3<int> an_integer("i");
//An illustration of using the graphical
//components.
while(1)
{
//Process the GUI. This can be done in another thread if
//need be.
GUI_Widgets.process_in_crnt_thread();
cout << "\r" << *an_integer << " " << flush;
usleep(10000);
}
}
Then create the configuration file foo.cfg with the following
contents:
//Set some variables wurble=10 fobble=6.66666 i=54 //Create a simple GUI for controlling i GUI.InitXInterface GUI.AddWindow iwin "This window controls i" iwin.AddMonitor "The value of i" i iwin.AddSlider i 0 1000 iwin.AddPushButton "Set i=88" "i=88" //Create a simple function function strange . echo "Setting i to 279" . i=279 . echo "Hello. world" endfunction //Run the function from a pushbutton: iwin.AddPushButton "Strange function" strange //Another pushbutton to list all commands: iwin.AddPushButton "Command list" "commandlist"Now try running the program. Also, try running
./prog --wurble
79
Updated September 10th 2012, 03:26