// The main
void main()
{
    uint16 cnt = 0;
	uint8 blobs = 0;
	uint16 x = 0, y = 0;
	
	
	CyGlobalIntEnable;					// Enable all global interrupts
	
	Initialize();						// Initialize all Hardware
	
	while(1)
	{
		blobs = Camera_read();
		if (blobs & BLOB1)				// Camera can track 4 targets simultaneously. We are interested only in one.
		{
			x = Blob1.X;				// Get current x, y for the target
			y = Blob1.Y;
			
			MoveEye(x, y);				// Move the camera to bring target in center of field of vision
		}
	}
}
Beispiel #2
0
 void MoveUpDown(double dist) { MoveEye(dist, up); }
Beispiel #3
0
 void MoveLeftRight(double dist) { MoveEye(dist, GetLeft()); }
Beispiel #4
0
 void MoveForwardBackward(double dist) { MoveEye(dist, dir); }
Beispiel #5
0
/*
* the function that is called in the main loop that will act on the keys pressed
* that are kept track of inside of the array
*/
void glfwEditKeyboard(void) {
   ew = egaze/magnitude(egaze);
   ew = glm::vec3(-1.0 * ew.x, -1.0 * ew.y, -1.0 * ew.z);
   eu = glm::cross(GetUp(), ew)/magnitude(glm::cross(GetUp(), ew));

   //If in GUI Selection, disable all other actions
   if(eKeysPressed['G'] == 0) {
      //GLFW_KEY_S
      if(eKeysPressed['S']) {
          MoveEye(glm::vec3(speed * 0.15 * ew.x, speed * 0.15 * ew.y, speed * 0.15 * ew.z));
      }
      //GLFW_KEY_W
      if(eKeysPressed['W']) {
          MoveEye(glm::vec3(speed * -0.15 * ew.x, speed * -0.15 * ew.y, speed * -0.15 * ew.z));
      }
      //GLFW_KEY_D
      if(eKeysPressed['D']) {
          MoveEye(glm::vec3(speed * 0.15 * eu.x, speed * 0.15 * eu.y, speed * 0.15 * eu.z));
      }
      //GLFW_KEY_A
      if(eKeysPressed['A']) {
          MoveEye(glm::vec3(speed * -0.15 * eu.x, speed * -0.15 * eu.y, speed * -0.15 * eu.z));
      }
      //GLFW_KEY_R
      if(eKeysPressed['R']) {
         setDistance(previousLookAtDistance);
         reselectLastEntity();
      }
      //GLFW_KEY_BACKSPACE
       if(eKeysPressed[8]) {
         //l-shift, redo
         if(eKeysPressed[340]) {
            redo();
         }
         //else undo
         else
         {
            undo();
         }
         eKeysPressed[8] = 0;
      }
      //GLFW_KEY_1
      if(eKeysPressed['1']) {
         selectAtHotBarIndex(1);
      }
      //GLFW_KEY_2
      if(eKeysPressed['2']) {
         selectAtHotBarIndex(2);
      }
      //GLFW_KEY_3
      if(eKeysPressed['3']) {
         selectAtHotBarIndex(3);
      }
      //GLFW_KEY_4
      if(eKeysPressed['4']) {
         selectAtHotBarIndex(4);
      }
      //GLFW_KEY_5
      if(eKeysPressed['5']) {
         selectAtHotBarIndex(5);
      }
      //GLFW_KEY_6
      if(eKeysPressed['6']) {
         selectAtHotBarIndex(6);
      }
      //GLFW_KEY_7
      if(eKeysPressed['7']) {
         selectAtHotBarIndex(7);
      }
      //GLFW_KEY_8
      if(eKeysPressed['8']) {
         selectAtHotBarIndex(8);
      }
      //GLFW_KEY_9
      if(eKeysPressed['9']) {
         selectAtHotBarIndex(9);
      }
   }
   //GLFW_KEY_P
   if(eKeysPressed['P']) {
      pauseorUnpause();
   }
   //Quit and don't save if 'Q' + lShift/lctrl
   if(eKeysPressed['Q'] && eKeysPressed[340] || eKeysPressed['Q'] && eKeysPressed[341]) {
      toStartScreen();
   }
   //Quit and Save
   else if(eKeysPressed['Q']) {
      saveWorld();
      toStartScreen();
   }
}