Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kyoz/godot-flashlight
:flashlight: Godot 3&4 plugin to use flashlight...
https://github.com/kyoz/godot-flashlight
android godot ios native plugin
Last synced: 2 months ago
JSON representation
:flashlight: Godot 3&4 plugin to use flashlight...
- Host: GitHub
- URL: https://github.com/kyoz/godot-flashlight
- Owner: kyoz
- License: mit
- Created: 2023-07-24T07:50:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-21T00:11:23.000Z (6 months ago)
- Last Synced: 2024-08-21T01:40:43.368Z (6 months ago)
- Topics: android, godot, ios, native, plugin
- Language: Shell
- Homepage: https://github.com/kyoz/godot-flashlight
- Size: 404 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
![]()
Godot Native Flashlight
Godot plugin to use Flashlight on Android/iOS. Support Godot 3 & 4.
About •
Installation •
Usage •
API •
Contribute •
Downloads# About
This plugin help turn on/off flashlight for mobile app (Android/iOS).
Was build using automation scripts combine with CI/CD to help faster the release progress and well as release hotfix which save some of our times.
Support Godot 3 & 4.
# Installation
## Android
Download the [android plugin](https://github.com/kyoz/godot-flashlight/releases) (match your Godot version), extract them to `your_project/android/plugins`
Enable `Flashlight` plugin in your android export preset
Enable `Flashlight` permission.
*Note*: You must [use custom build](https://docs.godotengine.org/en/stable/tutorials/export/android_custom_build.html) for Android to use plugins.
## iOS
Download the [ios plugin](https://github.com/kyoz/godot-flashlight/releases) (match your Godot version), extract them to `ios/plugins`
Enable `Flashlight` plugin in your ios export preset
# Usage
You will need to add an `autoload` script to use this plugin more easily.
Download [autoload file](./autoload) to your game (Choose correct Godot version). Add it to your project `autoload` list.
Then you can easily use it anywhere with:
```gdscript
Flashlight.init()
Flashlight.on()
Flashlight.off()# Godot 3
Flashlight.connect("on_error", self, "_on_error")# Godot 4
Flashlight.on_error.connect(_on_error)
```Why have to call `init()`. Well, if you don't want to call init, you can change `init()` to `_ready()` on the `autoload` file. But for my experience when using a lots of plugin, init all plugins on `_ready()` is not a good idea. So i let you choose whenever you init the plugin. When showing a loading scene...etc...
For more detail, see [examples](./example/)
# API
## Methods
```gdscript
void on() # Turn flashlight on
void off() # Turn flashlight off
```## Signals
```gdscript
signal on_error(error_message) # fail on trying to use flashlight, return error_message
```# Contribute
I want to help contribute to Godot community so i create these plugins. I'v prepared almost everything to help the development and release progress faster and easier.
Only one command and you'll build, release this plugin. Read [DEVELOP.md](./DEVELOP.md) for more information.
If you found bug of the plugin, please open issues.
If you have time to fix bugs or improve the plugins. Please open PR, it's always welcome.
# License
MIT © [Kyoz](mailto:[email protected])