FPLBase
An open source project by
FPL.
|
General utility functions, used by FPLBase, and that might be of use to people using the library: More...
#include <functional>
#include <string>
#include "fplbase/config.h"
#include "mathfu/utilities.h"
#include <jni.h>
Go to the source code of this file.
General utility functions, used by FPLBase, and that might be of use to people using the library:
Classes | |
struct | fplbase::HighPerformanceParams |
HighPerformanceParams are used on Android to configure simulated key presses, in order to stop the CPU governor (see https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt) from reducing the CPU frequency when a user is not providing tactile input. More... | |
Namespaces | |
fplbase | |
Namespace for FPLBase library. | |
Typedefs | |
typedef std::function< bool(const char *filename, std::string *dest)> | fplbase::LoadFileFunction |
Called by LoadFile() . | |
typedef void(* | fplbase::VsyncCallback )(void) |
Used for Android to represent a Vsync callback function. | |
Enumerations | |
enum | fplbase::LogCategory { kApplication = 0, kError = 1, kSystem = 3, kAudio = 4, kVideo = 5, kRender = 6, kInput = 7, kCustom = 19 } |
Constants for use with LogInfo, LogError, etc. | |
enum | fplbase::PerformanceMode { kNormalPerformance = 0, kHighPerformance } |
Enum for use with the Set/GetPerformanceMode() functions. | |
Functions | |
bool | fplbase::LoadFileRaw (const char *filename, std::string *dest) |
Loads a file and returns its contents via string pointer. More... | |
bool | fplbase::LoadFile (const char *filename, std::string *dest) |
Loads a file and returns its contents via string pointer. More... | |
LoadFileFunction | fplbase::SetLoadFileFunction (LoadFileFunction load_file_function) |
Set the function called by LoadFile() . More... | |
bool | fplbase::SaveFile (const char *filename, const std::string &data) |
Save a string to a file, overwriting the existing contents. More... | |
bool | fplbase::SaveFile (const char *filename, const void *data, size_t size) |
Save a string to a file, overwriting the existing contents. More... | |
bool | fplbase::LoadPreferences (const char *filename, std::string *dest) |
Load preference settings. More... | |
bool | fplbase::SavePreferences (const char *filename, const void *data, size_t size) |
Save preference settings. More... | |
int32_t | fplbase::LoadPreference (const char *key, int32_t initial_value) |
Load a single integer value to a preference. More... | |
bool | fplbase::SavePreference (const char *key, int32_t value) |
Save a single integer value to a preference. More... | |
const void * | fplbase::MapFile (const char *filename, int32_t offset, int32_t *size) |
Map a file into memory and returns its contents via pointer. More... | |
void | fplbase::UnmapFile (const void *file, int32_t size) |
Unmap a pointer that is mapped via MapFile() API. More... | |
bool | fplbase::ChangeToUpstreamDir (const char *const binary_dir, const char *const target_dir) |
Search and change to a given directory. More... | |
bool | fplbase::MipmapGeneration16bppSupported () |
check if 16bpp MipMap is supported. More... | |
int32_t | fplbase::GetSystemRamSize () |
Get the system's RAM size. More... | |
void | fplbase::LogInfo (const char *fmt, va_list args) |
Log a format string with Info priority to the console. More... | |
void | fplbase::LogError (const char *fmt, va_list args) |
Log a format string with Error priority to the console. More... | |
void | fplbase::LogInfo (LogCategory category, const char *fmt, va_list args) |
Log a format string with Info priority to the console. More... | |
void | fplbase::LogError (LogCategory category, const char *fmt, va_list args) |
Log a format string with Error priority to the console. More... | |
void | fplbase::LogInfo (const char *fmt,...) |
Log a format string with Info priority to the console. More... | |
void | fplbase::LogError (const char *fmt,...) |
Log a format string with Error priority to the console. More... | |
void | fplbase::LogInfo (LogCategory category, const char *fmt,...) |
Log a format string with Info priority to the console. More... | |
void | fplbase::LogError (LogCategory category, const char *fmt,...) |
Log a format string with Error priority to the console. More... | |
jobject | fplbase::AndroidGetActivity () |
Get the Android activity class. More... | |
JNIEnv * | fplbase::AndroidGetJNIEnv () |
Get the Java native interface object (JNIEnv). More... | |
VsyncCallback | fplbase::RegisterVsyncCallback (VsyncCallback callback) |
Register for handling vsync callbacks on android. More... | |
void | fplbase::WaitForVsync () |
Blocks until the next time a VSync happens. | |
int | fplbase::GetVsyncFrameId () |
Get Vsync frame id. More... | |
void | fplbase::SendKeypressEventToAndroid (int android_keycode) |
Triggers a keypress event on an Android device. More... | |
std::string | fplbase::AndroidGetActivityName () |
Get the name of the current activity class. More... | |
std::string | fplbase::AndroidGetViewIntentData () |
Determine whether the activity was started with Intent.ACTION_VIEW and, if so, return the data the user wants to "view" in the application. More... | |
bool | fplbase::GetStoragePath (const char *app_name, std::string *path) |
Retrieve a path where an app can store data files. More... | |
bool | fplbase::SupportsHeadMountedDisplay () |
Checks whether Head Mounted Displays, such as Cardboard, are supported by the system being run on. More... | |
bool | fplbase::TouchScreenDevice () |
Checks if the device has a touchscreen. More... | |
bool | fplbase::IsTvDevice () |
Checks whether the device we are running on is an Android TV device. More... | |
void | fplbase::SetPerformanceMode (PerformanceMode new_mode) |
Sets the performance mode. More... | |
PerformanceMode | fplbase::GetPerformanceMode () |
Get the current performance mode. More... | |
void | fplbase::RelaunchApplication () |
Relaunch the application. | |
void | fplbase::SetHighPerformanceParameters (const HighPerformanceParams ¶ms) |
Sets the specific parameters used by high-performance mode on Android. More... | |
const HighPerformanceParams & | fplbase::GetHighPerformanceParameters () |
Get the high performance parameters. More... | |
std::string | fplbase::DeviceModel () |
Get the Android device's model. More... | |
int32_t | fplbase::AndroidGetApiLevel () |
Get the Android device's API level. More... | |
Variables | |
const int | fplbase::kDefaultAndroidKeycode = 115 |
Used for Android to simulate a keypress. Corresponds to F24 , which is unavailable on most keyboards. | |
const double | fplbase::kDefaultTimeBetweenPresses = 1.0 |
Used for Android. Corresponds to the time, in seconds, between simulated keypresses. | |