Приложение DirectX на окнах на 64 бита

Вы можете использовать Делегат , чтобы уведомить WeatherPresenter об изменениях от LocationService

protocol LocationServiceDelegate: class { // Delegate protocol
    func didUpdateLocation()
}

class LocationService: NSObject, CLLocationManagerDelegate {

    weak var delegate: LocationServiceDelegate?

    fileprivate let locationManager = CLLocationManager()
    var location: Location?  // Location(lat: Double, lon: Double)

    override init() {
        super.init()

        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters

    }

    func startUpdatingLocation() { // Start updating called from presenter
        locationManager.startUpdatingLocation()
    }

    func getCurrentLocation() -> Location? {
        // how can I catch a location?
        return location
    }


    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        if let location = locations.last {
            if location.horizontalAccuracy > 0 {
                locationManager.stopUpdatingLocation()
                self.location = Location(lat: location.coordinate.latitude, lon: location.coordinate.latitude)
                self.delegate?.didUpdateLocation() // Notify delegate on change
            }
        }
    }

    func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
        print(error.localizedDescription)
    }

}


class WeatherPresenter: LocationServiceDelegate {
    unowned let delegate: WeatherViewDelegate
    let weatherService = WeatherService()
    let locationService = LocationService()

    init(with delegate: WeatherViewDelegate) {
        self.delegate = delegate
        self.locationService.delegate = self // Set self as delegate
        self.locationService.startUpdatingLocation()  // Requests start updating location
    }

    func didUpdateLocation() { // This will be called on location change
        self.getWeatherForCurrentLocation()
    }

    func getWeatherForCurrentLocation() {
        if let location = locationService.getCurrentLocation() {
            //...
        }
    }
}
6
задан Adam Lear 23 November 2011 в 02:52
поделиться

1 ответ

DLL, в котором Вы нуждаетесь, для Управляемого DirectX. К сожалению, Microsoft больше не поддерживает Управляемый DirectX, и это - преемник, XNA не поддерживает 64 бита также.

SlimDX является альтернативой с открытым исходным кодом Управляемому DirectX, и он поддерживает 64 бита. Другая опция состоит в том, чтобы написать код DirectX в неуправляемом C++.

5
ответ дан 17 December 2019 в 04:52
поделиться
Другие вопросы по тегам:

Похожие вопросы: