summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2018-05-13 10:44:00 +0100
committerFreeArtMan <dos21h@gmail.com>2018-05-13 10:44:00 +0100
commitdc5f8d1412e2475f918a23e7eedecfa2488d3fc3 (patch)
treeb422608acdb2871f17e2046109b52c4fdadaeb58
parent96a7301dc3bcb1c4e5b219ef4f9c728c2b094eae (diff)
downloadmd-content-dc5f8d1412e2475f918a23e7eedecfa2488d3fc3.tar.gz
md-content-dc5f8d1412e2475f918a23e7eedecfa2488d3fc3.zip
Fixed error in source
-rw-r--r--md/writeup/web_assembly_sdl_example.md22
1 files changed, 10 insertions, 12 deletions
diff --git a/md/writeup/web_assembly_sdl_example.md b/md/writeup/web_assembly_sdl_example.md
index c6f475b..0e36f79 100644
--- a/md/writeup/web_assembly_sdl_example.md
+++ b/md/writeup/web_assembly_sdl_example.md
@@ -80,19 +80,17 @@ void main_tick() {
#else
int main_tick() {
#endif
-
+
+ render();
SDL_UpdateWindowSurface(window);
-
- #if !__EMSCRIPTEN__
- return 1;
- #endif
+#if !__EMSCRIPTEN__
+ return 0;
+#endif
}
void main_loop()
{
-
-
#if __EMSCRIPTEN__
emscripten_set_main_loop(main_tick, -1, 1);
@@ -101,20 +99,20 @@ void main_loop()
SDL_Event event;
- while (quit==0)
+ while (0 == quit)
{
while (SDL_PollEvent(&event))
{
+ quit = main_tick();
switch (event.type)
{
case SDL_QUIT:
quit = 1;
break;
}
- quit = main_tick();
+
}
- printf("Loop\n");
}
#endif
}
@@ -132,7 +130,7 @@ int main()
SDL_GL_SetSwapInterval(1);
blank = SDL_CreateRGBSurface(0, 16, 16, 32, 0, 255, 255, 50);
- Uint32 color = SDL_MapRGB(blank->format, 50, 0 , 0);
+ Uint32 color = SDL_MapRGB(blank->format, 150, 0 , 0);
for (int x = 0; x < 16; x++)
{
for (int y = 0; y < 16; y++)
@@ -146,7 +144,7 @@ int main()
main_loop();
SDL_DestroyWindow(window);
- SDL_Quit();
+ SDL_Quit();
return 0;
}