Exemple #1
0
		public TextLayer() : base()
		{

            Camera = AppDelegate.SharedCamera;
            contentLayer = new CCLayer();
            CCCamera contentCamera = new CCCamera(Camera.OrthographicViewSizeWorldspace, Camera.CenterInWorldspace, Camera.TargetInWorldspace);
            contentLayer.Camera = contentCamera;

            var bg = new CCSprite(TestResource.s_back3);
            BaseNode = bg;
            contentLayer.AddChild(bg, 0, EffectTestScene.kTagBackground);

            var Kathia = new CCSprite(TestResource.s_pPathSister2);
            BaseNode.AddChild(Kathia, 1, EffectTestScene.kTagKathia);

            var sc = new CCScaleBy(2, 5);
            var sc_back = sc.Reverse();
            Kathia.RunAction(new CCRepeatForever(sc, sc_back));


            var Tamara = new CCSprite(TestResource.s_pPathSister1);
            BaseNode.AddChild(Tamara, 1, EffectTestScene.kTagTamara);

            var sc2 = new CCScaleBy(2, 5);
            var sc2_back = sc2.Reverse();
            Tamara.RunAction(new CCRepeatForever(sc2, sc2_back));

            var colorBackground = new CCLayerColor(new CCColor4B(32, 128, 32, 255));
            contentLayer.AddChild(colorBackground, -1);
		}
Exemple #2
0
 /// <summary>
 /// creates a CCLayer with color, width and height in Points
 /// </summary>
 public CCLayerColor(CCCamera camera, CCColor4B color) : base(camera)
 {
     DisplayedColor   = RealColor = new CCColor3B(color.R, color.G, color.B);
     DisplayedOpacity = RealOpacity = color.A;
     BlendFunc        = CCBlendFunc.NonPremultiplied;
     UpdateColor();
 }
Exemple #3
0
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            //application.SupportedOrientations = CCDisplayOrientation.LandscapeRight | CCDisplayOrientation.LandscapeLeft;
            //application.AllowUserResizing = true;
            //application.PreferMultiSampling = false;
            application.ContentRootDirectory = "Content";


            CCRect boundsRect = new CCRect(0.0f, 0.0f, 960, 640);

			sharedViewport = new CCViewport(new CCRect (0.0f, 0.0f, 1.0f, 1.0f));

            sharedWindow = mainWindow;
            sharedCamera = new CCCamera(boundsRect.Size, new CCPoint3(boundsRect.Center, 100.0f), new CCPoint3(boundsRect.Center, 0.0f));

            mainWindow.SetDesignResolutionSize(960, 640, CCSceneResolutionPolicy.ShowAll);

            #if WINDOWS || WINDOWSGL || WINDOWSDX 
			//application.PreferredBackBufferWidth = 1024;
			//application.PreferredBackBufferHeight = 768;
            #elif MACOS
            //application.PreferredBackBufferWidth = 960;
            //application.PreferredBackBufferHeight = 640;
            #endif

            #if WINDOWS_PHONE8
            application.HandleMediaStateAutomatically = false; // Bug in MonoGame - https://github.com/Cocos2DXNA/cocos2d-xna/issues/325
            #endif

            CCSpriteFontCache.FontScale = 0.6f;
            CCSpriteFontCache.RegisterFont("arial", 12, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 38, 50, 64);
            CCSpriteFontCache.RegisterFont("MarkerFelt", 16, 18, 22, 32);
            CCSpriteFontCache.RegisterFont("MarkerFelt-Thin", 12, 18);
            CCSpriteFontCache.RegisterFont("Paint Boy", 26);
            CCSpriteFontCache.RegisterFont("Schwarzwald Regular", 26);
            CCSpriteFontCache.RegisterFont("Scissor Cuts", 26);
            CCSpriteFontCache.RegisterFont("A Damn Mess", 26);
            CCSpriteFontCache.RegisterFont("Abberancy", 26);
            CCSpriteFontCache.RegisterFont("Abduction", 26);

            //sharedDirector = new CCDirector();
            //director.DisplayStats = true;
            //director.AnimationInterval = 1.0 / 60;


//            if (sharedWindow.WindowSizeInPixels.Height > 320)
//            {
//                application.ContentSearchPaths.Insert(0,"HD");
//            }

            //sharedWindow.AddSceneDirector(sharedDirector);

            CCScene scene = new CCScene(sharedWindow);
			scene.Camera = sharedCamera;

            CCLayer layer = new TestController();

            scene.AddChild(layer);
            sharedWindow.RunWithScene(scene);
        }
Exemple #4
0
 public CCLayer(CCCamera camera, CCClipMode clipMode) : base()
 {
     ChildClippingMode            = clipMode;
     IgnoreAnchorPointForPosition = true;
     AnchorPoint = CCPoint.AnchorMiddle;
     Camera      = camera;
 }
		public EffectAdvanceTextLayer()
		{
            Camera = AppDelegate.SharedCamera;
            contentLayer = new CCLayer();
            CCCamera contentCamera = new CCCamera(Camera.OrthographicViewSizeWorldspace, Camera.CenterInWorldspace, Camera.TargetInWorldspace);
            contentLayer.Camera = contentCamera;
		}
Exemple #6
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            if (Camera == null)
            {
                Camera = new CCCamera(initCameraProjection, this.Window.DesignResolutionSize);
            }
        }
Exemple #7
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            if (Camera == null)
            {
                Camera             = new CCCamera(initCameraProjection, GameView.DesignResolution);
                visibleBoundsDirty = true;
            }
        }
Exemple #8
0
        void OnCameraVisibleBoundsChanged(object sender, EventArgs e)
        {
            CCCamera camera = sender as CCCamera;

            if (camera != null && camera == Camera && Scene != null)
            {
                VisibleBoundsChanged();
                LayerVisibleBoundsChanged(this, null);
            }
        }
Exemple #9
0
        public static CCScene Scene(CCWindow window)
        {
            var scene = new CCScene(window);

            var camera = new CCCamera(
                             CCCameraProjection.Projection2D, window.DesignResolutionSize * CSF
                         );

            var layer = new TestLayer1();
            layer.Camera = camera;

            scene.AddChild(layer);

            return scene;
        }
        public GameScene(CCWindow window) : base(window) {
            Id = "";

            _backgroundLayer = new BackgroundLayer();
            AddChild(_backgroundLayer);

            var cameraVisibleBounds = new CCSize(Settings.ScreenWidth, Settings.ScreenHeight);
            var camera = new CCCamera(CCCameraProjection.Projection3D, cameraVisibleBounds,
                new CCPoint3(Settings.ScreenWidth, Settings.ScreenHeight, 10));

            GameLayer = new GameLayer {
                Tag = Tags.Client,
                Camera = camera,
            };
            AddChild(GameLayer);

            _chatLayer = new ChatLayer();
            AddChild(_chatLayer);

            _hudLayer = new HudLayer();
            AddChild(_hudLayer);


            var keyListener = new CCEventListenerKeyboard {OnKeyPressed = OnKeyPressed, OnKeyReleased = OnKeyReleased};
            AddEventListener(keyListener, this);

            var mouseListener = new CCEventListenerMouse {
                OnMouseDown = OnMouseDown,
                OnMouseUp = OnMouseUp,
                OnMouseMove = OnMouseScroll
            };
            AddEventListener(mouseListener, this);

            var parser = new FileIniDataParser();
            IniData data = parser.ReadFile("Config.ini");
            string nickname = data["Client"]["nickname"];
            _netGameClient = new NetGameClient(data["Server"]["ip"], this);
            _netGameClient.ConnectToServer(nickname);

            InitEvents();

            Schedule(Update);
            Schedule(UpdateNetwork, Settings.NetworkFreqUpdate);
        }
Exemple #11
0
 public CCLayerColor(CCCamera camera, CCColor4B?color = null)
     : base(camera)
 {
     SetupCCLayerColor(color);
 }
Exemple #12
0
 /// <summary>
 /// creates a CCLayer with color, width and height in Points
 /// </summary>
 public CCLayerColor (CCCamera camera, CCColor4B color) : base(camera)
 {
     DisplayedColor = RealColor = new CCColor3B(color.R, color.G, color.B);
     DisplayedOpacity = RealOpacity = color.A;
     BlendFunc = CCBlendFunc.NonPremultiplied;
     UpdateColor();
 }
Exemple #13
0
 public CCLayerColor(CCCamera camera) : this(camera, CCColor4B.Transparent)
 {
 }
Exemple #14
0
 public CCLayerColor(CCCamera camera) : this(camera, CCColor4B.Transparent)
 {
 }
Exemple #15
0
 public CCLayer(CCCamera camera, CCClipMode clipMode = CCClipMode.None) 
     : this(camera.Projection, clipMode)
 {
     Camera = camera;
 }
Exemple #16
0
 public CCLayerColor(CCCamera camera, CCColor4B color = default(CCColor4B))
     : base(camera)
 {
     SetupCCLayerColor(color);
 }
Exemple #17
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            if(Camera == null)
            {
                Camera = new CCCamera (initCameraProjection, Scene.DesignResolutionSize);
            }
        }
Exemple #18
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            if(Camera == null)
            {
                Camera = new CCCamera (this.Window.DesignResolutionSize);
            }

        }
Exemple #19
0
 public CCLayer(CCCamera camera, CCClipMode clipMode = CCClipMode.None)
     : this(camera.Projection, clipMode)
 {
     Camera = camera;
 }
Exemple #20
0
 public CCLayer(CCCamera camera) : this(camera, CCClipMode.None)
 {
 }
Exemple #21
0
        public CCLayer(CCCamera camera, CCClipMode clipMode) : base()
        {
            ChildClippingMode = clipMode;
            IgnoreAnchorPointForPosition = true;
			AnchorPoint = CCPoint.AnchorMiddle;
            Camera = camera;
        }
Exemple #22
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            if(Camera == null)
            {
                CCRect visibleBoundsScreenspace = Scene.VisibleBoundsScreenspace;
                Camera = new CCCamera(visibleBoundsScreenspace);
            }

        }
Exemple #23
0
 public CCLayerColor(CCCamera camera, CCColor4B? color = null) 
     : base(camera)
 {
     SetupCCLayerColor(color);
 }
Exemple #24
0
 public CCLayer(CCCamera camera) : this(camera, CCClipMode.None)
 {
 }