optimize hover gesture recognizer ios
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
#else
|
#else
|
||||||
@interface AppViewController : UIViewController <MTKViewDelegate>
|
@interface AppViewController : UIViewController <MTKViewDelegate>
|
||||||
@property(nonatomic) yaze::app::core::Controller *controller;
|
@property(nonatomic) yaze::app::core::Controller *controller;
|
||||||
|
@property(nonatomic) UIHoverGestureRecognizer *hoverGestureRecognizer;
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,10 @@
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
_controller->SetupScreen();
|
_controller->SetupScreen();
|
||||||
|
|
||||||
|
_hoverGestureRecognizer = [[UIHoverGestureRecognizer alloc] initWithTarget:self action:@selector(hoverGesture:)];
|
||||||
|
[self.view addGestureRecognizer:_hoverGestureRecognizer];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,9 +200,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
io.AddMouseButtonEvent(0, hasActiveTouch);
|
io.AddMouseButtonEvent(0, hasActiveTouch);
|
||||||
|
|
||||||
UIHoverGestureRecognizer *hoverGestureRecognizer = [[UIHoverGestureRecognizer alloc] initWithTarget:self action:@selector(hoverGesture:)];
|
}
|
||||||
[self.view addGestureRecognizer:hoverGestureRecognizer];
|
|
||||||
- (void)hoverGesture:(UIHoverGestureRecognizer *)gesture {
|
- (void)hoverGesture:(UIHoverGestureRecognizer *)gesture {
|
||||||
ImGuiIO &io = ImGui::GetIO();
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
io.AddMouseSourceEvent(ImGuiMouseSource_TouchScreen);
|
io.AddMouseSourceEvent(ImGuiMouseSource_TouchScreen);
|
||||||
@@ -343,34 +347,9 @@
|
|||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
#if TARGET_OS_OSX
|
#if TARGET_OS_OSX
|
||||||
|
|
||||||
int main(int argc, const char *argv[]) { return NSApplicationMain(argc, argv); }
|
int main(int argc, const char *argv[]) { return NSApplicationMain(argc, argv); }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// int SDL_main(int argc, char*argv[]) {
|
|
||||||
// yaze::app::core::Controller controller;
|
|
||||||
// controller.OnEntry();
|
|
||||||
// while (controller.IsActive()) {
|
|
||||||
// controller.OnInput();
|
|
||||||
// if (auto status = controller.OnLoad(); !status.ok()) {
|
|
||||||
// std::cerr << status.message() << std::endl;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// controller.DoRender();
|
|
||||||
// }
|
|
||||||
// controller.OnExit();
|
|
||||||
//
|
|
||||||
// return EXIT_SUCCESS;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
// int main(int argc, char *argv[])
|
|
||||||
//{
|
|
||||||
// return SDL_UIKitRunApp(argc, argv, SDL_main);
|
|
||||||
// }
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||||
|
|||||||
Reference in New Issue
Block a user