Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED]Loading Level Problem
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Loading Level Problem

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 3 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lexan
    wrote on last edited by
    #1

    I am currently working on a game which involves several levels..but

    Is there any way to load the next level without overlaying the previous one?? I am using Loader to load the next qml level file.. but as Load and load new level files, it affects the entire game.. it starts to slow down animations included on my game

    Is there any way to load the next level file and destroy the previous one?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Diph
      wrote on last edited by
      #2

      I'm not sure if I understood, but if you are using one Loader it should destroy the previous one when new component is loaded.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nhojyer07
        wrote on last edited by
        #3

        If this is what you're doing, then it will really lag:

        main.qml
        {
        Loader {source: new.qml}
        }

        new.qml
        {
        Loader{source: newer.qml}
        }

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lexan
          wrote on last edited by
          #4

          diph: no , i believe its not..

          nhojyer07
          i have this code

          @Image{
          x: 40;y: 10
          width: 266;height: 179
          source:"images/menu/sipnayan.png"
          MouseArea{
          anchors.fill: parent
          onClicked: {
          MouseArea.enabled=false
          onClicked:pageLoader.source="Menu.qml"
          }
          }
          }
          Loader{
          id:pageLoader
          anchors.fill: parent
          }
          @

          1 Reply Last reply
          0
          • D Offline
            D Offline
            Diph
            wrote on last edited by
            #5

            You just want to show menu on top of the application without filling the whole app area?

            @Loader {
            id: pageLoader
            anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
            height: 100
            }@

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lexan
              wrote on last edited by
              #6

              no.. there's a new "page" for that

              1 Reply Last reply
              0
              • N Offline
                N Offline
                nhojyer07
                wrote on last edited by
                #7

                So you're the programmer of sipnayan.

                Anyway, what I did in my project is this. The main QML only has Loaders and Connections in it.

                main.qml:

                @{
                Loader{
                id: menuLoader
                source: "SceneMenu.qml"
                }
                Loader{
                id: gameLoader
                anchors.fill: parent
                }
                Connections {
                id: menuConnection
                target: menuLoader.item
                onGamestart: {
                gameLoader.source = "SceneGame.qml"
                menuLoader.source = ""
                }
                }
                }@

                SceneMenu.qml:

                @{
                ...
                signal gamestart

                MouseArea{onClicked: gamestart}
                }@

                When the player clicks the mouse area in scenemenu.qml, the gamestart signal is triggered, passed to menuConnection, and changes the sources of the Loaders.

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  lexan
                  wrote on last edited by
                  #8

                  and? can you please elaborate further? :D PUHLEASE :3

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved