diff --git a/src/common/iOS.h b/src/common/iOS.h index 84c1e2717..d788e057f 100644 --- a/src/common/iOS.h +++ b/src/common/iOS.h @@ -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 diff --git a/src/common/iOS.mm b/src/common/iOS.mm index 297f463b0..fb04631d5 100644 --- a/src/common/iOS.mm +++ b/src/common/iOS.mm @@ -25,6 +25,8 @@ #import #import +#import + #include #include @@ -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); + } +} + } // ios } // love diff --git a/src/modules/font/BMFontRasterizer.cpp b/src/modules/font/BMFontRasterizer.cpp index b6df24b06..33b6351e1 100644 --- a/src/modules/font/BMFontRasterizer.cpp +++ b/src/modules/font/BMFontRasterizer.cpp @@ -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 data = filesystem->read(filename.c_str()); + StrongRef data = filesystem->read(filename.c_str()); data->release(); images[pageindex].set(imagemodule->newImageData(data.get())); diff --git a/src/modules/system/System.cpp b/src/modules/system/System.cpp index 881d5682f..cb3087a89 100755 --- a/src/modules/system/System.cpp +++ b/src/modules/system/System.cpp @@ -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