This Monkey module allows you to load WebP images.
Supported targets: Android, iOS.
The module uses the WebP Android Backport library: github.com/alexey-pelykh/webp-android-backport.
- Go to the Monkey
modules_ext
directory git clone https://github.com/playttle/monkey-webp.git webp
git submodule update --init
-
Add a reference to the library in the
yourgame.build/android/project.properties
file:# Project target. target=android-13 android.library.reference.1=../../webp/native/webp-android-backport/webp-android-backport-library
-
Copy the
yourgame.build/android/local.properties
file from the your Android project towebp/native/webp-android-backport-library
. It contains a path to your Android SDK. Done! -
If you have pulled the source code from github.com, you will need to compile the native library using the Android NDK. From the command line, you shall call the
ndk-build
command in thewebp/native/webp-android-backport-library
directory. Also change target to android-13 atwebp/native/webp-android-backport-library/project.properties
.
iOS target uses the webp library which comes with the webp-android-backport-library.
If you have pulled the source code from github.com, it requires to compile WebP.framework
. Run the iosbuild.sh
script from the webp/native/webp-android-backport/webp-android-backport-library/jni/webp
directory. The script will create the WebP.framework
directory. Unfortunately, Monkey doesn't support import of the external frameworks, so in the WebP.framework
directory rename WebP
to WebP.a
.
Import webp
...
Local img:Image = WebP.LoadImage("picture.webp")
...
DrawImage(img, 0, 0)
Use cwebp utility to convert images into WebP format.
To run the example app:
$ transcc_macos -target=Android_Game -run example1.monkey
Photo courtesy of www.flickr.com/photos/camas
- Fork it.
- Create a branch (
git checkout -b work
) - Commit your changes (
git commit -am "Description."
) - Push to the branch (
git push origin work
) - Open a Pull Request
- (Optional) Follow our blog on Tumblr, enjoy a refreshing Diet Coke and wait
WebP for Monkey is released under the zlib/libpng license:
Copyright (c) 2013 Playttle LLC
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.