mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-08 14:56:12 -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>
|
||||
<script type='text/javascript'>
|
||||
// need to load IndexedDB before running the game
|
||||
function preloadIndexedDB() { _interop_LoadIndexedDB(); }
|
||||
|
||||
function resizeGameCanvas() {
|
||||
var cc_canv = $('canvas#canvas');
|
||||
var dpi = window.devicePixelRatio;
|
||||
@ -98,12 +95,12 @@ if __name__ == "__main__":
|
||||
}
|
||||
|
||||
var Module = {
|
||||
preRun: [ preloadIndexedDB, resizeGameCanvas ],
|
||||
preRun: [ resizeGameCanvas ],
|
||||
postRun: [],
|
||||
arguments: {{game_args|safe}},
|
||||
print: function(text) {
|
||||
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
||||
console.log(text);
|
||||
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
||||
console.log(text);
|
||||
},
|
||||
printErr: function(text) {
|
||||
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
||||
@ -111,9 +108,9 @@ if __name__ == "__main__":
|
||||
},
|
||||
canvas: (function() { return document.getElementById('canvas'); })(),
|
||||
setStatus: function(text) {
|
||||
console.log(text);
|
||||
document.getElementById('logmsg').innerHTML = text;
|
||||
},
|
||||
console.log(text);
|
||||
document.getElementById('logmsg').innerHTML = text;
|
||||
},
|
||||
totalDependencies: 0,
|
||||
monitorRunDependencies: function(left) {
|
||||
this.totalDependencies = Math.max(this.totalDependencies, left);
|
||||
|
@ -26,11 +26,8 @@ You are required to have this HTML code somewhere in the page:
|
||||
<span id="logmsg"></span>
|
||||
|
||||
<script type='text/javascript'>
|
||||
// need to load IndexedDB before running the game
|
||||
function preloadIndexedDB() { _interop_LoadIndexedDB(); }
|
||||
|
||||
var Module = {
|
||||
preRun: [ preloadIndexedDB ],
|
||||
preRun: [],
|
||||
postRun: [],
|
||||
arguments: [ {username}, {mppass}, {server ip}, {server port} ],
|
||||
print: function(text) {
|
||||
|
@ -168,7 +168,7 @@ Install libsdl2_devel, openal_devel, and libexecinfo_devel package if needed
|
||||
|
||||
#### 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)
|
||||
|
||||
|
@ -116,7 +116,7 @@ static int RunProgram(int argc, char** argv) {
|
||||
/* ClassiCube is sort of and sort of not the executable */
|
||||
/* on iOS - UIKit is responsible for kickstarting the game. */
|
||||
/* (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);
|
||||
for (;;) { RunProgram(argc, argv); }
|
||||
return 0;
|
||||
@ -139,7 +139,7 @@ void android_main(void) {
|
||||
#if defined CC_NOMAIN
|
||||
int main_real(int argc, char** argv) {
|
||||
#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) {
|
||||
#else
|
||||
int main(int argc, char** argv) {
|
||||
|
@ -174,14 +174,14 @@ static UITextField* kb_widget;
|
||||
@implementation CCAppDelegate
|
||||
|
||||
- (void)runMainLoop {
|
||||
extern int main_real(int argc, char** argv);
|
||||
main_real(1, NULL);
|
||||
extern int ios_main(int argc, char** argv);
|
||||
ios_main(1, NULL);
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// Override point for customization after application launch.
|
||||
// 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];
|
||||
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.
|
||||
// Therefore always convert the file contents to a typed array first before writing the data to IndexedDB.
|
||||
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) {
|
||||
return callback(err);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user