cleanup iOS code

This commit is contained in:
2018-08-08 22:15:33 +02:00
parent 49a72cb1e7
commit 25ff880b76

View File

@@ -203,15 +203,10 @@ std::set<UITouch*> ignored_touch;
if (source == kEventSource::Stylus)
pen_down = true;
// if (touch.majorRadius > 25.f)
// ignored_touch.insert(touch);
// NSLog(@"touch down size %f", touch.majorRadius);
// [self async_lock];
std::lock_guard<std::mutex> lock(task_mutex);
tasklist.emplace_back([touchLocation, scale, f=touch.force, source] {
App::I.mouse_down(0, touchLocation.x * scale, touchLocation.y * scale, f, source);
});
// [self async_unlock];
t_count = 1;
t_pos = {touchLocation.x * scale, touchLocation.y * scale};
}
@@ -252,7 +247,6 @@ std::set<UITouch*> ignored_touch;
p1 = glm::vec2(tl1.x * scale, tl1.y * scale);
}
//[self async_lock];
if (pen_down)
{
std::lock_guard<std::mutex> lock(task_mutex);
@@ -281,7 +275,6 @@ std::set<UITouch*> ignored_touch;
{
UITouch *touch = valid_touches[0];
CGPoint touchLocation = [touch locationInView:self.view];
//auto p = glm::vec2(touchLocation.x * scale, touchLocation.y * scale);
float force = touch.type == UITouchType::UITouchTypeStylus ? touch.force : 1.0f;
if (t_count == 2)
{
@@ -297,7 +290,6 @@ std::set<UITouch*> ignored_touch;
});
}
}
//[self async_unlock];
t_pos = {tl0.x * scale, tl0.y * scale};
}
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
@@ -315,12 +307,6 @@ std::set<UITouch*> ignored_touch;
kEventSource source = touch.type == UITouchType::UITouchTypeStylus ? kEventSource::Stylus : kEventSource::Touch;
pen_down = false;
// [self async_lock];
// if (t_count == 2)
// App::I.gesture_end();
// else
// App::I.mouse_up(0, touchLocation.x * scale, touchLocation.y * scale, source);
// [self async_unlock];
std::lock_guard<std::mutex> lock(task_mutex);
tasklist.emplace_back([tc=t_count, touchLocation, scale, source] {
if (tc == 2)
@@ -418,11 +404,6 @@ std::set<UITouch*> ignored_touch;
#pragma mark - GLKView and GLKViewController delegate methods
- (void)update
{
}
- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
{
static auto time = std::chrono::steady_clock::now();