Repos

MELHARFI-2D-Game-Engine.

Got to repo.

14. Show, Hide

Maybe you have seen in every IGfx object's constructor there is a property visible, which make an object visible or not.

Ofcourse thi property could be changed later "object.Vsisible = false" but there other stuff for dealing with visibility of an object that we gonna see above.

To hide every asset in a specific layer :

                        
manager.HideBackgroundLayer(true);  // to hide all background assets
manager.HideObjectLayer(true);  // to hide all background assets
manager.HideControlLayer(true);  // to hide all Windows controls
manager.HideTopLayer(true);  // to hide all top assets

// or

manager.HideBackgroundLayer(false);  // to show all background assets
manager.HideObjectLayer(false);  // to show all background assets
manager.HideControlLayer(false);  // to show all Windows controls
manager.HideTopLayer(false);  // to show all top assets
                        
                      

  • Issue 1 with HideControlLayer
  • There is a specific scenario that will cause an unwanted behavior when we deal with hide object or specifically the controls.

    To illustrate this let's say that we have a game with a hidden object like a console 'ReachTextBox' that supossed to show some debug information but hidden by default for lamba user and only accessible by a shortcut.

    In some point you want to hide every object of your game, which flag them all as visible = false.

    Now imagine that after some behavior you want to show them back with HideControlLayer(true);.

    You will notice that event the console will be visible too and it's not what we want.

    So we want somehow to escape from HideControlLayer(true);b that's why i add another layer to store control object that we de not want them to be affected by HideControlLayer(true);.

    GfxControlLayerOnlyVisible is a layer not accessible directly by user and meant for this behavior only.

    So if you want to escape that issue you better use HideControlLayerOnlyVisible(true) instead of HideControlLayer(true); to hide your controls.

    Pay attention that this behavior is only with Controls object.

    Services

    App Developpement

    Want me to dev an app for you ? dont hesitate to contact me.

    Programming

    Are you looking for a coder/teammate for your project ? Let's give it a try.

    Job Invitation

    Have a proposal for me ? we can discuss about it.

    Donation maybe ?!

    You want to buy me a coffe ? m.elharfi@gmail.com