Is it possible to push a view while ignoring its background? I’ve tried the settings on the viewport to the best of my knowledge and ability but can’t figure it out.
Can or should I set Viewport.Transparent
in the view being pushed down or the one pushed up? Any suggestions would be helpful. Thank you.
-
The view (TCastleView, Managing Views | Manual | Castle Game Engine ) doesn’t have an idea about its own background.
-
The viewport ( Viewport with scenes, camera, navigation | Manual | Castle Game Engine ) has a Background but a viewport is not something you can push.
There are two ways to do something like a “common background underneath a few views”:
-
Use the stack of views, described on Managing Views | Manual | Castle Game Engine . This means you push 2 views, one “background view” and on top of it “foreground view”. And then you switch the “foreground view”, by doing
TCastleView.PopView
+TCastleView.PushView
. The foreground view can be transprent (many ways to achieve this; if you have a viewport, you can indeed setViewport.Transparent
= true) and it can be main menu, game, options etc. -
Or, you can define a design with background and just reuse it in multiple views.
Explore our examples, like examples/fps_game/
and examples/platformer
, that manage a number of views throughout the game.
I hope this is helpful, if not – we will need to see a test project that illustrates what you want to do. Your question confuses some terminology, a test project (full, compileable) will always make it clearer