How to add background image in CocosSharp?

I have used this code to add background image in CCLayer but it's not working:

public class GameLayer : CCLayerColor
{
    private CCSprite background; 
    public GameLayer() : base(CCColor4B.Transparent)
    {       
        background = new CCSprite("cbg")
        {
            AnchorPoint = new CCPoint(0, 0),
            IsAntialiased = true,
            Position = new CCPoint(0, 0),

        };
        this.AddChild(background);
    }
}

My problem is image is displaying but not of screen size as background image, its just displaying at the bottom-left corner of the screen.

Best Answer

  • M_Shah04M_Shah04 US ✭✭✭
    Accepted Answer

    Solved after adding Contentsize in background that match with screen size.

Answers

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    Moved to CocosSharp category

  • M_Shah04M_Shah04 USMember ✭✭✭
    Accepted Answer

    Solved after adding Contentsize in background that match with screen size.

Sign In or Register to comment.