home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Zone
/
VRZONE.ISO
/
mac
/
PC
/
PCGLOVE
/
GLOVE
/
OBJGLV.ZIP
/
SRC
/
DOSGLOVE.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-05-12
|
5KB
|
156 lines
//
// DOSGlove.cpp:
// "main()" function for a graphical Glove application.
// Example use of Object Glove.
//
// Purpose:
// Sets up the DOC glove application.
//
// Compatibility:
// DOS only. See WINGLOVE.CPP for Windows version.
//
// Copyright 1993 Mark Thomas Pflaging
//
// Date: 5/15/92 - 6/4/92 (Release 1)
// 8/9/92 - 9/21/92 (Release 2)
// 11/20/92 (Release 2.1)
// 3/22/93 (Release 3.0)
//
#include <dos.h>
#include <bios.h>
#include <stdlib.h>
#include <conio.h>
#include <iostream.h>
#include <string.h>
#include "smooth.hpp"
#include "bgiactor.hpp"
#include "ini.hpp"
#include "gestsys.hpp"
#include "bgigest.hpp"
#include "shamless.hpp"
Boolean keyhit_quit()
{
if (kbhit()) {
getch();
return True;
}
return False;
}
int main()
{
cout << "Edit GLOVE.INI to change startup parameters if "
"you experience trouble." << endl;
cout << "HELPME!.DOC contains important troubleshooting "
"information!" << endl;
cout << "Reading GLOVE.INI..." << endl;
InitFile * gloveIni = new InitFile("glove.ini");
if (gloveIni->getStatus() == Key::FileDidNotExist)
cout << "Cannot open \"glove.ini\". Using defaults and creating new \"glove.ini\"." << endl;
if (gloveIni->getStatus() == Key::ErrorReadingFile)
cout << "Error in \"glove.ini\". Using defaults and perhaps modifying \"glove.ini\"." << endl;
cout << "Determining timing values for this machine..." << endl;
rawGlove * GLOVE1;
GestureSystem gestSys;
BGIGestureActor gloveGesture1(*gloveIni, "1.Gestures");
BGIgraphicsActor &gloveGraph1 = *(new BGIgraphicsActor(*gloveIni, gloveGesture1));
gestSys + &gloveGraph1;
gestSys + &gloveGesture1;
cout << "Waiting for glove #1... (press any key to exit)" << endl;
if (!strcmp(gloveIni->find("1.Smoothing", "smoothingEnabled", "True"),
"True"))
GLOVE1 = new smoothGlove(*gloveIni, &gestSys, keyhit_quit);
else
GLOVE1 = new rawGlove(*gloveIni, &gestSys, keyhit_quit);
gestSys.turnOn();
GLOVE1->test();
if (GLOVE1->driverStatus() == gloveDriver::EverythingOK) {
rawGlove * GLOVE2;
GestureSystem gestSys2;
BGIGestureActor gloveGesture2(*gloveIni, "2.Gestures");
BGIgraphicsActor &gloveGraph2 = *(new BGIgraphicsActor(*gloveIni, gloveGesture2, gloveGraph1));
gloveGraph1.turnOn();
gloveGraph2.turnOn();
gloveGesture1.turnOn();
gloveGesture2.turnOn();
gestSys2 + &gloveGraph2;
gestSys2 + &gloveGesture2;
cout << "Waiting for glove #2... (press any key to exit)"
<< endl;
if (!strcmp(gloveIni->find("2.Smoothing", "smoothingEnabled", "True"),
"True"))
GLOVE2 = new smoothGlove(*gloveIni, &gestSys2, keyhit_quit);
else {
GLOVE2 = new rawGlove(*gloveIni, &gestSys2, keyhit_quit);
}
gestSys2.turnOn();
if (GLOVE2->driverStatus() == gloveDriver::EverythingOK) {
cout << endl << endl
<< " Press any keyboard key "
"to begin." << endl
<< "Press the '1' key on the Glove during "
"the demo to display help." << endl;
getch();
GLOVE1->initFunction(BGIgraphicsActor::Process, &gloveGraph1);
GLOVE2->initFunction(BGIgraphicsActor::Process, &gloveGraph2);
gloveGraph1.Setup();
gloveGraph2.Setup();
cleardevice();
GLOVE1->Start(strcmp(gloveIni->find(
gloveDriver::getTitle(),
"PolledOperation", "False"),
"True") ? True : False);
gloveIni->write();
delete gloveIni;
rawGlove::run();
delete GLOVE2;
delete GLOVE1;
gloveGraph2.killAssociatedGestures();
delete &gloveGraph2;
delete &gloveGraph1;
shamelessFunc();
}
else {
delete GLOVE2;
delete &gloveGraph2;
cout << endl << endl
<< "GLOVE.INI also contains some aesthetic "
"parameters, so READ IT!" << endl
<< " Press any keyboard key "
"to begin." << endl
<< "Press the '1' key on the Glove during "
"the demo to display help." << endl;
getch();
GLOVE1->initFunction(BGIgraphicsActor::Process,
&gloveGraph1);
gloveGraph1.Setup();
cleardevice();
GLOVE1->Start(strcmp(gloveIni->find(
gloveDriver::getTitle(),
"PolledOperation", "False"),
"True") ? True : False);
gloveIni->write();
delete gloveIni;
rawGlove::run();
delete GLOVE1;
gloveGraph1.killAssociatedGestures();
delete &gloveGraph1;
shamelessFunc();
}
}
else {
cout << endl << "The program was terminated (by a "
"keystroke) before finding a glove attached." << endl;
gloveIni->write();
delete gloveIni;
delete GLOVE1;
}
return 0;
}