mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-11 08:36:38 -04:00
Fix files not being loaded after saving, and fix documentation for changes
This commit is contained in:
parent
96551c620e
commit
9f76f39cc7
@ -72,9 +72,6 @@ if __name__ == "__main__":
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
// need to load IndexedDB before running the game
|
|
||||||
function preloadIndexedDB() { _interop_LoadIndexedDB(); }
|
|
||||||
|
|
||||||
function resizeGameCanvas() {
|
function resizeGameCanvas() {
|
||||||
var cc_canv = $('canvas#canvas');
|
var cc_canv = $('canvas#canvas');
|
||||||
var dpi = window.devicePixelRatio;
|
var dpi = window.devicePixelRatio;
|
||||||
@ -98,7 +95,7 @@ if __name__ == "__main__":
|
|||||||
}
|
}
|
||||||
|
|
||||||
var Module = {
|
var Module = {
|
||||||
preRun: [ preloadIndexedDB, resizeGameCanvas ],
|
preRun: [ resizeGameCanvas ],
|
||||||
postRun: [],
|
postRun: [],
|
||||||
arguments: {{game_args|safe}},
|
arguments: {{game_args|safe}},
|
||||||
print: function(text) {
|
print: function(text) {
|
||||||
|
@ -26,11 +26,8 @@ You are required to have this HTML code somewhere in the page:
|
|||||||
<span id="logmsg"></span>
|
<span id="logmsg"></span>
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
// need to load IndexedDB before running the game
|
|
||||||
function preloadIndexedDB() { _interop_LoadIndexedDB(); }
|
|
||||||
|
|
||||||
var Module = {
|
var Module = {
|
||||||
preRun: [ preloadIndexedDB ],
|
preRun: [],
|
||||||
postRun: [],
|
postRun: [],
|
||||||
arguments: [ {username}, {mppass}, {server ip}, {server port} ],
|
arguments: [ {username}, {mppass}, {server ip}, {server port} ],
|
||||||
print: function(text) {
|
print: function(text) {
|
||||||
|
@ -168,7 +168,7 @@ Install libsdl2_devel, openal_devel, and libexecinfo_devel package if needed
|
|||||||
|
|
||||||
#### Web
|
#### Web
|
||||||
|
|
||||||
```emcc *.c -s ALLOW_MEMORY_GROWTH=1 --js-library interop_web.js --preload-file texpacks/default.zip```
|
```emcc *.c -s ALLOW_MEMORY_GROWTH=1 --js-library interop_web.js```
|
||||||
|
|
||||||
The generated javascript file has some issues. [See here for how to fix](doc/compile-fixes.md#webclient-patches)
|
The generated javascript file has some issues. [See here for how to fix](doc/compile-fixes.md#webclient-patches)
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ static int RunProgram(int argc, char** argv) {
|
|||||||
/* ClassiCube is sort of and sort of not the executable */
|
/* ClassiCube is sort of and sort of not the executable */
|
||||||
/* on iOS - UIKit is responsible for kickstarting the game. */
|
/* on iOS - UIKit is responsible for kickstarting the game. */
|
||||||
/* (this is handled in interop_ios.m as the code is Objective C) */
|
/* (this is handled in interop_ios.m as the code is Objective C) */
|
||||||
int main_real(int argc, char** argv) {
|
int ios_main(int argc, char** argv) {
|
||||||
SetupProgram(argc, argv);
|
SetupProgram(argc, argv);
|
||||||
for (;;) { RunProgram(argc, argv); }
|
for (;;) { RunProgram(argc, argv); }
|
||||||
return 0;
|
return 0;
|
||||||
@ -139,7 +139,7 @@ void android_main(void) {
|
|||||||
#if defined CC_NOMAIN
|
#if defined CC_NOMAIN
|
||||||
int main_real(int argc, char** argv) {
|
int main_real(int argc, char** argv) {
|
||||||
#elif defined CC_BUILD_WEB
|
#elif defined CC_BUILD_WEB
|
||||||
/* web does some asynchronous initialisation first, then calls actual main later */
|
/* webclient does some asynchronous initialisation first, then kickstarts the game after that */
|
||||||
int web_main(int argc, char** argv) {
|
int web_main(int argc, char** argv) {
|
||||||
#else
|
#else
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
@ -174,14 +174,14 @@ static UITextField* kb_widget;
|
|||||||
@implementation CCAppDelegate
|
@implementation CCAppDelegate
|
||||||
|
|
||||||
- (void)runMainLoop {
|
- (void)runMainLoop {
|
||||||
extern int main_real(int argc, char** argv);
|
extern int ios_main(int argc, char** argv);
|
||||||
main_real(1, NULL);
|
ios_main(1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||||
// Override point for customization after application launch.
|
// Override point for customization after application launch.
|
||||||
// schedule the actual main loop to run in next CFRunLoop iteration
|
// schedule the actual main loop to run in next CFRunLoop iteration
|
||||||
// (as calling main_real here doesn't work properly)
|
// (as calling ios_main here doesn't work properly)
|
||||||
[self performSelector:@selector(runMainLoop) withObject:nil afterDelay:0.0];
|
[self performSelector:@selector(runMainLoop) withObject:nil afterDelay:0.0];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ mergeInto(LibraryManager.library, {
|
|||||||
// Performance consideration: storing a normal JavaScript array to a IndexedDB is much slower than storing a typed array.
|
// Performance consideration: storing a normal JavaScript array to a IndexedDB is much slower than storing a typed array.
|
||||||
// Therefore always convert the file contents to a typed array first before writing the data to IndexedDB.
|
// Therefore always convert the file contents to a typed array first before writing the data to IndexedDB.
|
||||||
node.contents = MEMFS.getFileDataAsTypedArray(node);
|
node.contents = MEMFS.getFileDataAsTypedArray(node);
|
||||||
entry = { timestamp: node.mtime, mode: CCFS.MODE_TYPE_FILE, contents: node.contents };
|
entry = { timestamp: node.timestamp, mode: CCFS.MODE_TYPE_FILE, contents: node.contents };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user