Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Engine/include/Tempest/AndroidApi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../system/api/androidapi.h"
12 changes: 12 additions & 0 deletions Engine/system/api/androidapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <android/native_window.h>

#include <atomic>
#include <cassert>
#include <cstdlib>
#include <dlfcn.h>
#include <exception>
Expand All @@ -29,6 +30,17 @@ static bool focused = false;
static bool active = false;
static bool hasWindow = false;

std::filesystem::path AndroidApi::internalDataPath() {
assert(app!=nullptr && app->activity!=nullptr);
return app->activity->internalDataPath;
Comment thread
Try marked this conversation as resolved.
}

std::filesystem::path AndroidApi::externalDataPath() {
assert(app!=nullptr && app->activity!=nullptr);
const char* path = app->activity->externalDataPath;
return path!=nullptr ? path : "";
}

void AndroidApi::updateFocus() {
const bool next = resumed && focused;
if(active==next)
Expand Down
5 changes: 5 additions & 0 deletions Engine/system/api/androidapi.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#pragma once

#include <Tempest/SystemApi>
#include <filesystem>

namespace Tempest {

class AndroidApi final : SystemApi {
public:
static std::filesystem::path internalDataPath();
static std::filesystem::path externalDataPath();

private:
AndroidApi() = default;

Expand Down
Loading