summaryrefslogtreecommitdiff
path: root/macosx/main.mm
blob: 6a40f22e1110608e67094df23e033fd608c637ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

#include "settings.hpp"
#include "../common/map_view.cpp"

#include <cstdio>

#include <thread>

MapView *mapView = nullptr;

int main() {
    llmr::Settings_MacOSX settings;
    mapView = new MapView(settings);
    mapView->init();
    int ret = mapView->run();
    mapView->settings.sync();
    delete mapView;
    return ret;
}



namespace llmr {

void platform::cleanup() {
    // noop
}

void platform::restart() {
    if (mapView) {
        mapView->dirty = true;
        CGEventRef event = CGEventCreate(NULL);
        CGEventSetType(event, kCGEventMouseMoved);
        [[NSApplication sharedApplication] postEvent: [NSEvent eventWithCGEvent:event] atStart:NO];
    }
}

}