From 9e06dcf262951307c04477eda6b710bb556aafa2 Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 11 Oct 2015 13:32:25 +0200 Subject: [PATCH] Updated Compile your game for Web (markdown) --- Compile-your-game-for-Web.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Compile-your-game-for-Web.md b/Compile-your-game-for-Web.md index 6e7800d..d62942d 100644 --- a/Compile-your-game-for-Web.md +++ b/Compile-your-game-for-Web.md @@ -15,7 +15,9 @@ _NOTE: If a newer preconpiled SDK version (newer than sdk-1.34.1-64bit) is avail Before compiling your game, raylib library must be recompiled for HTML5. By default, when you install raylib using the Windows Installer, an already pre-compiled raylib HTML5 version is found in C:\raylib\raylib\src\libraylib.bc. Notepad++ uses this version but you can regenerate it just recompiling raylib for web (in case you have modified raylib sources or you updated it with GitHub develop branch sources). ##Preparing your raylib game for web -To compile your game for web, code must be slightly adapted. It means moving all your Update and Draw code to an external function. The reason for that is the way web games work within a browser; basically, the browser needs to control the game loop and just allow and Update-Draw cycle when the tab is selected or browser is not minimized. As reference, you can check `core_basic_window` sample adapted for web [here](https://github.com/raysan5/raylib/blob/master/examples/core_basic_window_web.c). +To compile your game for web, code must be slightly adapted. Basically it implies moving all your Update and Draw code to an external function. The reason for that is the way web games work within a browser; the browser needs to control the game loop and just allow and Update-Draw cycle when the tab is active or browser is not minimized. + +To see how code should be refactored to fit compilation for web, check [core_basic_window_web.c](https://github.com/raysan5/raylib/blob/master/examples/core_basic_window_web.c) example. ##Compiling raylib game -Just open your raylib web-prepared game code and run the Notepad++ script named `raylib_compile_emscripten`. Note that script defines some paths to the tools, check you are using the correct versions of those tools! \ No newline at end of file +Just open your raylib web-prepared game code and run the Notepad++ script named `raylib_compile_emscripten`. Note that script defines some paths to the required tools, check you are using the correct versions of those tools! \ No newline at end of file