vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ChessBoard.h
Go to the documentation of this file.
1 #include <vrecko/Ability.h>
2 
4 
5 
6 using namespace vrecko;
7 
8 
9 class ChessBoard: public Ability {
10  public:
11  ChessBoard();
13 
15  void processEvent(const std::string &input_name, void *value);
16 
17  void update(void);
18 
19  std::string getAcceptableMessages(void) {return "ChessMove|AddChessPiece|MoveDone";}
20 
21  bool loadXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parametersNode);
22 
23  typedef struct {
24  std::string type, location;
25  osg::Vec3 new_position;
26  } Request;
27 
28  protected:
29  FILE *chess_pipe;
30  bool status, play, color; // color - 0=black, 1=white
31  unsigned int wait;
33  float square_size;
34  osg::Vec3 a1pos;
35 
36  // pointers to geometries of chesspieces
37  osg::Node *WRook, *WKnight, *WBishop, *WQueen, *WKing, *WPawn;
38  osg::Node *BRook, *BKnight, *BBishop, *BQueen, *BKing, *BPawn;
39 
40  std::map<std::string, long int> pieces_map; // [location, EObject ID]
41 
42  int pfd_to[2], pfd_from[2]; // Pipe file descriptors
43  osg::Vec3 white_out_pos, black_out_pos;
44 
45  bool _first;
46 };
47 
48