Skip to main content

Preparing Scenes and Views

This page covers the preparation of the foundation used throughout the subsequent pages. Starting from the Empty solution, you will set up a learning environment, configure the Render Targets, and create the basic scenes — Background, Header, MainContent, and DetailContent — along with the corresponding Views for each.

In the subsequent pages, you will use these elements to learn about screen switching with sibling Views, screen structuring with parent-child Views, and conditional transitions using the Action Chain Editor and Condition Editor.

Preparing the solution

In this task, you prepare a learning environment free from the influence of existing samples. If unnecessary scenes or State Machines remain from the start, they can be difficult to distinguish from the structures you are about to create, so it is important to clean them up first.

  1. Create a new solution from the sample solution Empty.

  2. In the Solution Explorer, delete the Scene2D and Scene3D scenes from Scenes.

  3. Select Render Targets under Scenes and configure the following properties in the Properties panel:
    Property Category Item Value
    Render Target Auto Swap True
      Auto Clear True

  4. Next, delete the GlobalStateMachine from the State Machine in the Solution Explorer.

  5. Save the solution with a name of your choice.
This configuration enables the system to update the display all at once after the entire Render Target finishes drawing, rather than reflecting each camera's rendering to the display individually. However, to prevent afterimages from the previous screen, the critical factor is ensuring that the Background scene (created next) correctly handles color buffer clearing.

Background Scene

The purpose of this task is not simply to place a background. The Background scene plays the role of finalizing the screen's color content at the beginning of every frame. If this scene is not configured correctly, the previous screen might appear to remain visible, even though the View switch itself succeeds.

  1. Create a new 2D Scene and name it Background.

  2. Select the camera in the Scene Tree and configure the following properties in the Properties panel:
    Property Category Item Value
    Camera Sequence Number 0
      Clear Color Buffer True
      Enable Swapping False
  3. Place a 2D Text Node from the Toolbox onto the Scene Tree of the Background scene.
    Property Category Item Value
    Transform Position X 0
      Position Y 0
    2D Text Node Text Background

The Background scene requires Clear Color Buffer to be set to True. This clears the previous color content before drawing a new frame, so even when subsequent content scenes overlay their rendering with Clear Color Buffer set to False, the screen is less likely to appear doubled. Note that because the Background scene serves as both the shared background and the clearing handler, it is safer not to include screen-specific decorations in this scene.

Header Scene

Here, you create a shared display element that multiple screens reuse. The Header is an element displayed in both MainView and DetailView, so you will later extract it as an independent View for reuse.

  1. Create a new 2D Scene and name it Header.

  2. Select the camera in the Scene Tree and configure the following properties in the Properties panel:
    Property Category Item Value
    Camera Sequence Number 2
      Clear Color Buffer False
      Enable Swapping False
  3. Place a 2D Text Node from the Toolbox onto the Scene Tree of the Header scene.
    Property Category Item Value
    Transform Position X 300
      Position Y 10
    2D Text Node Text Common Header

The Header is a layer that simply overlays on top of the background and content. If you clear the color buffer here, you might erase previously drawn elements. By assigning a Sequence Number that places the Header in front of the background and the content, the Header achieves a natural stacking order as a heading.

MainContent Scene

In this task, you create the main screen content used for the first screen switch. The buttons you add here serve as the entry point for building sibling View transitions in the next page.

  1. Create a new 2D Scene and name it MainContent.

  2. Select the camera in the Scene Tree and configure the following properties in the Properties panel:
    Property Category Item Value
    Camera Sequence Number 1
      Clear Color Buffer False
      Enable Swapping False
  3. Place a 2D Text Node from the Toolbox onto the Scene Tree of the MainContent scene.
    Property Category Item Value
    Transform Position X 50
      Position Y 50
    2D Text Node Text Main Screen
  4. Next, add two TextButton controls and configure each as follows:
    Property Category Item Value
    TextButton 1
    General Name OpenDetailButton
    Transform Position X 100
      Position Y 100
    Control Text Open Detail
    TextButton 2
    General Name OpenNavigationButton
    Transform Position X 400
      Position Y 100
    Control Text Open Navigation

MainContent is ordinarya standard content scene placed on top of the background, so Clear Color Buffer remains set to False. The Background scene handles the clearing, and this Scene is responsiblescene only foroverlays layering itsthe screen contentscontent on top of it.that background.

DetailContent Scene

Here, you will create the contentscontent offor the DetailView. The Back button is used for the return transitiontransitions between sibling Views, and the CheckBox is used onas a later page as the control input for the conditional automatic transition.transitions in a later page.

  1. Create a new 2D Scene and name it DetailContent.DetailContent.

  2. Select the camera in the Scene Tree and configure the following settingsproperties in the Properties Panel.panel:
    Property Category Item Value
    Camera Sequence Number 1
      Clear Color Buffer False
      Enable Swapping False
  3. InPlace a 2D Text Node from the Toolbox onto the Scene Tree of the DetailContent Scene, place a 2D Text Node from the Toolbox.scene.
    Property Category Item Value
    Transform Position X 50
      Position Y 50
    2D Text Node Text Detail Screen
  4. Next, place a TextButton control and configure itthe asfollowing follows.properties:
    Property Category Item Value
    General Name BackButton
    Transform Position X 100
      Position Y 100
    Control Text Back
  5. Finally, add a CheckBox control and configure itthe asfollowing follows.properties:
    Property Category Item Value
    General Name KeepDetailOpenCheckBox
    Transform Position X 100
      Position Y 200
    Control Text Keep Detail Open

Creating Views from Scenes

At this stage, prepareyou make the basicfoundational buildingelements blockscreated soin thatthe theyprevious cansteps be referencedavailable as Views onfor later pages.reference. By creating Views from thescenes Scenesnow, inyou advance, it becomes easier tocan organize screen-level structurescompositions latermore easily in the View Definition Editor.Editor in the subsequent pages.

  1. Select each of the four Scenesscenes created in the previous steps,steps chooseand select Create View from the context menu,menu andto create thea View corresponding View forto each Scene.scene.
    drawing-4-1773735138.png

    Scene Name View Name (automatically assigned)
    Background Background_View
    Header Header_View
    MainContent MainContent_View
    DetailContent DetailContent_View

OnIn the next page, you will combine these elementsViews to constructcompose MainView and DetailViewDetailView, and learn how to switch between them as sibling Viewsrelationships on the View Tree.