private void CheckInput()
        {
            var touches = Touch.GetData(0);

            //If tapped, do something
            if (touches.Count > 0)
            {
                _rotateLeft = true;
            }
        }
Beispiel #2
0
        public override void Update(float dt)
        {
            base.Update(dt);
            var touches = Touch.GetData(0).ToArray();

            if ((touches.Length > 0 && touches[0].Status == TouchStatus.Down) || Input2.GamePad0.Cross.Press)
            {
                Director.Instance.ReplaceScene(new MenuScene());
            }
        }
Beispiel #3
0
        public override void Update(float dT)
        {
            var touches = Touch.GetData(0);

            if (touches.Count > 0 && touches[0].Status == TouchStatus.Down)
            {
                SceneManager.Instance.setStartScene();
            }
            Director.Instance.Update();
        }
        public static void Update()
        {
            // Query gamepad for current state
            var gamePadData = GamePad.GetData(0);

            // Query touch for current state
            List <TouchData> touchDataList = Touch.GetData(0);

            // Update UI Toolkit
            UISystem.Update(touchDataList);
        }
Beispiel #5
0
        public static void Update()
        {
            // update log
            label.Text = log;

            // Query touch for current state
            List <TouchData> touchDataList = Touch.GetData(0);

            // Update UI Toolkit
            UISystem.Update(touchDataList);
        }
Beispiel #6
0
        public static bool Update()
        {
            List <TouchData> touchDataList = Touch.GetData(0);

            foreach (var soundButton in soundButtonList)
            {
                soundButton.Update(touchDataList);
            }

            return(true);
        }
Beispiel #7
0
        public static bool Update()
        {
            uint enableColor  = 0xffffffff;
            uint disableColor = 0xff7f7f7f;

            playButton.ButtonColor   = disableColor;
            stopButton.ButtonColor   = disableColor;
            pauseButton.ButtonColor  = disableColor;
            resumeButton.ButtonColor = disableColor;

            if (bgmPlayer.Status == BgmStatus.Stopped)
            {
                playButton.ButtonColor = enableColor;
            }
            else if (bgmPlayer.Status == BgmStatus.Playing)
            {
                stopButton.ButtonColor  = enableColor;
                pauseButton.ButtonColor = enableColor;
            }
            else if (bgmPlayer.Status == BgmStatus.Paused)
            {
                stopButton.ButtonColor   = enableColor;
                resumeButton.ButtonColor = enableColor;
            }

            List <TouchData> touchDataList = Touch.GetData(0);

            if (playButton.ButtonColor == enableColor &&
                playButton.TouchDown(touchDataList))
            {
                bgmPlayer.Play();
            }
            if (stopButton.ButtonColor == enableColor &&
                stopButton.TouchDown(touchDataList))
            {
                bgmPlayer.Stop();
            }
            if (pauseButton.ButtonColor == enableColor &&
                pauseButton.TouchDown(touchDataList))
            {
                bgmPlayer.Pause();
            }
            if (resumeButton.ButtonColor == enableColor &&
                resumeButton.TouchDown(touchDataList))
            {
                bgmPlayer.Resume();
            }

            volumeSlider.Update(touchDataList);
            bgmPlayer.Volume = volumeSlider.Rate;

            return(true);
        }
Beispiel #8
0
        public static void Update()
        {
            //Determine whether the player tapped the screen
            var touches = Touch.GetData(0);

            //If tapped, do something
            if (touches.Count > 0)
            {
            }

            // Move update code here
        }
        public override void Update(float dT)
        {
            var touches = Touch.GetData(0);

            timer += dT;
            if (touches.Count > 0 && touches[0].Status == TouchStatus.Down || timer >= 5.0f)
            {
                hahaSoundPlayer.Dispose();
                SceneManager.Instance.setStartScene();
            }
            Director.Instance.Update();
        }
Beispiel #10
0
        public static bool Update()
        {
            List <TouchData> touchDataList = Touch.GetData(0);

            if (browserButton.TouchDown(touchDataList))
            {
                Shell.Action action = Shell.Action.BrowserAction("http://www.playstation.com/pss/developer/");
                Shell.Execute(ref action);
                return(true);
            }

            return(true);
        }
Beispiel #11
0
        public OS(bool hasPASS)
        {
            /* Graphics Disable due to Xperia Z errors*/
            //intro Loading = new intro();
            graphics = new GraphicsContext(960, 544, PixelFormat.Rgba, PixelFormat.Depth16, MultiSampleMode.None);
            UISystem.Initialize(graphics);

            Terminal scene = new Terminal();

            SetupListNum(scene.RootWidget);
            scene.SetWidgetLayout(LayoutOrientation.Horizontal);
            UISystem.SetScene(scene);
            if (!hasPASS)
            {
                scene.fresh();
            }
            for (; ;)
            {
                SystemEvents.CheckEvents();

                // update
                {
                    List <TouchData> touchDataList = Touch.GetData(0);
                    var gamePad = GamePad.GetData(0);
                    UISystem.Update(touchDataList, ref gamePad);
                }

                // draw
                {
                    graphics.SetViewport(0, 0, graphics.Screen.Width, graphics.Screen.Height);
                    graphics.SetClearColor(
                        0xFF,
                        0xFF,
                        0xFF,
                        0xff);
                    graphics.Clear();

                    UISystem.Render();
                    graphics.SwapBuffers();
                    if (scene.isHacking)
                    {
                        scene.fakePACKETS();
                    }
                    if (scene.isFlow)
                    {
                        scene.addCash();
                    }
                }
            }
        }
Beispiel #12
0
        /// Camera control
        static void ctrlCamera()
        {
            foreach (var touchData in Touch.GetData(0))
            {
                if (idTouch == -1)
                {
                    if (touchData.Status == TouchStatus.Down)
                    {
                        idTouch = touchData.ID;
                        float pointX = (touchData.X + 0.5f) * DspWidth;
                        float pointY = (touchData.Y + 0.5f) * DspHeight;

                        ptPrev.X = pointX;
                        ptPrev.Y = pointY;
                        isMove   = false;
                    }
                }
                else if (idTouch == touchData.ID)
                {
                    if (touchData.Status == TouchStatus.Up)
                    {
                        idTouch = -1;
                        if (isMove == false)
                        {
                            callNextScene(1);
                        }
                    }
                    else if (touchData.Status == TouchStatus.Move)
                    {
                        float   pointX = (touchData.X + 0.5f) * DspWidth;
                        float   pointY = (touchData.Y + 0.5f) * DspHeight;
                        Vector2 ptNow  = new Vector2(pointX, pointY);

                        float dx = (ptPrev.X - ptNow.X) / (float)DspWidth;
                        float dy = (ptPrev.Y - ptNow.Y) / (float)DspHeight;

                        // input on X axis become the amount of rotation around Y axis
                        if (FMath.Abs(dx) >= (1.0 / (float)DspWidth) || FMath.Abs(dy) >= (1.0 / (float)DspHeight))
                        {
                            isMove = true;
                            camera.OnRotate(((float)FMath.PI * 2.0f) * dy, ((float)FMath.PI * 2.0f) * dx);
                            ptPrev = ptNow;
                        }
                    }
                }
            }
        }
        private void CheckTouchData()
        {
            Vector2 touch = AppMain.GetTouchPosition();

            // Check if Touching Screen
            if (Touch.GetData(0).ToArray().Length <= 0)
            {
                touching = false;
            }
            // Check if touching bridge/plank
            else if ((touch.X > plankSprite.Position.X - 50) &&
                     (touch.X < plankSprite.Position.X + 50 + plankBounds.Point11.X) &&
                     (touch.Y > plankSprite.Position.Y))
            {
                touching = true;
            }
        }
Beispiel #14
0
        public static bool Update()
        {
            List <TouchData> touchDataList = Touch.GetData(0);

            switch (connectState)
            {
            case ConnectState.None:
                if (connectButton.TouchDown(touchDataList))
                {
                    connectState = ConnectState.Ready;
                    if (httpText != null)
                    {
                        httpText.Dispose();
                    }
                    connectButton.ButtonColor = 0xff7f7f7f;
                }
                break;

            case ConnectState.Ready:
                connectHttpTest("http://www.scei.co.jp/index_e.html");
                break;

            case ConnectState.Success:
                connectButton.ButtonColor = 0xffffffff;

                if (readStream != null)
                {
                    httpText = createTextSprite(readStream.ToArray(), statusCode, contentLength);

                    readStream.Dispose();
                    readStream = null;
                    readBuffer = null;
                }

                connectState = ConnectState.None;
                break;

            case ConnectState.Failed:
                httpText     = createTextSprite(null, statusCode, contentLength);
                connectState = ConnectState.None;
                break;
            }

            return(true);
        }
Beispiel #15
0
        public static void Update()
        {
            //Determine whether the player tapped the screen.
            var touches = Touch.GetData(0);

            //If tapped, inform the bird.
            if (touches.Count > 0)
            {
                bird.Tapped();
            }

            // timer that decreases air supply of bird by one every 2 seconds.
            if (airLoss.Seconds() > 2)
            {
                air--;
                airLabel.Text = "Air: " + air.ToString();
                airLoss.Reset();
            }

            //Update the bird.
            bird.Update(0.0f);

            //Update the bubble.
            foreach (Bubble b in bubble)
            {
                b.Update(0.0f);
            }

            if (bird.Alive)
            {
                //Move the background.
                background.Update(0.0f);

                //Update chains and mines.
                for (int i = 0; i < OBSTACLE_COUNT; i++)
                {
                    chain[i].Update(0.0f);
                    seamine[i].SetPosition((chain[i].GetX - 60), (chain[i].GetY + chain[i].GetMaxY) - 20);
                    seamine[i].Update(0.0f);
                }
            }

            Collision();
        }
        public override void Update(float dT)
        {
            var touches = Touch.GetData(0);

            if (touches.Count > 0 && touches[0].Status == TouchStatus.Down)
            {
                float x = (touches[0].X + 0.5f) * screenWidth;
                float y = screenHeight - ((touches[0].Y + 0.5f) * screenHeight);
                if (pressBtn(btn1, x, y))
                {
                    SceneManager.Instance.setInGameScene();
                }
                if (pressBtn(btn2, x, y))
                {
                    SceneManager.Instance.setHighscoreScene();
                }
            }
            Director.Instance.Update();
        }
Beispiel #17
0
        override public void Update(float speed)
        {
            AnimateGeiser();

            if (spikeBroken == true)
            {
                geiserSpriteSheet.Position = new Vector2(geiserSpriteSheet.Position.X - speed, geiserSpriteSheet.Position.Y);
                spikeSprite.Position       = new Vector2(spikeSprite.Position.X - speed, spikeSprite.Position.Y);
                geiserSprite.Position      = geiserSpriteSheet.Position;

                //Check to see whether spike has reached the ground
                if (spikeSprite.Position.Y > geiserSpriteSheet.Position.Y)
                {
                    spikeSprite.Position = new Vector2(spikeSprite.Position.X, spikeSprite.Position.Y - (speed * 3));
                }
                if (spikeSprite.Position.Y < geiserSpriteSheet.Position.Y + 100)
                {
                    //Remove geiser from players path
                    geiserSpriteSheet.Visible = false;
                    geiserOn = false;
                }
            }
            else
            {
                geiserSpriteSheet.Position = new Vector2(geiserSpriteSheet.Position.X - speed, geiserSpriteSheet.Position.Y);
                spikeSprite.Position       = new Vector2(spikeSprite.Position.X - speed, spikeSprite.Position.Y);
                geiserSprite.Position      = geiserSpriteSheet.Position;
            }

            Vector2 touchPos = AppMain.GetTouchPosition();

            if (Touch.GetData(0).ToArray().Length > 0 &&
                touchPos.Y <= spikeSprite.Position.Y + 114.0f && touchPos.Y >= spikeSprite.Position.Y - 50.0f &&
                touchPos.X <= spikeSprite.Position.X + 114.0f && touchPos.X >= spikeSprite.Position.X - 50.0f)
            {
                BreakSpike();
            }

            if (geiserOn && AppMain.GetPlayer().GetPos().X > geiserSprite.Position.X)
            {
                AppMain.GetPlayer().KillByFire();
            }
        }
Beispiel #18
0
        public static bool Update()
        {
            List <TouchData> touchDataList = Touch.GetData(0);

            if (pasteButton.TouchDown(touchDataList))
            {
                copyTextButton.Label = Clipboard.GetText();
            }

            if (copyButton.TouchDown(touchDataList))
            {
                Clipboard.SetText(inputTextButton.Label);
            }


            if (inputTextButton.TouchDown(touchDataList))
            {
                if (dialog == null)
                {
                    dialog      = new TextInputDialog();
                    dialog.Text = inputTextButton.Label;
                    dialog.Open();
                }
                return(true);
            }

            if (dialog != null)
            {
                if (dialog.State == CommonDialogState.Finished)
                {
                    if (dialog.Result == CommonDialogResult.OK)
                    {
                        inputTextButton.Label = dialog.Text;
                    }
                    dialog.Dispose();
                    dialog = null;
                }
            }

            return(true);
        }
        private void UpdateTouches()
        {
            var pssTouches = Touch.GetData(0);

            foreach (var touch in pssTouches)
            {
                Vector2 position = new Vector2((touch.X + 0.5f) * _frameBufferWidth, (touch.Y + 0.5f) * _frameBufferHeight);
                if (touch.Status == TouchStatus.Down)
                {
                    TouchPanel.AddEvent(touch.ID, TouchLocationState.Pressed, position);
                }
                else if (touch.Status == TouchStatus.Move)
                {
                    TouchPanel.AddEvent(touch.ID, TouchLocationState.Moved, position);
                }
                else
                {
                    TouchPanel.AddEvent(touch.ID, TouchLocationState.Released, position);
                }
            }
        }
Beispiel #20
0
        public void Update()
        {
            touch_data = Touch.GetData(0);

            // Not strictly neccessary
            Input2.Touch.SetData(0, touch_data);

            Director.Instance.Update();
            UISystem.Update(touch_data);



            if (StartBattle)
            {
                SceneManager.PushUIScene((int)UI.BATTLE, battlePhase);
                StartBattle = false;
            }
            if (ResumeChat)
            {
            }
        }
Beispiel #21
0
        override public void Update(float speed)
        {
            float xPos = AppMain.GetPlayer().GetPos().X;

            Vector2 touchPos = AppMain.GetTouchPosition();

            lineSprite.Position   = new Vector2(lineSprite.Position.X - speed, lineSprite.Position.Y);
            meteorSprite.Position = new Vector2(meteorSprite.Position.X - speed, meteorSprite.Position.Y);

            if (active == true)
            {
                AnimateMeteor();

                if (Touch.GetData(0).ToArray().Length > 0 &&
                    touchPos.Y <= meteorSprite.Position.Y + 333.0f &&
                    touchPos.Y >= meteorSprite.Position.Y - 47.0f &&
                    touchPos.X <= meteorSprite.Position.X + 114.0f &&
                    touchPos.X >= meteorSprite.Position.X - 47.0f)
                {
                    BreakMeteor();
                }

                if (meteorSprite.Position.X < xPos + 700)
                {
                    meteorSprite.Position = new Vector2(meteorSprite.Position.X, meteorSprite.Position.Y - speed * 1.667f);
                    //meteorSprite.Position.X -= 1;


                    //Check to see whether meteor has reached the ground
                    if (meteorSprite.Position.Y <= 100)
                    {
                        meteorBroken = true;
                        if (widthCount == noOnSpritesheetWidth)
                        {
                            AppMain.GetPlayer().KillByFire();
                        }
                    }
                }
            }
        }
Beispiel #22
0
        public void CheckInput()
        {
            var touches = Touch.GetData(0);

            var touchPos = Input2.Touch00.Pos;

            Bounds2 touchBox = new Bounds2();

            touchBox.Min.X = (touchPos.X * (Director.Instance.GL.Context.GetViewport().Width / 2))
                             + (Director.Instance.GL.Context.GetViewport().Width / 2);
            touchBox.Max.X = (touchPos.X * (Director.Instance.GL.Context.GetViewport().Width / 2))
                             + (Director.Instance.GL.Context.GetViewport().Width / 2);
            touchBox.Min.Y = (touchPos.Y * (Director.Instance.GL.Context.GetViewport().Height / 2))
                             + (Director.Instance.GL.Context.GetViewport().Height / 2);
            touchBox.Max.Y = (touchPos.Y * (Director.Instance.GL.Context.GetViewport().Height / 2))
                             + (Director.Instance.GL.Context.GetViewport().Height / 2);

            if (touchBox.Overlaps(muteBox) && touches.Count != 0)
            {
                Hide();
            }
        }
        public void CheckInput()
        {
            var touches = Touch.GetData(0);

            var touchPos = Input2.Touch00.Pos;

//			Bounds2 touchBox = new Bounds2();
//
//			touchBox.Min.X = (touchPos.X * (Director.Instance.GL.Context.GetViewport().Width / 2))
//				+ (Director.Instance.GL.Context.GetViewport().Width / 2) - 5000.0f;
//			touchBox.Max.X = (touchPos.X * (Director.Instance.GL.Context.GetViewport().Width / 2))
//				+ (Director.Instance.GL.Context.GetViewport().Width / 2)- 5000.0f;
//			touchBox.Min.Y = (touchPos.Y * (Director.Instance.GL.Context.GetViewport().Height / 2))
//				+ (Director.Instance.GL.Context.GetViewport().Height / 2)- 5000.0f;
//			touchBox.Max.Y = (touchPos.Y * (Director.Instance.GL.Context.GetViewport().Height / 2))
//				+ (Director.Instance.GL.Context.GetViewport().Height / 2)- 5000.0f;
//
//			if(touchBox.Overlaps(startBox) && touches.Count != 0)
//			{
//				play = true;
//			}
        }
Beispiel #24
0
        static bool Update()
        {
            int nextModeIndex = modeIndex;

            List <TouchData> touchDataList = Touch.GetData(0);

            foreach (var touchData in touchDataList)
            {
                if (touchData.Status == TouchStatus.Down)
                {
                    nextModeIndex = (modeIndex + 1) % modeInfo.Length;
                }
            }

            var gamePadData = GamePad.GetData(0);

            if ((gamePadData.ButtonsDown & GamePadButtons.Right) != 0)
            {
                nextModeIndex = (modeIndex + 1) % modeInfo.Length;
            }
            else if ((gamePadData.ButtonsDown & GamePadButtons.Left) != 0)
            {
                nextModeIndex = (modeIndex - 1) % modeInfo.Length;
                if (nextModeIndex < 0)
                {
                    nextModeIndex = modeInfo.Length - 1;
                }
            }

            if (modeIndex != nextModeIndex)
            {
                modeIndex = nextModeIndex;

                vertices.Dispose();
                vertices = createVertices(modeInfo[modeIndex].drawMode);
            }
            return(true);
        }
Beispiel #25
0
        public GameScene()
        {
            Scheduler.Instance.ScheduleUpdateForTarget(this, 1, false);                 // Tells the director that this "node" requires to be updated
            var         touches = Touch.GetData(0);
            GamePadData data    = GamePad.GetData(0);

            scenePaused = false;
            swapScene   = false;;

            backgroundLoader = new BackgroundLoader("Background2");
            this.AddChild(backgroundLoader.Sprite);

            enemy    = new Entity[8];
            enemy[0] = new Enemy(new Vector2(100f, 0f), "WeakEnemy4");
            this.AddChild(enemy[0].Sprite);
            enemy[1] = new Enemy(new Vector2(300f, 0f), "WeakEnemy4");
            this.AddChild(enemy[1].Sprite);
            enemy[2] = new Enemy(new Vector2(500f, 0f), "WeakEnemy4");
            this.AddChild(enemy[2].Sprite);
            enemy[3] = new Enemy(new Vector2(700f, 0f), "WeakEnemy4");
            this.AddChild(enemy[3].Sprite);
            enemy[4] = new Enemy(new Vector2(400, 0f), "WeakEnemy3");
            this.AddChild(enemy[4].Sprite);
            enemy[5] = new Enemy(new Vector2(400, 0f), "WeakEnemy3");
            this.AddChild(enemy[5].Sprite);
            enemy[6] = new Enemy(new Vector2(600, 0f), "WeakEnemy3");
            this.AddChild(enemy[6].Sprite);
            enemy[7] = new Enemy(new Vector2(600, 0f), "WeakEnemy3");
            this.AddChild(enemy[7].Sprite);

            player = new Player();
            this.AddChild(player.Sprite);

            loadMenu = new LoadMenu("MenuScreen");
            this.AddChild(loadMenu.Sprite);
        }
Beispiel #26
0
        public GameOverScene(bool win, int playerScore, Client client)
        {
            m_client      = client;
            m_playerScore = playerScore;

            this.Camera.SetViewFromViewport();
            // add label with highscore
            Font    font    = new Font(FontAlias.System, 32, FontStyle.Bold);
            FontMap fontMap = new FontMap(font, 512);
            Label   label1  = new Label("Score: " + m_playerScore.ToString(), fontMap);

            label1.Position = new Vector2(400, 20);

            string gameOverMessage;

            if (win)
            {
                gameOverMessage = "Player 1 wins";
            }
            else
            {
                gameOverMessage = "Player 2 wins";
            }

            Label label2 = new Label(gameOverMessage, fontMap);

            label2.Position = new Vector2(400, 300);

            this.AddChild(label1);
            this.AddChild(label2);


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

            Touch.GetData(0).Clear();
        }
        public void CheckInput()
        {
            var touches = Touch.GetData(0);

            var touchPos = Input2.Touch00.Pos;

            Bounds2 touchBox = new Bounds2();

            touchBox.Min.X = (touchPos.X * (Director.Instance.GL.Context.GetViewport().Width / 2))
                             + (Director.Instance.GL.Context.GetViewport().Width / 2);
            touchBox.Max.X = (touchPos.X * (Director.Instance.GL.Context.GetViewport().Width / 2))
                             + (Director.Instance.GL.Context.GetViewport().Width / 2);
            touchBox.Min.Y = (touchPos.Y * (Director.Instance.GL.Context.GetViewport().Height / 2))
                             + (Director.Instance.GL.Context.GetViewport().Height / 2);
            touchBox.Max.Y = (touchPos.Y * (Director.Instance.GL.Context.GetViewport().Height / 2))
                             + (Director.Instance.GL.Context.GetViewport().Height / 2);
            if (!options)
            {
                if (touchBox.Overlaps(playBox) && touches.Count != 0)
                {
                    play = true;
                    RemoveAll();
                }

                if (touchBox.Overlaps(controlsBox) && touches.Count != 0)
                {
                    //options = true;
                    //optionScreen.Show();
                    dialog.Show();
                    options = true;
                }

                if (Input2.GamePad0.Cross.Release && playSprite.TextureInfo == playSelectTexture)
                {
                    play = true;
                    RemoveAll();
                }

                if (Input2.GamePad0.Down.Release)
                {
                    playSprite.TextureInfo    = playTexture;
                    controlSprite.TextureInfo = controlTexture;
                }

                if (Input2.GamePad0.Right.Release)
                {
                    controlSprite.TextureInfo = controlSelectTexture;
                    playSprite.TextureInfo    = playTexture;
                }

                if (Input2.GamePad0.Left.Release)
                {
                    controlSprite.TextureInfo = controlTexture;
                    playSprite.TextureInfo    = playTexture;
                }

                if (Input2.GamePad0.Up.Release)
                {
                    controlSprite.TextureInfo = controlTexture;
                    playSprite.TextureInfo    = playSelectTexture;
                }
            }
            else
            {
                //if (!optionScreen.CheckOptions())
                //	options = false;
            }
        }
        public static void Update()
        {
            //Determine whether the player tapped the screen
            var touches = Touch.GetData(0);

            if (Director.Instance.CurrentScene == startScene)
            {
                scoreLabel.Text = "Touch to start";


                if (touches.Count > 0 && !keyPressed)
                {
                    Touch.GetData(0).Clear();
                    Director.Instance.ReplaceScene(gameScene);
                    keyPressed = true;
                }
            }
            else if (Director.Instance.CurrentScene == gameScene)
            {
                //If tapped, inform the bird.
                if (touches.Count > 0)
                {
                    bird.Tapped();
                }

                //Update the bird.
                bird.Update(0.0f);

                if (bird.Alive)
                {
                    //Move the background.
                    background.Update(0.0f);

                    //Update the obstacles.
                    foreach (Obstacle obstacle in obstacles)
                    {
                        obstacle.Update(0.0f);
                    }
                    foreach (Obstacle obstacle in obstacles)
                    {
                        if (obstacle.HasCollidedWith(bird.Sprite))
                        {
                            bird.Alive        = false;
                            bird.Sprite.Color = Colors.Black;
                        }
                        if (obstacle.HasPassed(bird.Sprite))
                        {
                            score++;
                        }
                    }
                    scoreLabel.Text = "" + score;
                }
                if (!bird.Alive)
                {
                    Director.Instance.ReplaceScene(endScene);
                }
            }
            else if (Director.Instance.CurrentScene == endScene)
            {
                scoreLabel.Text = "You dead";
                score           = 0;
                bird.reset();
                bird.Sprite.Color = Colors.White;

                obstacles[0].reset(Director.Instance.GL.Context.GetViewport().Width *0.5f);
                obstacles[1].reset(Director.Instance.GL.Context.GetViewport().Width);

                if (touches.Count > 0 && !keyPressed)
                {
                    Director.Instance.ReplaceScene(startScene);
                    keyPressed = true;
                }
            }
            if (touches.Count == 0 && keyPressed)
            {
                keyPressed = false;
            }
        }
Beispiel #29
0
        public static bool Render()
        {
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();
            serverButton.SetText(tcpServer.buttonString);
            clientButton.SetText(tcpClient.buttonString);

            List <TouchData> touchDataList = Touch.GetData(0);

            // Modify status
            if (serverButton.TouchDown(touchDataList))
            {
                tcpServer.ChangeStatus();
            }
            if (clientButton.TouchDown(touchDataList))
            {
                tcpClient.ChangeStatus();
            }

            /*
             * uint[] colorTable = {0xffff0000,
             *                                       0xff00ff00,
             *                                       0xff0000ff,
             *                                       0xffffff00};
             */
            foreach (var touchData in touchDataList)
            {
                /*
                 *                      if (touchData.Status == TouchStatus.Down ||
                 *                              touchData.Status == TouchStatus.Move) {
                 *
                 *                              int pointX = (int)((touchData.X + 0.5f) * Graphics2D.Width);
                 *                              int pointY = (int)((touchData.Y + 0.5f) * Graphics2D.Height);
                 *                              int radius = (int)(touchData.Force * 32);
                 *                              int colorId = touchData.ID % colorTable.Length;
                 *
                 *                              Graphics2D.FillCircle(colorTable[colorId], pointX, pointY, radius);
                 *
                 *                      }
                 */
                if (touchData.Status == TouchStatus.Down)
                {
                    int pointX = (int)((touchData.X + 0.5f) * SampleDraw.Width);
                    int pointY = (int)((touchData.Y + 0.5f) * SampleDraw.Height);
                    if (pointX < (SampleDraw.Width / 2))
                    {
                        tcpServer.SetMyPosition(pointX, pointY);
                    }
                    else
                    {
                        tcpClient.SetMyPosition(pointX - (SampleDraw.Width / 2), pointY);
                    }
                }
            }

            // Display button and status
            serverButton.Draw();
            clientButton.Draw();
            drawStatus(tcpServer);
            drawStatus(tcpClient);

            SampleDraw.DrawText("Network Sample", 0xffffffff, 0, 0);
            graphics.SwapBuffers();

            return(true);
        }
Beispiel #30
0
    static void Main(string[] args)
    {
        Log.SetToConsole();

                #if EASY_SETUP
        // initialize GameEngine2D's singletons
        Director.Initialize();
                #else // #if EASY_SETUP
        // create our own context
        Sce.Pss.Core.Graphics.GraphicsContext context = new Sce.Pss.Core.Graphics.GraphicsContext();

        // maximum number of sprites you intend to use (not including particles)
        uint sprites_capacity = 500;

        // maximum number of vertices that can be used in debug draws
        uint draw_helpers_capacity = 400;

        // initialize GameEngine2D's singletons, passing context from outside
        Director.Initialize(sprites_capacity, draw_helpers_capacity, context);
                #endif // #if EASY_SETUP

        Director.Instance.GL.Context.SetClearColor(Colors.Grey20);

        // set debug flags that display rulers to debug coordinates
//		Director.Instance.DebugFlags |= DebugFlags.DrawGrid;
        // set the camera navigation debug flag (press left alt + mouse to navigate in 2d space)
        Director.Instance.DebugFlags |= DebugFlags.Navigate;

        // create a new scene
        var scene = new Scene();

        // set the camera so that the part of the word we see on screen matches in screen coordinates
        scene.Camera.SetViewFromViewport();

        // create a new TextureInfo object, used by sprite primitives
        var texture_info = new TextureInfo(new Texture2D("/Application/Sample/GameEngine2D/HelloSprite/king_water_drop.png", false));

        // create a new sprite
        var sprite = new SpriteUV()
        {
            TextureInfo = texture_info
        };

        // make the texture 1:1 on screen
        sprite.Quad.S = texture_info.TextureSizef;

        // center the sprite around its own .Position
        // (by default .Position is the lower left bit of the sprite)
        sprite.CenterSprite();

        // put the sprite at the center of the screen
        sprite.Position = scene.Camera.CalcBounds().Center;
        //sprite.Scale = Vector2.One * 0.9f;
        // our scene only has 2 nodes: scene->sprite
        scene.AddChild(sprite);

                #if EASY_SETUP
        Director.Instance.RunWithScene(scene);
                #else // #if EASY_SETUP
        // handle the loop ourself

        Director.Instance.RunWithScene(scene, true);

        while (!Input2.GamePad0.Cross.Press)
        {
            Sce.Pss.Core.Environment.SystemEvents.CheckEvents();

                        #if EXTERNAL_INPUT
            // it is not needed but you can set external input data if you want

            List <TouchData> touch_data_list = Touch.GetData(0);
            Input2.Touch.SetData(0, touch_data_list);

            GamePadData pad_data = GamePad.GetData(0);
            Input2.GamePad.SetData(0, pad_data);
                        #endif // #if EXTERNAL_INPUT

            Director.Instance.Update();
//			Debug.WriteLine("===============>" + Director.Instance.SpriteRenderer);
            Director.Instance.Render();

            Director.Instance.GL.Context.SwapBuffers();
            Director.Instance.PostSwap();             // you must call this after SwapBuffers

//			System.Console.WriteLine( "Director.Instance.DebugStats.DrawArraysCount " + Director.Instance.GL.DebugStats.DrawArraysCount );
        }
                #endif // #if EASY_SETUP

        Director.Terminate();

        System.Console.WriteLine("Bye!");
    }