Пример #1
0
        /// <summary>
        /// Initialize of Scene.
        /// </summary>
        public override Scene Initialize()
        {
            //sceneはオブジェクトの追加や削除のためにも描画メソッドの外で作ったほうが良い

            scene.Camera.SetViewFromViewport();

            //文字の描画 960x544 //vita画面解像度 20x11.25(左上)
            description = WriteString.DrawSprite("Touch!をタッチ:戻る/Touch!以外をタッチ:文字を消す" +
                "/画面をドラッグ:Touch!が指を追いかける/Start:戻る",
                                        0.5f*Const.FIX,
                                        0.5f*Const.FIX,
                                        20,
                                        new ImageColor(255,255,255,255),
                                        scene);
            spriteForTouch.DrawSprite("Touch!",
                                        14*Const.FIX,
                                        10*Const.FIX,
                                        40,
                                        new ImageColor(255,255,255,255),
                                        scene,
                                      true);

            //effect(効果音)もbgmも一つにつき一回newする。

            return scene;
        }
Пример #2
0
        public TitleScene()
        {
            this.Camera.SetViewFromViewport();
            _texture = new Texture2D("Application/images/title.png",false);
            _ti = new TextureInfo(_texture);
            SpriteUV titleScreen = new SpriteUV(_ti);
            titleScreen.Scale = _ti.TextureSizef;
            titleScreen.Pivot = new Vector2(0.5f,0.5f);
            titleScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2,
                                              Director.Instance.GL.Context.GetViewport().Height/2);
            this.AddChild(titleScreen);

            Vector4 origColor = titleScreen.Color;
            titleScreen.Color = new Vector4(0,0,0,0);
            var tintAction = new TintTo(origColor,10.0f);
            ActionManager.Instance.AddAction(tintAction,titleScreen);
            tintAction.Run();

            _titleSong = new Bgm("/Application/audio/titlesong.mp3");

            if(_songPlayer != null)
            _songPlayer.Dispose();
            _songPlayer = _titleSong.CreatePlayer();

            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false);

            // Clear any queued clicks so we dont immediately exit if coming in from the menu
            Touch.GetData(0).Clear();
        }
        public TitleScene()
        {
            this.Camera.SetViewFromViewport();

            _texture = new Texture2D("/Application/assets/images/header.png",false);
            _ti = new TextureInfo(_texture);
            SpriteUV titleScreen = new SpriteUV(_ti);
            titleScreen.Scale = _ti.TextureSizef;
            titleScreen.Pivot = new Vector2(0.5f,0.5f);
            titleScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2,
                                              Director.Instance.GL.Context.GetViewport().Height/2);
            this.AddChild(titleScreen);

            Vector4 origColor = titleScreen.Color;
            titleScreen.Color = new Vector4(0,0,0,0);
            var tintAction = new TintTo(origColor,10.0f);
            ActionManager.Instance.AddAction(tintAction,titleScreen);
            tintAction.Run();

            // MUSIC
            Support.MusicSystem.Instance.Play("play.mp3");

            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false);

            // Clear any queued clicks so we dont immediately exit if coming in from the menu
            Touch.GetData(0).Clear();
        }
        public InstructionsScene()
        {
            this.Camera.SetViewFromViewport();

            _texture = new Texture2D("/Application/assets/images/allSame.png",false);
            // started working out game logic in a seperate project Card Match Login
            _ti = new TextureInfo(_texture);
            SpriteUV titleScreen = new SpriteUV(_ti);
            titleScreen.Scale = _ti.TextureSizef;
            titleScreen.Pivot = new Vector2(0.5f,0.5f);
            titleScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2,
                                              Director.Instance.GL.Context.GetViewport().Height/2);
            this.AddChild(titleScreen);

            Vector4 origColor = titleScreen.Color;
            titleScreen.Color = new Vector4(0,0,0,0);
            var tintAction = new TintTo(origColor,10.0f);
            ActionManager.Instance.AddAction(tintAction,titleScreen);
            tintAction.Run();

            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false);

            // Clear any queued clicks so we dont immediately exit if coming in from the menu
            Touch.GetData(0).Clear();
        }
Пример #5
0
        public TitleScene()
        {
            if(AppMain.am == null) {
                AppMain.am = new AudioManager();
            } else {
                AppMain.am.changeSong(false);
            }
            this.Camera.SetViewFromViewport();
            _texture = new Texture2D("/Application/images/title.png", false);
            _textureInfo = new TextureInfo(_texture);
            SpriteUV titleScreen = new SpriteUV(_textureInfo);
            titleScreen.Scale = _textureInfo.TextureSizef;
            titleScreen.Pivot = new Vector2(0.5f, 0.5f);
            ImageRect viewPort = Director.Instance.GL.Context.GetViewport();
            titleScreen.Position = new Vector2(viewPort.Width/2, viewPort.Height/2);
            this.AddChild(titleScreen);

            Vector4 origColour = titleScreen.Color;
            titleScreen.Color = new Vector4(0,0,0,0);
            var tintAction = new TintTo(origColour, 10.0f);
            ActionManager.Instance.AddAction(tintAction, titleScreen);
            tintAction.Run();

            Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);

            // Clear any queued clicks so we don't immediately exit if coming in from the menu
            Touch.GetData (0).Clear();
        }
Пример #6
0
        public override Scene Initialize()
        {
            scene.Camera.SetViewFromViewport();
            //GameLog.DebugLog.Log("start");

            BaseSprite background = new BaseSprite();
            background.setTexture("background.png");
            //background.Quad.S = new Vector2(128,128);

            player = new PlayerEntity();

            scoreLabel = WriteString.DrawSprite(scoreText + score, 720, 450, 50, new ImageColor(255,255,255,255)); //new TextLabel(scoreText + 0);

            //enemyArray[0] = new FireEnemyEntity();
            //enemyArray[1] = new WaterEnemyEntity();
            //enemyArray[2] = new GrandEnemyEntity();
            //enemyArray[3] = new WoodEnemyEntity();

            scene.AddChild(background);
            scene.AddChild(player);
            //Console.WriteLine(scoreLabel);
            scene.AddChild(scoreLabel);

            return scene;
        }
Пример #7
0
        public Bullet(Vector2 pos)
        {
            sprite = new SpriteUV();

            if (texInfo == null)
            {
                texInfo = new TextureInfo ("/Application/assets/bubble.png");
                //texInfo = new TextureInfo(AssetManager.GetTexture("bubble"), new Vector2i(4,1),TRS.Quad0_1);
            }

            if (spriteList == null)
            {
                spriteList = new SpriteList(texInfo);
                spriteList.Position = new Vector2(0.0f,0.0f);
            }

            spriteList.AddChild(sprite);
            sprite.Quad.S = texInfo.TextureSizef; // map 1:1 on screen -- necessary? !!!\
            sprite.RunAction(new ScaleTo(new Vector2(0.15f,0.15f),0.0f));

            sprite.GetContentWorldBounds(ref boundingBox);
            boundingBox = new Bounds2(pos, new Vector2(38,38));
            //sprite.CenterSprite();
            sprite.Position = pos;
            sprite.Schedule((dt) => Update());
        }
Пример #8
0
        public void Render( Texture2D texture, Scene scene)
        {
            TextureInfo ti1 = new TextureInfo();

            //if(flip)
                ti1.Texture = texture;
            //	else
            //		ti1.Texture = texture1;

               		SpriteUV sprite1 = new SpriteUV();
               		sprite1.TextureInfo = ti1;

               		if(type==0)
            sprite1.Quad.S = ti1.TextureSizef.Multiply(.3f);

            if(type==1)
            sprite1.Quad.S = ti1.TextureSizef.Multiply(.05f);

               		sprite1.CenterSprite();
               		sprite1.Position = position;// scene.Camera.CalcBounds().Center;

            sprite1.Rotate(-rotation);//*Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Pi/180);

               		scene.AddChild(sprite1);
        }
Пример #9
0
 /// <summary>
 /// Terminate of Scene.
 /// </summary>
 public override void Terminate()
 {
     this.scene.RemoveAllChildren(true);//必要 terminateの最初に
     testStr = null;
     scene = null;
     spriteString = null;
 }
Пример #10
0
 public void OpenTextureInFile(string name)
 {
     textureforOpening = new Texture2D(AssetsPrefix + name,false);
     tInfor = new TextureInfo(textureforOpening);
     sprite = new SpriteUV(tInfor);
     spriteList = new Sce.PlayStation.HighLevel.GameEngine2D.SpriteList(tInfor);
     spriteList.AddChild(sprite);
 }
Пример #11
0
 public SpriteUV GetSprite(string spriteName)
 {
     SpriteUV gameSprite = new SpriteUV(texAtlasInfo);
     gameSprite.UV = new TRS(sprites[spriteName]);
     gameSprite.Position = new Vector2(0, 0);
     gameSprite.Quad.S = new Vector2(sizes[spriteName].X, sizes[spriteName].Y);
     return gameSprite;
 }
Пример #12
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public Symbol(SpriteUV sprite, SymbolType type)
 {
     sprite.Scale = new Sce.PlayStation.Core.Vector2(1.0f);
     sprite.Quad.S = sprite.TextureInfo.TextureSizef;
     sprite.CenterSprite();
     Image = sprite;
     Type = type;
 }
Пример #13
0
 private SpriteUV generateSprite(float leftX)
 {
     var sprite = new SpriteUV (textureInfo);
     float spriteHeight = spriteWidth;
     float screenHeight = 544.0f;
     sprite.Quad = new TRS (new Bounds2 (new Vector2 (leftX, screenHeight / 2.0f - spriteHeight / 2.0f),
                                         new Vector2 (leftX + spriteWidth, screenHeight / 2.0f + spriteHeight / 2.0f)));
     return sprite;
 }
Пример #14
0
 private void generateFireleafSprite()
 {
     var texture = new Texture2D ("/Application/Assets/images/fireleaf_one.png", false);
     var textureInfo = new TextureInfo (texture);
     this.RegisterDisposeOnExit (textureInfo);
     var sprite = new SpriteUV (textureInfo);
     sprite.Quad.S = textureInfo.TextureSizef;
     AddChild (sprite);
 }
Пример #15
0
 /// <summary>
 /// スプライトを見えなくし、一定時間後元に戻すエフェクト
 /// </summary>
 /// <param name='sprite'>
 /// Sprite.
 /// </param>
 public static void Disappear(SpriteUV sprite)
 {
     Global.characterActive = false;
     var seq = new Sequence();
     seq.Add(new CallFunc(()=>Disappear1(sprite)));
     seq.Add(new CallFunc(()=>{sprite.Visible = false;}));
     seq.Add(new MoveBy(new Vector2(0,0),2));
     seq.Add(new CallFunc(()=>Appear(sprite)));
     sprite.RunAction(seq);
 }
Пример #16
0
        public MainScene()
        {
            this.ScheduleUpdate ();

            SceneCamera = (Camera2D)Camera;
            SceneCamera.SetViewFromHeightAndCenter (_screenSize.Y, _screenSize / 2.0f);
            //_background = new Layer (SceneCamera, 0.1f, 0.1f);
            //_main = new Layer (SceneCamera);
            _main = new Node ();
            /*
            _physics = new PhysicsScene();
            _physics.InitScene();
            */

            _playerCreature = new PlayerCreature ();
            _playerCreature.sprite.Position = Camera.CalcBounds ().Center;
            //		_player.PositionAll = SceneCamera.CalcBounds().Center;

            /*
            _block = new PhysicalSpriteUV(new TextureInfo("/Application/assets/floor.png"), _physics);
            _block.PositionAll = new Vector2(SceneCamera.CalcBounds().Center.X + 10, SceneCamera.CalcBounds().Center.Y - 100);
            _physics.sceneBodies[_block.BodyIndex].SetBodyStatic();

            _physics.restitutionCoeff = 0.9f;
            _physics.sceneMax = new Vector2(10000, 10000);
            _physics.sceneMin = new Vector2(-10000, -10000);
            */
            //AddChild (new SpriteUV(new TextureInfo("/Application/king_water_drop.png")));
            //_main.AddChild (_player);

            var background = new SpriteUV (new TextureInfo ("/Application/assets/background.png"));
            background.Quad.S = background.TextureInfo.TextureSizef;
            background.CenterSprite ();
            //_physics.Gravity = new Vector2(0.0f, -98f);
            background.Position = SceneCamera.CalcBounds ().Center;
            //_background.AddChild(background);
            //AddChild(_background);
            //AddChild(_block);
            AddChild (_main);
            _main.AddChild (background);
            _main.AddChild (_playerCreature.sprite);

            _enemies = new ArrayList ();

            // enemy sprite test code
            var fish0 = new FishEnemy (new Vector2 (30.0f, 30.0f), _playerCreature);
            var fish1 = new FishEnemy (new Vector2 (15.0f, 15.0f), _playerCreature);
            var fish2 = new FishEnemy (new Vector2 (100.0f, 70.0f), _playerCreature);

            _enemies.Add (fish0);
            _enemies.Add (fish1);
            _enemies.Add (fish2);

            //	_main.AddChild (FishEnemy.spriteList);
        }
Пример #17
0
 private void setSprite()
 {
     Texture2D texture = new Texture2D(spritePath,false);
     TextureInfo textureInfo = new TextureInfo(texture);
     float pivotCenter = 0.5f;
     this.sprite = new SpriteUV(textureInfo);
     this.sprite.Scale = textureInfo.TextureSizef/2;
     this.sprite.Pivot = new Vector2(pivotCenter,pivotCenter);
     this.sprite.Position = new Vector2(this.x, this.y);
     this.AddChild(this.sprite);
 }
		public static void Main (string[] args)
		{
			Director.Initialize();
			Director.Instance.GL.Context.SetClearColor( Colors.Grey20 );
			//Director.Instance.DebugFlags |= DebugFlags.Navigate; 
			
			Vector2 position = new Vector2(300,300);
			Vector2i sprIndex1 = new Vector2i(0,0);
			int step = 0;
			
			var scene = new Scene();
			
			var texture_info = new TextureInfo( new Texture2D("/Application/Dude1.png", false ),
			                                   new Vector2i(2,1));
			
			var sprite = new SpriteTile(texture_info, sprIndex1);
			scene.Camera.SetViewFromViewport();
			sprite.Quad.S = texture_info.TextureSizef; 
			scene.AddChild( sprite );
			
			var sprite2 = new SpriteUV() { TextureInfo = texture_info};
			sprite2.Quad.S = texture_info.TextureSizef; 
			scene.AddChild( sprite2 );
			//sprite2.Position = scene.Camera.CalcBounds().Center;
			sprite2.Position = position;
			
			Director.Instance.RunWithScene( scene );
			Initialize ();
			
			sprite.TileIndex2D = new Vector2i(1,0);
			
			while (true) {
				GamePadData presses = GamePad.GetData(0);
				//step++;
				//if (step == 20)
				if ((presses.Buttons & GamePadButtons.Down) != 0){
					sprite.TileIndex2D.X = 0;
					position.X++;
				}
					//sprIndex1.X = 0;
				//if (step > 40){
				//	step = 0;
				else
					sprite.TileIndex2D.X = 1;
					//sprIndex1.X = 1;
				//}
				
				//sprite.TileIndex2D = sprIndex1;
				
				SystemEvents.CheckEvents ();
				Update ();
				Render ();
			}
		}
Пример #19
0
        public StaticBackground()
        {
            var texture = new Texture2D ("/Application/Assets/background/background.jpg", false);
            var textureInfo = new TextureInfo (texture);
            this.RegisterDisposeOnExit (textureInfo);
            var sprite = new SpriteUV (textureInfo);
            sprite.Quad.S = textureInfo.TextureSizef;

            AddChild (sprite);

            Camera = new Camera2D (Director.Instance.GL, Director.Instance.DrawHelpers);
            Camera.SetViewFromViewport ();
        }
Пример #20
0
		/// <summary>
		/// スコアを更新する
		/// </summary>
		/// <param name='inc'>
		/// 指定された分だけ増加させる
		/// </param>
		public static void UpdateScore(int inc){
			Scenes.sceneOnGame.RemoveChild(scoreSprite,true);
			
			Global.score += inc;
			var texture = Convert.CreateTextureFromText("SCORE  "+Global.score,new Font(FontAlias.System, 20, FontStyle.Bold),0xffffffff);
			var textureInfo = new TextureInfo(texture);
			scoreSprite = new SpriteUV(){TextureInfo = textureInfo};
			scoreSprite.Quad.S = textureInfo.TextureSizef;
			scoreSprite.CenterSprite();
			scoreSprite.Position = new Vector2(700,520);
			
			Scenes.sceneOnGame.AddChild(scoreSprite);
			
		}
Пример #21
0
 private void setUpBackground()
 {
     this.mainGameSceneBackgroundImageTexture = new Texture2D(backgroundImagePath,false);
     this.mainGameSceneBackgroundImageTextureInfo = new TextureInfo(this.mainGameSceneBackgroundImageTexture);
     float pivotCenter = 0.5f;
     for(int i = 0; i < 500; i++)
     {
         this.mainGameSceneBackgroundSprite = new SpriteUV(this.mainGameSceneBackgroundImageTextureInfo);
         this.mainGameSceneBackgroundSprite.Scale = this.mainGameSceneBackgroundImageTextureInfo.TextureSizef/2;
         this.mainGameSceneBackgroundSprite.Pivot = new Vector2(pivotCenter,pivotCenter);
         this.mainGameSceneBackgroundSprite.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2 + (i*this.mainGameSceneBackgroundImageTextureInfo.TextureSizef.X/2),
                                                   			      Director.Instance.GL.Context.GetViewport().Height/2);
         this.AddChild(mainGameSceneBackgroundSprite);
     }
 }
Пример #22
0
        public GameOverScene()
        {
            var texture = new Texture2D ("/Application/Assets/images/dead_scene.png", false);
            var textureInfo = new TextureInfo (texture);
            RegisterDisposeOnExit (textureInfo);
            var sprite = new SpriteUV (textureInfo);
            sprite.Quad.S = textureInfo.TextureSizef;

            AddChild (sprite);

            Camera = new Camera2D (Director.Instance.GL, Director.Instance.DrawHelpers);
            Camera.SetViewFromViewport ();

            ScheduleUpdate(2);
        }
Пример #23
0
        private void generateFirewallSprite()
        {
            var texture = new Texture2D ("/Application/Assets/images/fireWall.png", false);
            var textureInfo = new TextureInfo (texture);
            this.RegisterDisposeOnExit (textureInfo);

            firewallSprite = new SpriteUV (textureInfo);
            float spriteWidth = 500.0f;
            float screenHeight = 544.0f;
            float spriteHeight = screenHeight;
            firewallSprite.Quad = new TRS (new Bounds2 (new Vector2 (-352.0f, 0.0f),
                                                new Vector2 (fireFrontLine + spriteWidth - 352.0f, spriteHeight)));
            firewallSprite.BlendMode = BlendMode.Additive;
            AddChild (firewallSprite);
        }
Пример #24
0
        public static void Main(string[] args)
        {
            Director.Initialize();

            //Initialize ();

            Scene scene = new Scene();
            scene.Camera.SetViewFromViewport();

            var width = Director.Instance.GL.Context.GetViewport().Width;
            var height = Director.Instance.GL.Context.GetViewport().Height;

            /* Color Matrix Values
             * Unfortunately C# doesn't allow the regular #define usage,
             * See: The #define directive cannot be used to declare constant values
             * as is typically done in C and C++. Constants in C# are best defined as static members of a
             * class or struct. If you have several such constants, consider creating a separate "Constants"
             * class to hold them.
             *
             */
            const int RED = 255;
            const int BLUE = 0;
            const int GREEN = 0;
            const int ALPHA = 0;

            Image img = new Image(ImageMode.Rgba, new ImageSize(width, height), new ImageColor(RED,GREEN,BLUE,ALPHA));

            img.DrawText("Hello World", new ImageColor(RED,GREEN,BLUE,ALPHA+255),
            new Font(FontAlias.System,170,FontStyle.Regular), new ImagePosition(0,150));

            Texture2D texture = new Texture2D(width,height,false,PixelFormat.Rgba);
            texture.SetPixels(0,img.ToBuffer());
            img.Dispose();

            TextureInfo ti = new TextureInfo();
            ti.Texture = texture;

            SpriteUV sprite = new SpriteUV();
            sprite.TextureInfo = ti;

            sprite.Quad.S = ti.TextureSizef;
            sprite.CenterSprite();
            sprite.Position = scene.Camera.CalcBounds().Center;

            scene.AddChild(sprite);

            Director.Instance.RunWithScene(scene);
        }
Пример #25
0
        public ClearScene()
        {
            var texture = new Texture2D("Application/Assets/images/end_image.png", false);
            var textureInfo = new TextureInfo(texture);
            this.RegisterDisposeOnExit (textureInfo);

            var sprite = new SpriteUV(){ TextureInfo = textureInfo};

            sprite.Quad.S = new Vector2(30,18);

            sprite.CenterSprite(new Vector2(0.5f,0.5f));

            AddChild(sprite);

            ScheduleUpdate(2);
        }
Пример #26
0
        /// <summary>
        /// Initialize of Scene.
        /// </summary>
        public override Scene Initialize()
        {
            scene.Camera.SetViewFromViewport();

            //画像の描画 960x544 //vita画面解像度 20x11.25(左上)
            description = WriteString.DrawSprite("十字キー:移動/○・□:拡大縮小/△:サイズのリセット/" +
                "x:画面から消す/Start:戻る",
                                        0.5f*Const.FIX,
                                        0.5f*Const.FIX,
                                        20,
                                        new ImageColor(255,255,255,255),
                                        scene);
            spritePicture = DrawPicture.DrawSprite("Player.png", 10f*Const.FIX, 5f*Const.FIX,scene);

            return scene;
        }
Пример #27
0
        public TitleScene()
        {
            var texture = new Texture2D("Application/Assets/images/title_image.png", false);
            var textureInfo = new TextureInfo(texture);
            this.RegisterDisposeOnExit (textureInfo);
            var sprite = new SpriteUV(){ TextureInfo = textureInfo};
            sprite.Quad.S = textureInfo.TextureSizef;

            Camera = new Camera2D (Director.Instance.GL, Director.Instance.DrawHelpers);
            Camera.SetViewFromViewport ();

            AddChild(sprite);
            ScheduleUpdate(2);

            // for test; fireWall and fireleaf_one become noise. other images are not.
            //generateFireleafSprite();
        }
Пример #28
0
        public GameOverScene(bool win)
        {
            this.Camera.SetViewFromViewport();
            if(win) {
                _texture = new Texture2D("/Application/images/winner.png", false);
            } else {
                _texture = new Texture2D("/Application/images/loser.png", false);
            }
            _textureInfo = new TextureInfo(_texture);
            SpriteUV titleScreen = new SpriteUV(_textureInfo);
            titleScreen.Scale = _textureInfo.TextureSizef;
            titleScreen.Pivot = new Vector2(0.5f, 0.5f);
            titleScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width / 2,
                                               Director.Instance.GL.Context.GetViewport().Height / 2);
            this.AddChild(titleScreen);

            Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);
        }
        /// <summary>
        /// Initialize of Scene.
        /// </summary>
        public override Scene Initialize()
        {
            scene.Camera.SetViewFromViewport();

            description = WriteString.DrawSprite("左右キー:移動/" +
                "x:画面から消す/Start:戻る",
                                        0.5f*Const.FIX,
                                        0.5f*Const.FIX,
                                        20,
                                        new ImageColor(255,255,255,255),
                                        scene);

            //SpriteSheet画像描画クラス
            this.drawPlayerSheet = new DrawPlayerSheetSample(10*Const.FIX,9*Const.FIX,
                                                             1,1,
                                                             "walk.png","walk.xml",this.scene);
            this.spritePlayerSheet = this.drawPlayerSheet.DrawPlayer("init");

            return scene;
        }
Пример #30
0
        public GameScene()
        {
            this.Camera.SetViewFromViewport ();

            // output FPS benchmark to console
            // Scheduler.Instance.ScheduleUpdateForTarget (new FPSBenchmarkNode(), 2, false);

            Input = new InputController ();
            var fireNode = new FireNode ();
            cameraManager = new CameraManager (this.Camera2D);
            playerNode = new PlayerNode () {cameraManager = cameraManager, Input = Input, fireNode = fireNode};
            contactNode = new ContactNode () { cameraManager = cameraManager, playerNode = playerNode };

            AddChild (new StaticBackground ());
            AddChild (new BackgroundNode ());
            AddChild (playerNode);
            AddChild (fireNode);
            AddChild (contactNode);
            AddChild (Input);

            // blockers
            {
                SpriteUV [] spriteBlock = new SpriteUV[10];
                Texture2D texture;
                TextureInfo textureInfo;
                texture = new Texture2D ("/Application/Assets/images/fireleaf_one.png", false);
                textureInfo = new TextureInfo (texture);
                this.RegisterDisposeOnExit (textureInfo);

                for(int i = 0; i < 5; i++){
                    spriteBlock[i] = new SpriteUV(textureInfo);
                    spriteBlock[i].Quad.S = textureInfo.TextureSizef;
                    spriteBlock[i].CenterSprite(new Vector2(0.65f, 0.5f));
                    spriteBlock[i].Position = new Vector2(contactNode.blockPosition[i].X, contactNode.blockPosition[i].Y);;
                    AddChild (spriteBlock[i]);

                }
            }

            ScheduleUpdate ();
        }
Пример #31
0
        public static Sce.PlayStation.HighLevel.GameEngine2D.SpriteUV SpriteUVFromFile(string filename)
        {
            if (TextureCache.ContainsKey(filename) == false)
            {
                TextureCache[filename]     = new Texture2D(filename, false);
                TextureInfoCache[filename] = new TextureInfo(TextureCache[filename]);
            }

            var tex    = TextureCache[filename];
            var info   = TextureInfoCache[filename];
            var result = new Sce.PlayStation.HighLevel.GameEngine2D.SpriteUV()
            {
                TextureInfo = info
            };

            result.Quad.S = new Vector2(info.Texture.Width, info.Texture.Height);

            tex.SetFilter(DefaultTextureFilterMode);

            return(result);
        }