Chapter 14 opening screen is blank
Opened this issue · 3 comments
I cannot get the opening screen to show up for the chapter 14 (UI and Mouse Input) code example. It compiles fine and the game works fine, just not the screens. I compiled with the command from the book:
em++ asteroid.cpp audio.cpp camera.cpp collider.cpp emitter.cpp enemy_ship.cpp finite_state_machine.cpp locator.cpp main.cpp particle.cpp player_ship.cpp projectile_pool.cpp projectile.cpp range.cpp render_manager.cpp shield.cpp ship.cpp star.cpp ui_button.cpp ui_sprite.cpp vector.cpp -o ui.html --preload-file audio --preload-file sprites -std=c++17 -s USE_WEBGL2=1 -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS=['png'] -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS=['png']
My fork with the compiled assets are here
https://github.com/focusright/Hands-On-Game-Development-with-WebAssembly/tree/master/Chapter14
Any help is appreciated, thanks.
Hi Mike,
I downloaded and compiled your code, and the opening screen seemed to work fine.
I noticed in your start_renderer function you've added a call to SDL_RenderPresent( renderer );
I downloaded the current version of the repository and realized that I needed to move SDL_RenderPresent to the game loop. I made that change and updated the repository.
I'm not sure why yours wasn't rendering the opening screen. Yours was working fine. I don't think you need SDL_RenderPresent in the start_renderer function. Just make sure it is being called at the end of the game_loop function.
Please let me know if that works.
Thanks,
Rick
Thanks Rick, I had gotten it working somehow but I will download your new change and check it out. Many thanks for writing the book.
No problem. Thanks for reading it :-)