CocosSharp icon indicating copy to clipboard operation
CocosSharp copied to clipboard

[Android Forms] Can not set Background Color of CocosSharpView

Open kjpou1 opened this issue 10 years ago • 5 comments

Prompted from forum post forum post with example code

Some of the code I'm using: CocosSharpView : gameView = new CocosSharpView() { BackgroundColor = Color.Transparent, DesignResolution = new Size(1024, 768), HorizontalOptions = LayoutOptions.Center, // Set the method to call once the view has been initialised ViewCreated = LoadGame }; GameLayer:

public GameLayer(): base(CCColor4B.Transparent) { //.. }

kjpou1 avatar Nov 24 '15 15:11 kjpou1

Did you guys get success on this...

ghost avatar Apr 22 '17 05:04 ghost

Does it work for iOS project in Xamarin.Forms ?

wwitek avatar Jun 02 '17 17:06 wwitek

I'm having the same problem with running on Android.

I set the game view's background color to transparent, it's working on iOS but on Android it's showing black background.

ahmedelashkerpersonal avatar Jul 10 '17 08:07 ahmedelashkerpersonal

It seems to be not setting the color for an inside sublayer or an inside stage view in the game view.

I think so because when I apply rotateYTo(180) to the game view it only shows a black view without showing my custom drawing above it. Meaning that if the transparency issue is resolved it could show after rotation. (working on iOS already)

ahmedelashkerpersonal avatar Jul 10 '17 09:07 ahmedelashkerpersonal

After some debugging from inside the custom CCScene class made for drawing graphics on a layer.

gameView.DrawingCacheBackgroundColor is a black color and probably the cause for the problem

Please advice if there is a way to change it

ahmedelashkerpersonal avatar Jul 11 '17 07:07 ahmedelashkerpersonal