moai-dev | This is the development repo of Moai SDK | Game Engine library
kandi X-RAY | moai-dev Summary
kandi X-RAY | moai-dev Summary
moai sdk is an embeddable cross-platform game development sdk written in c++ and scriptable in lua. you can use moai to write games or apps, or you can embed moai in other programs. you can also use moai as an overlay in your apps. multiple build systems are supported in this project. sourcecode is kept in a common folder. there is a separate folder for each build system in the project root. for ide build systems (xcode, android studio, visual studio), reference projects are provided. cmake is also supported for android and html5. third party libraries are included as git submodules (in some cases). the rest are vendored in. as a rule, we do not make any code changes to third party libraries. if functionality must
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of moai-dev
moai-dev Key Features
moai-dev Examples and Code Snippets
Community Discussions
Trending Discussions on moai-dev
QUESTION
The game engine that I'm using to run my game in the browser runs lua and from my game i save files using normal fopen / write / fclose. The engine C/C++ code is compiled to JS through emscripten. What is a good way to get these file writes to end up in local storage, or some other in browser cache location? I have searched the web and looked at the documentation but information is very sparse, I have not found any clear answers to how this is supposed to work.
A previous contributor to the game engine added a js library to the emscripten build, that would override fclose
to call back to javascript. But this fclose override does not seem to get called anymore, it is not included in the final .js file at all.
ANSWER
Answered 2019-Feb-11 at 22:59Emscripten Filesystem API covers your case using IndexedDB but you may need to add some codes other than fopen
/write
/fclose
.
Here is the Filesystem API overview. It has four types:
MEMFS
: A volatile, in-memory storage. This is the default filesystem type which is mounted at/
at runtime.NODEFS
: This uses node.js fs api, which is not your case.IDBFS
: This makes use of IndexedDB and you may use it for offline storage.WORKERFS
: This is intended to be used inside of a worker.
You can use IDBFS
with Emscripten's own FS API (This is JavaScript-side API though). You need to mount it first in order to use it. You can achieve it by using FS.mkdir
,FS.mount
, and FS.syncfs
. Here is a rough example in C:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install moai-dev
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page