@@ -59,6 +59,11 @@ bool openURL(const std::string &url);
**/
std::string getExecutablePath();
+/**
+ * Causes devices with vibration support to vibrate for about 0.5 seconds.
+ **/
+void vibrate();
+
} // ios
} // love
@@ -25,6 +25,8 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
+#import <AudioToolbox/AudioServices.h>
#include <vector>
#include <SDL_events.h>
@@ -321,6 +323,17 @@ std::string getExecutablePath()
}
+static dispatch_queue_t queue = nil;
+static dispatch_source_t timer = nil;
+void vibrate()
+{
+ @autoreleasepool
+ {
+ AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
+ }
+}
@@ -199,7 +199,7 @@ void BMFontRasterizer::parseConfig(const std::string &configtext)
throw love::Exception("Image module not loaded!");
// Release these variables right away since StrongRef retains.
- StrongRef<filesystem::FileData> data = filesystem->read(filename.c_str());
+ StrongRef<FileData> data = filesystem->read(filename.c_str());
data->release();
images[pageindex].set(imagemodule->newImageData(data.get()));
@@ -146,6 +146,8 @@ void System::vibrate(double seconds) const
{
#ifdef LOVE_ANDROID
love::android::vibrate(seconds);
+#elif defined(LOVE_IOS)
+ love::ios::vibrate();
#else
LOVE_UNUSED(seconds);
#endif