|
| | LoadingScene () |
| |
| | ~LoadingScene () |
| |
| void | dispose () |
| |
| bool | init (const std::string scene, const std::string directory) |
| |
| bool | init (const std::shared_ptr< cugl::AssetManager > &manager, const std::string directory) |
| |
| std::shared_ptr< cugl::AssetManager > | getAssetManager () const |
| |
| void | start () |
| |
| void | update (float timestep) |
| |
| float | getProgress () const |
| |
| bool | isPending () const |
| |
| bool | isComplete () const |
| |
| | Scene2 () |
| |
| | ~Scene2 () |
| |
| virtual void | dispose () override |
| |
| virtual bool | init () override |
| |
| bool | initWithViewport (const Size &size) |
| |
| bool | initWithViewport (float width, float height) |
| |
| bool | initWithViewport (const Rect &rect) |
| |
| bool | initWithViewport (const Vec2 &origin, const Size &size) |
| |
| bool | initWithViewport (float x, float y, float width, float height) |
| |
| bool | initWithHint (const Size &hint) |
| |
| bool | initWithHint (float width, float height) |
| |
| const Rect & | getSafeBounds () const |
| |
| Color4 | getColor () const |
| |
| void | setColor (const Color4 color) |
| |
| virtual std::string | toString (bool verbose=false) const override |
| |
| size_t | getChildCount () const |
| |
| std::shared_ptr< scene2::SceneNode > & | getChild (unsigned int pos) |
| |
| const std::shared_ptr< scene2::SceneNode > & | getChild (unsigned int pos) const |
| |
| template<typename T > |
| std::shared_ptr< T > | getChild (unsigned int pos) const |
| |
| std::shared_ptr< scene2::SceneNode > | getChildByTag (unsigned int tag) const |
| |
| template<typename T > |
| std::shared_ptr< T > | getChildByTag (unsigned int tag) const |
| |
| std::shared_ptr< scene2::SceneNode > | getChildByName (const std::string name) const |
| |
| template<typename T > |
| std::shared_ptr< T > | getChildByName (const std::string name) const |
| |
| std::vector< std::shared_ptr< scene2::SceneNode > > & | getChildren () |
| |
| const std::vector< std::shared_ptr< scene2::SceneNode > > & | getChildren () const |
| |
| virtual void | addChild (const std::shared_ptr< scene2::SceneNode > &child) |
| |
| void | addChildWithTag (const std::shared_ptr< scene2::SceneNode > &child, unsigned int tag) |
| |
| void | addChildWithName (const std::shared_ptr< scene2::SceneNode > &child, const std::string name) |
| |
| void | swapChild (const std::shared_ptr< scene2::SceneNode > &child1, const std::shared_ptr< scene2::SceneNode > &child2, bool inherit=false) |
| |
| virtual void | removeChild (unsigned int pos) |
| |
| void | removeChild (const std::shared_ptr< scene2::SceneNode > &child) |
| |
| void | removeChildByTag (unsigned int tag) |
| |
| void | removeChildByName (const std::string name) |
| |
| virtual void | removeAllChildren () |
| |
| void | resizeViewport (const Size &size) |
| |
| void | resizeViewport (float width, float height) |
| |
| void | resizeToHint (const Size &hint) |
| |
| void | resizeToHint (float width, float height) |
| |
| std::shared_ptr< graphics::SpriteBatch > | getSpriteBatch () const |
| |
| void | setSpriteBatch (const std::shared_ptr< graphics::SpriteBatch > &batch) |
| |
| const std::shared_ptr< graphics::FrameBuffer > & | getFrameBuffer () const |
| |
| void | setFrameBuffer (const std::shared_ptr< graphics::FrameBuffer > &buffer) |
| |
| virtual void | render () override |
| |
| | Scene () |
| |
| | ~Scene () |
| |
| virtual void | dispose () |
| |
| virtual bool | init () |
| |
| const std::string & | getName () const |
| |
| void | setName (const std::string name) |
| |
| std::shared_ptr< Camera > & | getCamera () |
| |
| const std::shared_ptr< Camera > & | getCamera () const |
| |
| virtual std::string | toString (bool verbose=false) const |
| |
| | operator std::string () const |
| |
| const Size & | getSize () const |
| |
| const Rect | getBounds () const |
| |
| Vec3 | screenToWorldCoords (const Vec2 &screenCoords) const |
| |
| Vec2 | worldToScreenCoords (const Vec3 &worldCoords) const |
| |
| bool | isActive () const |
| |
| virtual void | setActive (bool value) |
| |
| virtual void | update (float dt) |
| |
| virtual void | reset () |
| |
| virtual void | render () |
| |
This class is a simple loading screen for asychronous asset loading.
This class will either create its own AssetManager, or it can be assigned on. In the latter case, it needs a json file defining the assets for the initial loading screen. In the former, the asset manager should come preloaded with these assets. To properly display to the screen, these assets must include a scene2::SceneNode named "load". This node must have at least four children:
- "load.before": The scene to display while loading is in progress
- "load.after": The scene to display when the loading is complete
- "load.bar": A {@link ProgressBar} for showing the loading progress
- "load.play" A play {@link Button} for the user to start the game
When the play button is pressed, this scene is deactivated, indicating to the application that it is time to switch scenes.
In addition to these assets, the loading scene will take the take of an asset directory. This is a JSON file defining the assets that should be loaded asynchronously by this loading scene. Accessing the asset manager with getAssetManager gives access to these assets.
| static std::shared_ptr< LoadingScene > cugl::scene2::LoadingScene::alloc |
( |
const std::shared_ptr< cugl::AssetManager > & |
manager, |
|
|
const std::string |
directory |
|
) |
| |
|
inlinestatic |
Returns a newly allocated loading scene with the given asset manager and directory.
The asset manager must already contain the scene graph used by this scene. The scene must include a scene2::SceneNode named "load". This node must have at least four children:
- "load.before": The scene to display while loading is in progress
- "load.after": The scene to display when the loading is complete
- "load.bar": A {@link ProgressBar} for showing the loading progress
- "load.play" A play {@link Button} for the user to start the game
The string directory is the asset directory to be loaded asynchronously by this scene. The progress on this directory can be monitored via getProgress.
- Parameters
-
| manager | A previously initialized asset manager |
| directory | The asset directory to load asynchronously |
- Returns
- a newly allocated loading scene with the given asset manager and directory.
| static std::shared_ptr< LoadingScene > cugl::scene2::LoadingScene::alloc |
( |
const std::string |
scene, |
|
|
const std::string |
directory |
|
) |
| |
|
inlinestatic |
Returns a newly allocated loading scene with the given scene and directory.
This class will create its own AssetManager, which can be accessed via getAssetManager. This asset manager will only attach loaders for graphics::Font, graphics::Texture, scene2::SceneNode and WidgetValue.
The string scene should be a path to a JSON file that defines the scene graph for this loading scene. This file will be loaded synchronously, so it should be lightweight. The scene must include a scene2::SceneNode named "load". This node must have at least four children:
- "load.before": The scene to display while loading is in progress
- "load.after": The scene to display when the loading is complete
- "load.bar": A {@link ProgressBar} for showing the loading progress
- "load.play" A play {@link Button} for the user to start the game
The string directory is the asset directory to be loaded asynchronously by this scene. The progress on this directory can be monitored via getProgress.
- Parameters
-
| scene | A JSON file with the scene graph for this scene |
| directory | The asset directory to load asynchronously |
- Returns
- a newly allocated loading scene with the given scene and directory.
| bool cugl::scene2::LoadingScene::init |
( |
const std::shared_ptr< cugl::AssetManager > & |
manager, |
|
|
const std::string |
directory |
|
) |
| |
Initializes a loading scene with the given asset manager and directory.
The asset manager must already contain the scene graph used by this scene. The scene must include a scene2::SceneNode named "load". This node must have at least four children:
- "load.before": The scene to display while loading is in progress
- "load.after": The scene to display when the loading is complete
- "load.bar": A {@link ProgressBar} for showing the loading progress
- "load.play" A play {@link Button} for the user to start the game
The string directory is the asset directory to be loaded asynchronously by this scene. The progress on this directory can be monitored via getProgress.
- Parameters
-
| manager | A previously initialized asset manager |
| directory | The asset directory to load asynchronously |
- Returns
- true if the scene is initialized properly, false otherwise.
| bool cugl::scene2::LoadingScene::init |
( |
const std::string |
scene, |
|
|
const std::string |
directory |
|
) |
| |
Initializes a loading scene with the given scene and directory.
This class will create its own AssetManager, which can be accessed via getAssetManager. This asset manager will only attach loaders for graphics::Font, graphics::Texture, scene2::SceneNode and WidgetValue.
The string scene should be a path to a JSON file that defines the scene graph for this loading scene. This file will be loaded synchronously, so it should be lightweight. The scene must include a scene2::SceneNode named "load". This node must have at least four children:
- "load.before": The scene to display while loading is in progress
- "load.after": The scene to display when the loading is complete
- "load.bar": A {@link ProgressBar} for showing the loading progress
- "load.play" A play {@link Button} for the user to start the game
The string directory is the asset directory to be loaded asynchronously by this scene. The progress on this directory can be monitored via getProgress.
- Parameters
-
| scene | A JSON file with the scene graph for this scene |
| directory | The asset directory to load asynchronously |
- Returns
- true if the scene is initialized properly, false otherwise.