Forum Libraries, Components, and Plugins

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

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 USMember ✭✭✭
    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.