Fix last commit

This commit is contained in:
UnknownShadow200 2019-04-20 17:09:01 +10:00
parent 4ab1359f85
commit 9adf946c43
6 changed files with 33 additions and 10 deletions

View File

@ -5,10 +5,17 @@
*/
#define GAME_MAX_CMDARGS 5
#define GAME_APP_NAME "ClassiCube 1.0.1 beta"
#define GAME_APP_VER "1.0.1"
#define GAME_APP_VER "1.0.1"
#define GAME_API_VER 1
#ifdef CC_BUILD_WEB
#define GAME_APP_NAME "ClassiCube web client"
#define GAME_APP_TITLE "ClassiCube"
#else
#define GAME_APP_NAME "ClassiCube 1.0.1 beta"
#define GAME_APP_TITLE "ClassiCube 1.0.1 beta"
#endif
/* Max number of characters strings can have. */
#define STRING_SIZE 64
/* Max number of characters filenames can have. */

View File

@ -136,7 +136,6 @@ typedef struct TextureRec_ { float U1, V1, U2, V2; } TextureRec;
#define CC_BUILD_GLES
#define CC_BUILD_WEBCANVAS
#define CC_BUILD_WEBGL
#error "Web backend is still a WIP. Please do not publicly mention it, thanks."
#endif
#endif

View File

@ -2,6 +2,8 @@
#include "Platform.h"
#include "Utils.h"
#include <math.h>
/* For abs(x) function */
#include <stdlib.h>
/* TODO: Replace with own functions that don't rely on <math> */

View File

@ -214,7 +214,7 @@ static void Launcher_Free(void) {
}
void Launcher_Run(void) {
const static String title = String_FromConst(GAME_APP_NAME);
const static String title = String_FromConst(GAME_APP_TITLE);
Window_CreateSimple(640, 400);
Window_SetTitle(&title);
Window_SetVisible(true);

View File

@ -1951,10 +1951,25 @@ void Platform_Init(void) {
}
#elif defined CC_BUILD_WEB
void Platform_Init(void) {
EM_ASM(
EM_ASM( Module['websocket']['subprotocol'] = 'ClassiCube'; );
/* NOTE: You must load IndexedDB before main() */
/* (because the callback to FS.synfc is asynchronous) */
/* If you don't, you'll get errors later trying to sync local to remote */
/*
function preloadIndexedDB() {
addRunDependency('load-idb');
FS.mkdir('/classicube');
FS.mount(IDBFS, {}, '/classicube');
FS.syncfs(true, function(err) { if (err) console.log(err); });
);
FS.syncfs(true, function(err) {
assert(!err);
removeRunDependency('load-idb');
})
}
var Module = {
preRun: [ preloadIndexedDB ],
......
*/
}
#endif

View File

@ -61,7 +61,7 @@ static void Program_RunGame(void) {
}
String_InitArray(title, titleBuffer);
String_Format2(&title, "%c (%s)", GAME_APP_NAME, &Game_Username);
String_Format2(&title, "%c (%s)", GAME_APP_TITLE, &Game_Username);
Game_Run(width, height, &title);
}
@ -140,9 +140,9 @@ int main(int argc, char** argv) {
argsCount = Platform_GetCommandLineArgs(argc, argv, args);
/* NOTE: Make sure to comment this out before pushing a commit */
String rawArgs = String_FromConst("UnknownShadow200 fffff 127.0.0.1 25565");
/* String rawArgs = String_FromConst("UnknownShadow200 fffff 127.0.0.1 25565"); */
/* String rawArgs = String_FromConst("UnknownShadow200"); */
argsCount = String_UNSAFE_Split(&rawArgs, ' ', args, 4);
/* argsCount = String_UNSAFE_Split(&rawArgs, ' ', args, 4); */
if (argsCount == 0) {
#ifdef CC_BUILD_WEB