Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

textonlyFrontEnd.cpp File Reference

#include "textonlyFrontEnd.h"
#include "../../../common/config.h"
#include "../../../common/options.h"
#include "../../../common/intToChar.h"
#include "../../devicePlugIn.h"
#include <linux/joystick.h>
#include <sys/ioctl.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <stdio.h>
#include <malloc.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

struct ConfigFrontEndPlugInGetConfigFrontEndPlugIn ( void )
void init ( void )
void run (int argc, char** argv)


Function Documentation

struct ConfigFrontEndPlugIn * GetConfigFrontEndPlugIn ( void)

Definition at line 46 of file client/frontends/textonly/textonlyFrontEnd.cpp.

00047 {
00048     return &textonly;
00049     }

void init ( void)

Definition at line 62 of file client/frontends/textonly/textonlyFrontEnd.cpp.

00063 {
00064     fprintf ( stderr, "\n3Dsia client\ntextonly configuration frontend plugin\n" );
00065     }

void run ( int argc,
char ** argv)

Definition at line 78 of file client/frontends/textonly/textonlyFrontEnd.cpp.

00078 {
00079     Config* conf;
00080     char*   tmpStr;
00081     
00082     conf   = new Config ();
00083     tmpStr = (char*) malloc (1000);
00084     
00085     
00086     if (conf->openConfig (CLIENT_CONFIG_FILE)) {
00087     printf ("Configuration file opened (if it didn't exist, it was created)\n");
00088     printf ("\n\n\n\n\n\n");
00089     printf ("3Dsia client setup\n");
00090     printf ("==================\n\n");
00091     
00092     printf ("> Devices setup:\n");
00093     printf ("   1. Keyboard\n");
00094     printf ("   2. Joystick\n");
00095     printf ("   3. Mouse\n");
00096     printf ("\nEnter device number for STANDARD device: ");
00097     
00098     int i;
00099     cin >> i;
00100     
00101     switch (i) {
00102         case 1: {
00103             if (!conf->searchTag ("Devices")) {
00104                 conf->createTag ("Devices");
00105             };
00106         
00107             conf->setVariable ("DefaultDevice", "Keyboard");
00108             break;
00109         };
00110         
00111         case 2: {
00112             if (!conf->searchTag ("Devices")) {
00113                 conf->createTag ("Devices");
00114             };
00115         
00116             conf->setVariable ("DefaultDevice", "Joystick");
00117             break;
00118         };
00119         
00120         case 3: {
00121             if (!conf->searchTag ("Devices")) {
00122                 conf->createTag ("Devices");
00123             };
00124         
00125             conf->setVariable ("DefaultDevice", "Mouse");
00126             break;
00127         };
00128         
00129         default: {
00130             printf ("Unknown device number ! Giving up...");
00131             exit (1);
00132         };
00133     };
00134     
00135     if (!conf->searchTag ("User")) {
00136         conf->createTag ("User");
00137     };
00138     
00139     string str;
00140     
00141     cout << "\n\n\nEnter default username: ";
00142     cin >> str;
00143     conf->setVariable ("Name", const_cast<char*> (str.c_str ()));
00144     
00145     cout << "Enter default password: ";
00146     cin >> str;
00147     conf->setVariable ("Password", const_cast<char*> (str.c_str ()));
00148     
00149     cout << "Enter default server (dots-n-numbers, e.g. 127.0.0.1): ";
00150     cin >> str;
00151     conf->setVariable ("Server", const_cast<char*> (str.c_str ()));
00152     } else {
00153         printf ("Unknown error while opening/creating configuration file !\n");
00154         exit (1);
00155     };
00156     
00157     free (tmpStr);
00158     delete conf;
00159 }

Generated at Sat May 13 13:50:22 2000 for 3Dsia by doxygen 1.1.2 written by Dimitri van Heesch, © 1997-2000