summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2017-09-23 23:28:52 +0200
committerMichal Idziorek <m.i@gmx.at>2017-09-23 23:28:52 +0200
commit44cf354f43953fff2fe34c2888b57db5adc18a4b (patch)
tree4688366cbdd7b2aabea07e9a37b23373221e84d0
parent41c2d41746582db5439dc51a3c35b60384ea1e4a (diff)
added separate emscripten Makefile
-rw-r--r--Makefile5
-rw-r--r--Makefile.emscripten5
-rw-r--r--main.cpp8
3 files changed, 10 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 2045c66..65a486f 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,4 @@ clean:
rm -f lunatic_out.*
browser-game:
- emcc --std=c++11 -O2 World.cpp -o World.bc
- emcc --std=c++11 -O2 main.cpp -o main.bc
- emcc --std=c++11 -O2 PerlinNoise.cpp -o PerlinNoise.bc
- emcc -O2 World.bc main.bc PerlinNoise.bc -o lunatic_out.html -s USE_SDL=2 --preload-file music.wav --preload-file coin.wav --preload-file coin.bmp --preload-file earth01.bmp --preload-file fonts.bmp --preload-file gridder01.bmp --preload-file guy01.bmp --preload-file guy02.bmp --preload-file gridder02.bmp --preload-file gridder03.bmp -s TOTAL_MEMORY=536870912 --shell-file shell_minimal.html
+ bash -c "source /home/retard/emsdk-portable/emsdk_env.sh && make -f Makefile.emscripten"
diff --git a/Makefile.emscripten b/Makefile.emscripten
new file mode 100644
index 0000000..f75faef
--- /dev/null
+++ b/Makefile.emscripten
@@ -0,0 +1,5 @@
+browser-game:
+ emcc --std=c++11 -O2 World.cpp -o World.bc
+ emcc --std=c++11 -O2 main.cpp -o main.bc
+ emcc --std=c++11 -O2 PerlinNoise.cpp -o PerlinNoise.bc
+ emcc -O2 World.bc main.bc PerlinNoise.bc -o lunatic_out.html -s USE_SDL=2 --preload-file music.wav --preload-file coin.wav --preload-file coin.bmp --preload-file earth01.bmp --preload-file fonts.bmp --preload-file gridder01.bmp --preload-file guy01.bmp --preload-file guy02.bmp --preload-file gridder02.bmp --preload-file gridder03.bmp -s TOTAL_MEMORY=536870912 --shell-file shell_minimal.html
diff --git a/main.cpp b/main.cpp
index a218da5..59e1e4a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -447,9 +447,11 @@ void main_loop(void *arg)
break;
}
//show map !?
+#ifndef __EMSCRIPTEN__
rect={100,20,150,150};
SDL_RenderCopy(ctx->ren,ctx->textures[8],NULL,&rect);
+#endif
if(ctx->world.player.dead)
{
sdl_put_str(ctx->ren, ctx->textures[3],300, -1, 10,"LUNATIC LEMMY DIED!",250,100,100,19,ctx->win_width,ctx->win_height,1,2);
@@ -506,6 +508,7 @@ int main(int, char**){
ctx->textures.push_back(sdl_load_texture("gridder02.bmp",255,255,255,ctx->ren));
ctx->textures.push_back(sdl_load_texture("gridder03.bmp",255,255,255,ctx->ren));
// PERLIN GENEARTED MAP
+#ifndef __EMSCRIPTEN__
ctx->textures.push_back(SDL_CreateTexture(ctx->ren, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, 1024, 768));
double seed=22;
@@ -576,12 +579,9 @@ int main(int, char**){
}
}
SDL_SetRenderTarget(ctx->ren, NULL);
-
+#endif
// PERLIN GENEARTED MAP OVER
-
-
-
ctx->show_tiles_size=ctx->win_height/15;
ctx->show_tiles_back=ctx->win_width/ctx->show_tiles_size*0.25;