Skip to content

Commit

Permalink
- add haptic selection api
Browse files Browse the repository at this point in the history
  • Loading branch information
polymonster committed Jan 14, 2024
1 parent e9f7f4a commit 64c5d31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/pen/include/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace pen
void os_open_url(const Str& url);
void os_ignore_slient();
f32 os_get_status_bar_portrait_height();
void os_haptic_selection_feedback();

// music
struct music_item
Expand Down
10 changes: 10 additions & 0 deletions core/pen/source/ios/os.mm
Original file line number Diff line number Diff line change
Expand Up @@ -433,4 +433,14 @@ f32 os_get_status_bar_portrait_height()
CGFloat s = [[UIScreen mainScreen] scale];
return (f32)h*s;
}

void os_haptic_selection_feedback()
{
@autoreleasepool {
auto generator = [[UISelectionFeedbackGenerator alloc] init];
[generator prepare];
[generator selectionChanged];
[generator release];
}
}
}

0 comments on commit 64c5d31

Please sign in to comment.