LÖVE + Android + AdMob = дружба
Однажды возникло желание изучить для своих скромных нужд Lua. Но просто прочесть спецификации и примеры не интересно, и давно была мысль написать свою логическую игру под Android, начались поиски подходящего фреймворка для комфортной работы.
После недолгого просмотра гугла выделились 2 основных кандидата: Corona SDK и LÖVE. Corona SDK обладает, с моей точки зрения, несомненными преимуществами: поддержка, хорошая документация, легкая интеграция разнообразных магазинов/реклам/социальных сетей (нужное подчеркнуть). Несмотря на это, сам SDK платный, нет версии под Linux. Версия Starter обладает рядом ограничений.
После Corona SDK я взялся за внимательное рассмотрение LÖVE. Первым делом подкупила надпись на стартовой странице:
It’s free, open-source, and works on Windows, Mac OS X and Linux.
LÖVE is licensed under the liberal zlib/libpng license. That means you can use it freely for any purpose — including commercial ones.
Есть довольно хорошая документация даже на русском языке. Фреймфорк легок в установке. Как написать игру, используя LÖVE пользователь yegorf1 писал здесь и продолжил здесь. Так, неспешно изучая возможности фреймворка, я написал прототип своего приложения. И здесь началось самое интересное.
Вопрос №1
Как запустить приложение под андроид, чтобы наконец проверить свое «чудо» на любимом смартфоне?
Поиск ответа на этот вопрос навел меня на проект love-android-sdl2, разработчиком которого является Martin Felis. Как пишет автор, проект является портом LÖVE под андроид. По сути это порт Lua на SDL 2.0 под андроид.
- Пакуем свое приложение в zip-архив и переименовываем его в game.love
- Коприуем архив в папку assets проекта.
- Собираем .apk-файл согласно инструкциям для Linux, Windows, Mac OS X. Процесс подробно описан у автора, если кратко его описать, то это несколько шагов:
- Установка Android SDK, Android NDK
- Утановка Android SDK Platoform-tools, Android SDK Built-tools, Android 4.4.2 (API 19) and the Android Support Library через SDK Manager
- Запуск сборки в директории с проектом. Сначала ndk-build, потом ant debug.
На выходе мы имеем .apk-файл, который же можно залить в телефон и наконец потестировать! Как собрать релиз и подписать его, можно подробно почитать здесь.
Итак, ответ на первый вопрос получен. Конечно, сделать быстрое или очень экономное приложение вряд ли получится, но для быстрого прототипирования на Lua или легковесной игры самое то. Почти пустой .apk-файл сразу весит около 5 мб, а основное приложение в ассетах может повергнуть эстетов Java или С++ в легкий шок, хотя насчет последних я не уверен. Можно попробовать убрать ненужные библиотеки, но это уже тема других экспериментов.
Когда приложение стало приобретать все более законченные черты, пришла пора задуматься о возможной монетизации. Конечно, есть вариант совсем для ленивых. Выставить приложение за фиксированную цену и ждать у моря на Мальдивах легкого бриза. Но я себе такого пока позволить не могу, а учитывая таргетирование на андроид, я подумал, что надо так или иначе встроить рекламу. Интеграцией с рекламным сервисом AdMob я никогда не занимался. Учитывая специфику получившегося «бутерброда» из библиотек, мне стало еще интереснее.
Вопрос №2
Как интегрировать AdMob в свое приложение?
Поскольку официальная справка (en и рус) предлагает использовать в этом процесс Eclipse, стало очевидно, что:
- Необходимо собрать приложение в Eclipse. Эта часть в основном полезна для новичков. Для этого скачиваем чистый проект love-android-sdl2.
- Открываем Eclipse (я использую из ADT Bundle). Создаем новый workspace и добавляем наш проект File → New → Project… → Android → Android Project from Existing Code.
Далее указываем путь до папки с проектом. Должно определиться 2 проекта: love-android-sdl2 и SDLActivity. Жмем Finish. - Заходим в свойства проекта SDLActivity. Левой кнопкой мыши жмем на проект, выбираем Properties. Далее Android и ставим галочку Is Library. Жмем OK.
- Заходим в свойства проекта love-android-sdl2. Java Build Path → вкладка Libraries → Add JARs… → находим SDLActivity/bin/sdlactivity.jar.
- Затем идем во вкладку Builders и снимаем галочку напротив [Löve] Generate Internal Scripts.
- Нажимаем кнопку Run As… → Android Application
.
- Ждем пока соберется проект, и Eclipse попросит нас подключить устройство или запустить love-android-sdl2.apk на эмуляторе.
Первая серия экспериментов с использованием официальной справки по интеграции AdMob не привела к успеху. Я обратился за помощью к разработчику проекта, но он ответил, что еще не пробовал добавлять AdMob в свой проект, и что ему бы было тоже интересно, как это сделать.
- Следуем инструкциям стандартной справки начиная с раздела 1. Внедрение библиотеки сервисов Google Play в проект. Единственное оговорюсь, что проект google-play-services_lib необходимо добавить сначала из sdk/extras/google/google_play_services/libproject/google-play-services_lib.
- Дальше можно сделать Project → Clean… → Clean all project → OK и перезапустить сборку.
- Открываем файл love-android-sdl2/src/org.love2d.android/GameActivity.java
- Дописываем необходимый код.
Ответ на второй и больше всего волнующий меня вопрос был найден. Таким способом мне удалось «подружить» LÖVE, Android и AdMob. Моя игра почти закончена, я надеюсь на скорый релиз. Happy end.
Источник
ANDROID Приложение
ANDROID ПРИЛОЖЕНИЯ ЖАНР Техпомещения
Love Is
Описание
Love Is Android APP
«Love Is» show different country’s I Love You.In Valentine’s day share those Romantic pictures and musics.
What’s the love?How to show your love?Use this.
Love Is is developed by me and Love Is is a crystal of wisdom by many skilled professionals. As is known, Love Is has experienced closed beta carefully by experts concerned and Love Is has been put great expectations.
Actually, Love Is has many attractive features as follows:
Love Is possesses high fashion style;
Love Is possesses amazing animations;
Love Is possesses high-Definition interface;
Love Is possesses convenient operation system;
Love Is possesses funny interactions.
Furthurmore, Love Is is technically supported strongly. Lots of professionals often update Love Is, fix bugs of Love Is promotely and add the newest information to Love Is frequentely.
With Love Is, you can experience professionals exertion;
With Love Is, you can experience practical utility;
With Love Is, you can experience great convenience;
With Love Is, you can experience flow operation;
All in all, Love Is will definitely provide you incredible time!
Are you ready to experience the pleasure Love Is offers you?
Lets download Love Is now!
So far, Love Is has received lots of positive feedback and you will enjoy Love Is very much. If you find Love Is a satisfactory app, please give Love Is a good vote. And to write a commendatory review for Love Is is also well recommanded. We sincerely appreciate your support for Love Is.
Источник
Love is android app
Android build setup for LÖVE.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Android Port of LÖVE, an awesome 2D game engine for Lua (http://love2d.org)
Copyright (c) 2006-2020 LOVE Development Team
You can download pre-built Android packages from https://github.com/love2d/love/releases/latest that allow you to run .love files by opening them using a file manager of your choice.
If you want to build from source, make sure to clone the submodules too. Often errors include missing liblove.so and «Missing LÖVE» error when building. A proper way to clone this repository is:
Add -b
and —depth 1 if needed.
If you already cloned the repository but forgot to initialize the submodules, execute:
In the repository directory. For the last command, add —depth 1 if needed.
Before you start, install JDK 11 or later. If you intend to build from Android Studio, skip this step as Android Studio bundles its own JDK 11.
Install Android SDK with SDK API 30 and Android NDK 21.3.6528147, set the environment variables:
- ANDROID_HOME to your Android SDK location.
(you may have to adjust the paths to the install directories of the Android SDK on your system) and run
in the root folder of this project. This should give you a .apk file in the app/build/outputs/apk/normal subdirectory that you can then sign and install on your phone. The normal .apk flavor is what you normally have when downloading one from love2d.org.
If you want to put your game inside the APK, put your zipped *.love in app/src/main/assets with name game.love then change the package name, application display name, and the icons. Afterwards, run either gradlew assembleEmbedRelease to generate APK which you can install or gradlew bundleEmbedRelease which you can upload to Play Store.
Alternatively, you can install Android Studio 2020.3.1 or later. After opening it for the first time, open it’s SDK Manager and on the tab «SDK Tools», tick «Show Package Details» then select NDK (Side By Side) version 21.3.6528147. After that, open the repository root.
Notice: Previously, the embed + APKTool method is preferred, but recent announcements by Google render that method obsolete.
Bugs and/or feature requests should be reported to the issue tracker at:
- Contains all relevant changes for desktop LÖVE 11.3.
- Added support for microphone recording on Android. This is disabled in Play Store builds.
- Added t.audio.mic ( false by default). On Android, setting it to true requests microphone recording permission from the user.
- Fixed performance regression on Android devices with Adreno GPU.
- Fixed video playback support on Android devices with Adreno GPU.
- Contains all relevant changes for desktop LÖVE 11.2.
- Added support for ARM64 devices to comply with Play Store requirements.
- Fixed love.system.openURL crashing in some cases.
- Changed target SDK to 28 so it comply with Play Store requirements.
- Contains all relevant changes for desktop LÖVE 0.10.2.
- Upgrade of SDL2 to 2.0.5 (fixes an issue with the accelerometer)
- Contains all relevant changes for desktop LÖVE 0.10.1.
- Added a new love.conf flag t.externalstorage, which determines whether files are saved in internal or external storage on Android devices.
- Fixed audio on Android to pause when the app is inactive, and resume when the app becomes active again.
- Fixed a driver bug on some Android devices which caused all objects to show up as black.
- Fixed love.graphics.clear(colortable) causing crashes on OpenGL ES 2 systems when a Canvas is active.
- New icons
- first official release!
- Disabled JIT by default as it can cause performance problems. To enable JIT call jit.on()
- Update to the next love API 0.10.0 (not yet officially released)
- Added building of libtheora
- Updated LuaJIT from 2.0.1 to 2.1
- Fixed a compatibility issue with Android 2.3 devices
- Updated libogg from 1.3.2. to 1.3.5
- Updated OpenAL to 1.17.0
- Updated SDL2 to a dev version of 2.0.4
- Added bugfix for ParticleSystem:clone
- updated API to match that of LÖVE 0.9.2
- love.window.setFullscreen can be used to switch between regular and immersive mode without status and navbar
- added loading of games by opening a main.lua file
- quitting LÖVE now conforms to the Android application lifecycle
- stop vibrator when app is paused
- fixed battery drain by properly pausing OpenAL device
- fixed printing of non-number and non-string values
- fixed compilation of Android NDK r10
- fixed compilation warnings concerning APP_PLATFORM
- old instance is shut down when opening a new game (note: it may crash when opening games at a high frequency, e.g. more than 2 per second)
- updated OpenAL-Soft to version 1.16.0
- updated to newer SDL version (f9244b2a151)
- added love.system.vibrate(seconds)
- print statements are now redirected to logcat. Output is prefixed with «[LOVE] «
- removed DevIL, libpng, libjpeg, libmng, and libtiff
- pngs are loaded using lodepng and jpegs using libturbo-jpeg
- repeatedly fixed a bug which caused Release builds to crash
- update to latest mobile-common branch
- using latest SDL_androidgl.c (fixes some random performance issues)
- using latest love-android @ changeset 8659be0e75a3 (adds support for compressed textures)
- uses 0.9.1 API
- fixed crash on Moto G (and possibly other devices). This was a nasty bug that would just show a blue screen without an error message. The bug was resolved using the help of headchant
- fixed loading of jpegs (it probably hasn’t worked up to now)
- fixed issues with looping over active touches. This fix was sponsored by slime!
Источник
Love Sick 1.81.0
Love Sick – это увлекательные любовные новеллы, в которых вы будете главным персонажем. Установите приложение на свой смартфон или планшет и ощутите себя в центре любовных историй.
Игра Love Sick – настоящая находка для любителей женских романов. У вас перед глазами начнут оживать персонажи любовных книг, преданные поклонники и стервозные соперницы. Вы окажетесь в центре сюжета и сможете управлять ходом действий, выбирать собственный стиль, развитие отношений. Вы сможете посетить бал вампиров, царский дворец или устроить шпионские игры в современном Нью-Йорке. Только вам решать, где и как будут развиваться события.
Особенности игры Love Sick:
- Яркий стиль: различные модные образы помогут раскрыть собственную индивидуальность;
- Возможность выбрать идеального мужчину: интеллигентного миллиардера, отчаянного вампира или наглого и заносчивого принца;
- Возможность усовершенствовать свои навыки в любовном флирте;
- Несколько увлекательных сюжетных линий;
- Красивые, яркие персонажи;
- Красочные декорации и интерьеры;
- Простое и удобное управление.
Источник