android - Difference between libgdx Stage and Screen -
i'm making game, , see in tutorials people using stage class, , others using screen class, can't figure out diference.
a stage
holds actor
instances , updates/animates them , manages hit-detection among them. root of scene2d "scene graph" api. stage one way of managing list of objects draw, state on screen (textures, animation state, size, etc), , interactions user. provided stage code in libgdx oriented towards ui elements buttons , lists, core flexible enough contain game elements too.
a screen
represents 1 full-screen ui "page". example, might have "main menu" screen, "options" screen, "main game" screen , "end credits" screen. screen
instances managed game
instance. when used game
screen
objects receive standard libgdx lifecycle events callbacks (pause
, resume
, resize
, render
, etc).
there no concrete relationships between stage
, screen
in libgdx. easiest think of example "main menu" screen implemented stage manages buttons in main menu. when user hits 1 of buttons, game might switch main game-play screen, , release of resources held main menu. game-play screen might use stage
or might use raw opengl implement game.
Comments
Post a Comment