home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Zone
/
VRZONE.ISO
/
mac
/
PC
/
PCGLOVE
/
GLOVE
/
OBJGLV.ZIP
/
INCLUDE
/
BGIACTOR.HPP
next >
Wrap
C/C++ Source or Header
|
1993-05-10
|
3KB
|
139 lines
//
// BGIActor.hpp:
// Interface Definition of classes BGIPolygon, BGI_PolySpace,
// BGI_XYZ, and BGIgraphicsActor. Example use of Object Glove.
//
// Purpose:
// Outputs graphics and text using Borland BGI toolkit.
//
// Compatibility:
// DOS only!
//
// Copyright 1993 Mark Thomas Pflaging
//
// Date: 3/22/93 (Release 3.0)
//
#ifndef __BGIACTOR_HPP
#define __BGIACTOR_HPP
#include <graphics.h>
#include "glgrph.hpp"
class BGIPolygon : public GenPolygon {
public:
BGIPolygon(int numPoints) : GenPolygon(numPoints) {}
virtual void draw() {
fillpoly(lastIdx / IntsPerPoint, & idx(0));
}
};
class BGI_PolySpace : public PolygonSpace {
public:
void drawAll() {
PolygonSpace::drawAll();
}
GenPolygon & makeNew(int numPoints) {
GenPolygon & retval = *(new BGIPolygon(numPoints));
*this += &retval;
return retval;
}
};
class BGI_XYZ : public XYZ {
public:
void rectangle(int currentColor) {
// draw new box
setcolor( currentColor );
::rectangle(left, top, right, bottom);
}
void erase(int leaveTrail);
};
// C functions from a previous version.
void drawFingers(gloveDriver& gd, int instance);
void eraseFingers(int instance);
class BGIGestureActor;
class BGIgraphicsActor : public graphicsActor {
int xx; // plot position.
int drawn; // set if cursor to be erased.
void displayGlove(GloveData& gd);
BGI_XYZ oldData; // MAYBE a little bigger than it needs to be.
int oldFingers;
int fillMode;
int currentColor;
int upIncrement;
void Process(gloveDriver& gd);
Boolean keyDown;
static Boolean textActive;
BGIGestureActor & gests;
public:
BGIgraphicsActor(InitFile & ini, BGIGestureActor & garg);
BGIgraphicsActor(InitFile & ini, BGIGestureActor & garg, ButtonGestSet & buttons);
~BGIgraphicsActor() {
if (getInstantiations() == 1) {
closegraph(); // Back to text mode
}
}
void Init(InitFile & ini);
static void displayHelp();
void drawGlove(gloveDriver &gd);
void infoDisplay(gloveDriver & gd);
void infoErase(int start);
static void Process(gloveDriver& gd, void * aGraphicsActor) {
BGIgraphicsActor & here = *((BGIgraphicsActor *)aGraphicsActor);
here.Process(gd);
}
virtual void Setup();
virtual void infoDisplay() {
cleardevice();
displayHelp();
outtext("Press the GLOVE enter key to continue.");
textActive = True;
}
virtual void infoClear() {
cleardevice();
textActive = False;
}
virtual void eraseFingers() {
::eraseFingers(getInstance());
}
virtual void eraseGlove();
virtual void closeDataBox() {
infoErase(0);
}
virtual void displayDataBox() {}
virtual void clearScreen() {
cleardevice();
}
virtual void HandleUp() {
currentColor += upIncrement;
currentColor %= getmaxcolor() + 1;
}
virtual void HandleDown() {
currentColor -= upIncrement;
currentColor += getmaxcolor() + 1;
currentColor %= getmaxcolor() + 1;
}
virtual void HandleLeft() {
currentColor ++;
currentColor %= getmaxcolor() + 1;
}
virtual void HandleRight() {
currentColor --;
currentColor += getmaxcolor() + 1;
currentColor %= getmaxcolor() + 1;
}
virtual void displayGestures();
virtual void clearGestures();
// The next one's from a previous version.
friend void drawGlovePlot(BGIgraphicsActor & obj, gloveDriver& gd);
};
#endif