Integrating the Main Menu
Despite the potentially intimidating heading, there’s really not a whole lot we’ll need to do in order to incorporate all of the work from our snippets into the application’s code structure. In fact, after all of the effort and journeying we’ve done throughout this chapter, it may feel a bit anti-climactic when we finish this part of the work.
The most straightforward and simple way to do it is to copy and paste the whole of the MainMenuScene
class from the snippet into your local file, making sure to entirely replace the existing class declaration. You’ll need to only slightly adjust your import
statements; here are the two most relevant lines where this changes:
import { Scene, Vector3, Scalar, Observable, Sound, HemisphericLight } from "@babylonjs/core"; import { AdvancedDynamicTexture, Rectangle, Image, Button, Control, TextBlock, Grid, TextWrapping } from "@babylonjs/gui";
For the selection...