     override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
         return .Landscape
     }
+    
     
     func updateJoystickCoordinates(timer:NSTimer){
         

        
        self.SocketConn = SocketConnection()
        
        // Do any additional setup after loading the view, typically from a nib.
        
        
        
//        
//        var timer = NSTimer.scheduledTimerWithTimeInterval(0.05, target: self, selector: Selector("updateJoystickCoordinates:"), userInfo: nil, repeats: true)
        
        self.timer = NSTimer.scheduledTimerWithTimeInterval(0.05, target: SocketConn!, selector: Selector("sendValue:"), userInfo: joystick, repeats: true)
        
    }
    
    deinit {
        print("deIniting")
        // perform the deinitialization
    }
    
    override func viewDidDisappear(animated: Bool) {
        print("view disappeared")
        self.SocketConn!.closeStream()
        self.timer.invalidate()
      
       
        
       
        
    }
    
    override func didReceiveMemoryWarning() {

        
        
        
        //
        //        SocketConn.openStreamAndSendValues(flagDirectionX, flagY: flagDirectionY, speed: speed, direction: angle)
    }
    
    @IBAction func createMapBtn(sender: AnyObject) {
        let mapSize = CGSize(width: mapView.bounds.width, height: mapView.bounds.height)
        let map = drawMap(mapSize)
        mapView.image = map
    }
    func drawMap(size: CGSize) -> UIImage{
        let bounds = CGRect(origin: CGPoint.zero, size: size)
        let opaque = false;
        let scale : CGFloat = 0;
