mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
7b66e50cfc
To send file to the filedropped callback, share the files to the game. Note that for non-fused binary, if there's no game running, LOVE treat it as *.love game to run.
125 lines
3.1 KiB
C++
125 lines
3.1 KiB
C++
/**
|
|
* Copyright (c) 2006-2022 LOVE Development Team
|
|
*
|
|
* 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.
|
|
**/
|
|
|
|
#ifndef LOVE_ANDROID_H
|
|
#define LOVE_ANDROID_H
|
|
|
|
#include "config.h"
|
|
|
|
#ifdef LOVE_ANDROID
|
|
|
|
#include <string>
|
|
|
|
namespace love
|
|
{
|
|
namespace android
|
|
{
|
|
|
|
/**
|
|
* Enables or disables immersive mode where the navigation bar is hidden.
|
|
**/
|
|
void setImmersive(bool immersive_active);
|
|
bool getImmersive();
|
|
|
|
/**
|
|
* Gets the scale factor of the window's screen, e.g. on Retina displays this
|
|
* will return 2.0.
|
|
**/
|
|
double getScreenScale();
|
|
|
|
/**
|
|
* Gets the window safe area, e.g. phone with notch display.
|
|
* Returns false if safe area is not set.
|
|
**/
|
|
bool getSafeArea(int &top, int &left, int &bottom, int &right);
|
|
|
|
bool openURL(const std::string &url);
|
|
|
|
void vibrate(double seconds);
|
|
|
|
/*
|
|
* Helper functions for the filesystem module
|
|
*/
|
|
void freeGameArchiveMemory(void *ptr);
|
|
|
|
bool directoryExists(const char *path);
|
|
|
|
bool mkdir(const char *path);
|
|
|
|
bool createStorageDirectories();
|
|
|
|
bool hasBackgroundMusic();
|
|
|
|
bool hasRecordingPermission();
|
|
|
|
void requestRecordingPermission();
|
|
|
|
void showRecordingPermissionMissingDialog();
|
|
|
|
/**
|
|
* Initialize Android AAsset virtual archive.
|
|
* @return true if successful.
|
|
*/
|
|
bool initializeVirtualArchive();
|
|
|
|
/**
|
|
* Deinitialize Android AAsset virtual archive.
|
|
* @return true if successful.
|
|
*/
|
|
void deinitializeVirtualArchive();
|
|
|
|
/**
|
|
* Retrieve the fused game inside the APK
|
|
* @param physfsIO_Out Pointer to PHYSFS_Io* struct
|
|
* @return true if there's game inside the APK. If physfsIO_Out is not null, then it contains
|
|
* the game.love which needs to be mounted to root. false if it's not fused, in which case
|
|
* physfsIO_Out is undefined.
|
|
*/
|
|
bool checkFusedGame(void **physfsIO_Out);
|
|
|
|
const char *getCRequirePath();
|
|
|
|
/**
|
|
* Convert "content://" to file descriptor.
|
|
* @param path Path with content:// URI
|
|
* @return File descriptor if successful, -1 on failure.
|
|
*/
|
|
int getFDFromContentProtocol(const char *path);
|
|
|
|
/**
|
|
* Attempt to parse "(/)love2d://fd/<fd>" from path.
|
|
* @param path Potentially special path.
|
|
* @return File descriptor passed if successful, -1 if path is not valid.
|
|
*/
|
|
int getFDFromLoveProtocol(const char *path);
|
|
|
|
/**
|
|
* Create PHYSFS_Io from file descriptor.
|
|
* @param fd File descriptor
|
|
* @return PHYSFS_Io casted to void*.
|
|
*/
|
|
void *getIOFromFD(int fd);
|
|
|
|
} // android
|
|
} // love
|
|
|
|
#endif // LOVE_ANDROID
|
|
#endif // LOVE_ANDROID_H
|