예제 #1
0
        public HUD(GraphicsContext gc)
        {
            graphics = gc;
            UISystem.Initialize(graphics);
            Scene scene = new Scene();

            position       = new Label();
            position.X     = 10;
            position.Y     = 10;
            position.Width = 600;
            position.Text  = "Test Output";
            scene.RootWidget.AddChildLast(position);

            FPS       = new Label();
            FPS.X     = graphics.Screen.Rectangle.Width - 310;
            FPS.Y     = 10;
            FPS.Width = 300;
            FPS.HorizontalAlignment = HorizontalAlignment.Right;
            FPS.Text = "FPS = ???";
            scene.RootWidget.AddChildLast(FPS);


            enemies       = new Label();
            enemies.X     = 10;
            enemies.Y     = 500;
            enemies.Width = 300;
            enemies.Text  = "Enemy Count = 0";
            scene.RootWidget.AddChildLast(enemies);

            UISystem.SetScene(scene, null);

            frameCounter = 0;
            elapseTime   = 0;
        }
예제 #2
0
    private void Awake()
    {
        instance = this;
        UISystem uiSystem = FindObjectOfType <UISystem>();

        uiSystem.Initialize();

        SetState(State.NoTarget);
    }
예제 #3
0
        //Text based announcements that display on the screen
        public MenuDisplay(GraphicsContext gc)
        {
            graphics = gc;
            UISystem.Initialize(graphics);
            Scene scene = new Scene();

            announcement       = new Label();
            announcement.X     = 0;
            announcement.Y     = graphics.Screen.Rectangle.Height / 2 - announcement.TextHeight / 2;
            announcement.Width = graphics.Screen.Rectangle.Width;
            announcement.HorizontalAlignment = HorizontalAlignment.Center;
            announcement.Text = "";
            scene.RootWidget.AddChildLast(announcement);

            announcement2       = new Label();
            announcement2.X     = 0;
            announcement2.Y     = graphics.Screen.Rectangle.Height / 2 - announcement2.TextHeight / 2 + announcement.Height;
            announcement2.Width = graphics.Screen.Rectangle.Width;
            announcement2.HorizontalAlignment = HorizontalAlignment.Center;
            announcement2.Text = "";
            scene.RootWidget.AddChildLast(announcement2);

            announcement3       = new Label();
            announcement3.X     = 0;
            announcement3.Y     = graphics.Screen.Rectangle.Height / 2 - announcement3.TextHeight / 2 + (announcement2.Height * 2);
            announcement3.Width = graphics.Screen.Rectangle.Width;
            announcement3.HorizontalAlignment = HorizontalAlignment.Center;
            announcement3.Text = "";
            scene.RootWidget.AddChildLast(announcement3);

            announcement4       = new Label();
            announcement4.X     = 0;
            announcement4.Y     = graphics.Screen.Rectangle.Height / 2 - announcement4.TextHeight / 2 + (announcement3.Height * 3);
            announcement4.Width = graphics.Screen.Rectangle.Width;
            announcement4.HorizontalAlignment = HorizontalAlignment.Center;
            announcement4.Text = "";
            scene.RootWidget.AddChildLast(announcement4);

            announcement5       = new Label();
            announcement5.X     = 0;
            announcement5.Y     = graphics.Screen.Rectangle.Height / 2 - announcement3.TextHeight / 2 + (announcement4.Height * 4);
            announcement5.Width = graphics.Screen.Rectangle.Width;
            announcement5.HorizontalAlignment = HorizontalAlignment.Center;
            announcement5.Text = "";
            scene.RootWidget.AddChildLast(announcement5);

            announcement6       = new Label();
            announcement6.X     = 0;
            announcement6.Y     = graphics.Screen.Rectangle.Height / 2 - announcement6.TextHeight / 2 + (announcement5.Height * 5);
            announcement6.Width = graphics.Screen.Rectangle.Width;
            announcement6.HorizontalAlignment = HorizontalAlignment.Center;
            announcement6.Text = "";
            scene.RootWidget.AddChildLast(announcement6);

            UISystem.SetScene(scene, null);
        }
        public static void Initialize()
        {
            //Set up director and UISystem.
            Director.Initialize();
            UISystem.Initialize(Director.Instance.GL.Context);

            //Set game scene
            gameScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            gameScene.Camera.SetViewFromViewport();
            gameScene.Name = "gameScene";

            startScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            startScene.Camera.SetViewFromViewport();
            startScene.Name = "startScene";

            endScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            endScene.Camera.SetViewFromViewport();
            endScene.Name = "endScene";

            //Set the ui scene.
            uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel panel = new Panel();

            panel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;
            scoreLabel   = new Sce.PlayStation.HighLevel.UI.Label();
            scoreLabel.HorizontalAlignment = HorizontalAlignment.Center;
            scoreLabel.VerticalAlignment   = VerticalAlignment.Top;
            scoreLabel.SetPosition(
                Director.Instance.GL.Context.GetViewport().Width / 2 - scoreLabel.Width / 2,
                Director.Instance.GL.Context.GetViewport().Height *0.1f - scoreLabel.Height / 2);
            scoreLabel.Text = "0";
            panel.AddChildLast(scoreLabel);
            uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(uiScene);

            //Create the background.
            background      = new Background(gameScene, gameScene.Name);
            titleBackground = new Background(startScene, startScene.Name);
            endBackground   = new Background(endScene, endScene.Name);
            //Create the flappy douche
            bird = new Bird(gameScene);


            //Create some obstacles.
            obstacles    = new Obstacle[2];
            obstacles[0] = new Obstacle(Director.Instance.GL.Context.GetViewport().Width *0.5f, gameScene);
            obstacles[1] = new Obstacle(Director.Instance.GL.Context.GetViewport().Width, gameScene);

            score      = 0;
            keyPressed = false;

            //Run the scene.
            Director.Instance.RunWithScene(startScene, true);
        }
예제 #5
0
파일: AppMain.cs 프로젝트: uavos/jsw
 public static void Initialize()
 {
     // Set up the graphics system
     graphics = new GraphicsContext();
     UISystem.Initialize(graphics);
     // Create scene
     scene = new UIJswScene();
     UISystem.SetScene(scene);
     //UDP
     udp = new UdpClient();
     udpTimer.Elapsed += OnUdpTimerEvent;
     udpTimer.Enabled  = true;
 }
예제 #6
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();
                    }
                }
            }
        }
예제 #7
0
        public static void Initialize()
        {
            // Set up the graphics system
            graphics = new GraphicsContext();

            Logic.Init();
            // TODO: Create scenes and call UISystem.SetScene
            // Create scene
            UISystem.Initialize(graphics);

            MainWnd = new PSVReaderUI.MainFrame();

            // Set scene
            UISystem.SetScene(MainWnd, null);
        }
예제 #8
0
        public HUD(GraphicsContext g)
        {
            graphics = g;
            UISystem.Initialize(graphics);

            Scene scene = new Scene();

            lblPlayScore       = new Label();
            lblPlayScore.X     = 0;
            lblPlayScore.Y     = 10;
            lblPlayScore.Width = 960;
            lblPlayScore.HorizontalAlignment = HorizontalAlignment.Center;
            scene.RootWidget.AddChildLast(lblPlayScore);

            UISystem.SetScene(scene, null);
        }
예제 #9
0
 public static void Initialize()
 {
     // Initial player score
     playerScore = 0;
     //Set up director
     Director.Initialize();
     // Initialize UI system
     UISystem.Initialize(Director.Instance.GL.Context);
     // Retrieve screen width and height
     screenWidth  = UISystem.FramebufferWidth;
     screenHeight = UISystem.FramebufferHeight;
     // Set initial scene
     UISystem.SetScene(new MenuUI());
     // Run the scene
     Director.Instance.RunWithScene(new Sce.PlayStation.HighLevel.GameEngine2D.Scene(), true);
 }
예제 #10
0
        public TopScoreHUD(GraphicsContext g, Score[] sl, int sc)
        {
            graphics = g;
            UISystem.Initialize(graphics);
            scorelist       = sl;
            newHighScoreTxt = "";
            characterList   = "_ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!";
            init1           = "";
            init2           = "";
            init3           = "";
            playersInitials = scorelist[4].PlayerInitials;
            playersScore    = scorelist[4].PlayerScore;
            score           = sc;
            indexPlace      = 0;
            indexChar1      = 0;
            indexChar2      = 0;
            indexChar3      = 0;
            doNewHighScore  = false;

            //New High Score Check
            if (score > scorelist[4].PlayerScore)
            {
                doNewHighScore = true;
                init1          = "_";
                init2          = "_";
                init3          = "_";
            }

            //Create Text
            Scene scene = new Scene();

            lblTopScore        = new Label();
            lblTopScore.X      = 0;
            lblTopScore.Y      = 10;
            lblTopScore.Width  = graphics.Screen.Rectangle.Width;
            lblTopScore.Height = graphics.Screen.Rectangle.Height;
            lblTopScore.Text   = "";

            lblTopScore.HorizontalAlignment = HorizontalAlignment.Center;
            lblTopScore.VerticalAlignment   = VerticalAlignment.Top;
            scene.RootWidget.AddChildLast(lblTopScore);

            UISystem.SetScene(scene, null);
        }
예제 #11
0
        public static void Initialize()
        {
            // Set up the graphics system
            graphics = new GraphicsContext();

            // Initialize UI Toolkit
            UISystem.Initialize(graphics);

            // Create scene
            Scene myScene = new Scene();
            Label label   = new Label();

            label.X    = 10.0f;
            label.Y    = 50.0f;
            label.Text = "Hello World!";
            myScene.RootWidget.AddChildLast(label);
            // Set scene
            UISystem.SetScene(myScene, null);
        }
예제 #12
0
        public static void Initialize()
        {
            //Set up director
            Director.Initialize();
            UISystem.Initialize(Director.Instance.GL.Context);

            Sce.PlayStation.HighLevel.UI.Scene blankUI = new Sce.PlayStation.HighLevel.UI.Scene();
            UISystem.SetScene(blankUI);

            //Create Game Scenes
            menuScene = new MenuScene();
            gameScene = new GameScene();
            menuScene.GetScene().Camera.SetViewFromViewport();
            gameScene.Camera.SetViewFromViewport();

            //Run the scene.
            //currentScene = Scene.Game;
            Director.Instance.RunWithScene(gameScene, true);
        }
예제 #13
0
        //private static SpriteUV background;
        //private static TextureInfo textureInfo;

        public static void Main(string[] args)
        {
            Director.Initialize();
            UISystem.Initialize(Director.Instance.GL.Context);

            stopwatch.Start();
            float startSeconds = 0.0f;
            float endSeconds   = 0.016f;
            float lastSeconds;

            while (true)
            {
                lastSeconds  = endSeconds - startSeconds;
                startSeconds = (float)stopwatch.ElapsedMilliseconds / 1000.0f;
                SystemEvents.CheckEvents();
                SceneManager.Instance.runScene(lastSeconds);
                endSeconds = (float)stopwatch.ElapsedMilliseconds / 1000.0f;
            }
            Director.Terminate();
        }
예제 #14
0
        public static void Initialize()
        {
            // Set up the graphics system
            graphics = new GraphicsContext();

            Draw.init(graphics);
            dgl_connection = new dialog.DLG_CONNECTION();

            UISystem.Initialize(graphics);

            sceneMain = new MainUI();
            UISystem.SetScene(sceneMain, null);

            stopWatch = new Stopwatch();
            texture1  = new Texture2D(940, 544, false, PixelFormat.Rgba);
            texture2  = new Texture2D(940, 544, false, PixelFormat.Rgba);

            // Set up Client
            client = new TCPConnection("192.168.1.110", 8080);
            SendPacket.Init(client);
        }
예제 #15
0
        public static void Initialize()
        {
            //Set up director and UISystem.
            Director.Initialize();
            UISystem.Initialize(Director.Instance.GL.Context);

            //Set game scene
            gameScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            gameScene.Camera.SetViewFromViewport();

            //Set the ui scene.
            uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel panel = new Panel();

            panel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;

            uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(uiScene);

            //Run the scene.
            Director.Instance.RunWithScene(gameScene, true);
        }
예제 #16
0
        public static void InitializeGraphics()
        {
            // Set up the graphics system
            graphics = new GraphicsContext();

            // Initialize UI Toolkit
            UISystem.Initialize(graphics);

            // Create scene
            Scene myScene = new Scene();

            label              = new Label();
            label.X            = 10.0f;
            label.Y            = 10.0f;
            label.Width        = graphics.Screen.Width - 20.0f;
            label.Height       = graphics.Screen.Height - 20.0f;
            label.TextTrimming = TextTrimming.None;
            myScene.RootWidget.AddChildLast(label);
            // Set scene
            UISystem.SetScene(myScene, null);

            gui_enabled = true;
        }
예제 #17
0
        public static void Initialize()
        {
            //Set up director and UISystem.
            Director.Initialize();
            UISystem.Initialize(Director.Instance.GL.Context);

            //Set game scene
            gameScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            gameScene.Camera.SetViewFromViewport();

            //Set the ui scene.
            uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel panel = new Panel();

            panel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;
            uiScene.RootWidget.AddChildLast(panel);

            //Set the highscores scene.
            highscoresManager = new HighScoreManager(gameScene);
            highscoresScene   = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel highscoresPanel = new Panel();

            highscoresPanel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            highscoresPanel.Height = Director.Instance.GL.Context.GetViewport().Height;
            highscoresScene.RootWidget.AddChildLast(highscoresPanel);

            // Setup highscores label
            highscoresLabel        = new Sce.PlayStation.HighLevel.UI.Label();
            highscoresLabel.Height = 200.0f;
            highscoresLabel.Text   = "Retrieving Data";
            highscoresPanel.AddChildLast(highscoresLabel);
            highscoresScene.RootWidget.AddChildLast(highscoresPanel);

            // Setup ui scene labels
            scoreLabel = new Sce.PlayStation.HighLevel.UI.Label();
            scoreLabel.SetPosition(10, 8);
            int roundedScore = (int)FMath.Floor(score / 100) * 100;

            scoreLabel.Text = "Score: " + roundedScore.ToString("N0");
            panel.AddChildLast(scoreLabel);

            gameSpeedLabel = new Sce.PlayStation.HighLevel.UI.Label();
            gameSpeedLabel.SetPosition(770, 8);
            float speed = FMath.Round(moveSpeed * 10) / 10;             // round to 1dp

            gameSpeedLabel.Text = "Game Speed: " + moveSpeed.ToString("N1");
            panel.AddChildLast(gameSpeedLabel);

            soundManager = new SoundManager();

            //Create Sprite
            rTextureInfo     = new TextureInfo("/Application/textures/reset.png");
            rSprite          = new SpriteUV();
            rSprite          = new SpriteUV(rTextureInfo);
            rSprite.Quad.S   = rTextureInfo.TextureSizef;
            rSprite.Scale    = new Vector2(1.0f, 1.0f);
            rSprite.Position = new Vector2(0.0f, 0.0f);
            rSprite.CenterSprite();

            //Run the scene.
            Director.Instance.RunWithScene(gameScene, true);
            screenManager = new ScreenManager(gameScene);
        }
예제 #18
0
        public static void Initialize()
        {
            graphics = new GraphicsContext();

            // Initialize UI Toolkit
            UISystem.Initialize(graphics);
            screenWidth  = UISystem.FramebufferWidth;
            screenHeight = UISystem.FramebufferHeight;

            // Create scene
            Scene scene = new Sce.PlayStation.HighLevel.UI.Scene();

            #region Big Bang - Fun with Flags - Intro sound


            #endregion
            #region Scotland Flag and sounds
            ImageBox scotlandFlag = new ImageBox();
            scotlandFlag.Image          = new ImageAsset("/Application/flags/scotland.png");
            scotlandFlag.ImageScaleType = ImageScaleType.AspectInside;

            scotlandFlag.Width  = scotlandFlag.Image.Width / 2;
            scotlandFlag.Height = scotlandFlag.Image.Height / 2;

            scotlandFlag.X = screenWidth * 0.25f - (scotlandFlag.Width / 2);
            scotlandFlag.Y = screenHeight * 0.25f - (scotlandFlag.Height / 2);

            scotlandRect = new Rectangle(scotlandFlag.X, scotlandFlag.Y, scotlandFlag.Width, scotlandFlag.Height);
            /***********************sounds***************************/


            #endregion
            scene.RootWidget.AddChildLast(scotlandFlag);

            #region England Flag
            ImageBox englandFlag = new ImageBox();
            englandFlag.Image          = new ImageAsset("/Application/flags/england.png");
            englandFlag.ImageScaleType = ImageScaleType.AspectInside;

            englandFlag.Width  = englandFlag.Image.Width / 2;
            englandFlag.Height = englandFlag.Image.Height / 2;

            englandFlag.X = screenWidth * 0.75f - (englandFlag.Width / 2);
            englandFlag.Y = screenHeight * 0.25f - (englandFlag.Height / 2);

            englandRect = new Rectangle(englandFlag.X, englandFlag.Y, englandFlag.Width, englandFlag.Height);

            #endregion
            scene.RootWidget.AddChildLast(englandFlag);

            #region Northern Ireland Flag
            ImageBox n_irelandFlag = new ImageBox();
            n_irelandFlag.Image          = new ImageAsset("/Application/flags/n_ireland.png");
            n_irelandFlag.ImageScaleType = ImageScaleType.AspectInside;

            n_irelandFlag.Width  = n_irelandFlag.Image.Width / 2;
            n_irelandFlag.Height = n_irelandFlag.Image.Height / 2;

            n_irelandFlag.X = screenWidth * 0.25f - (n_irelandFlag.Width / 2);
            n_irelandFlag.Y = screenHeight * 0.75f - (n_irelandFlag.Height / 2);

            n_irelandRect = new Rectangle(n_irelandFlag.X, n_irelandFlag.Y, n_irelandFlag.Width, n_irelandFlag.Height);

            #endregion
            scene.RootWidget.AddChildLast(n_irelandFlag);

            #region Wales Flag
            ImageBox walesFlag = new ImageBox();
            walesFlag.Image          = new ImageAsset("/Application/flags/wales.png");
            walesFlag.ImageScaleType = ImageScaleType.AspectInside;

            walesFlag.Width  = walesFlag.Image.Width / 2;
            walesFlag.Height = walesFlag.Image.Height / 2;

            walesFlag.X = screenWidth * 0.75f - (walesFlag.Width / 2);
            walesFlag.Y = screenHeight * 0.75f - (walesFlag.Height / 2);

            walesRect = new Rectangle(walesFlag.X, walesFlag.Y, walesFlag.Width, walesFlag.Height);
            #endregion
            scene.RootWidget.AddChildLast(walesFlag);
            // Set scene
            UISystem.SetScene(scene, null);

            #region Instantiate and Setup audio
            Bgm funWithFlags = new Bgm("/Application/sounds/funWithFlags.mp3");
            mp3Player = funWithFlags.CreatePlayer();
            #endregion
            /*************Play starting mp3 - funWithFlag s***********/
            mp3Player.Play();
        }
예제 #19
0
 public static void Main(string[] args)
 {
     Director.Initialize();
     UISystem.Initialize(Director.Instance.GL.Context);
     Director.Instance.RunWithScene(new TitleScene());
 }
예제 #20
0
 public static void SetUpUI(GraphicsContext graphics, Sce.Pss.HighLevel.UI.Scene scene)
 {
     UISystem.Initialize(graphics);
     UISystem.SetScene(scene);
 }
예제 #21
0
        private static void Initialize()
        {
            graphics = new GraphicsContext();

            //Initialize textures only once for their load
            bossTex  = new Texture2D("Application/Assets/Boss.png", false);
            dumbTex  = new Texture2D("Application/Assets/Fire_Ball.png", false);
            lockTex  = new Texture2D("Application/Assets/Copter.png", false);
            sent1Tex = new Texture2D("Application/Assets/Sentry.png", false);
            sent3Tex = new Texture2D("Application/Assets/sentryexclaimation.png", false);
            projBTex = new Texture2D("Application/Assets/basicproj.png", false);
            projFTex = new Texture2D("Application/Assets/flameproj.png", false);
            projLTex = new Texture2D("Application/Assets/lazerproj.png", false);
            wpnBTex  = new Texture2D("Application/Assets/Pistol.png", false);
            wpnFTex  = new Texture2D("Application/Assets/Flamethrower2.png", false);
            wpnLTex  = new Texture2D("Application/Assets/LaserBeam.png", false);

            rand = new Random();

            //Screens
            startScr      = new Sprite(graphics, new Texture2D("Application/Assets/startscreen.png", false));
            directionsScr = new Sprite(graphics, new Texture2D("Application/Assets/directionsscreen.png", false));
            endScr        = new Sprite(graphics, new Texture2D("Application/Assets/byescreen.png", false));
            highScr       = new Sprite(graphics, new Texture2D("Application/Assets/highscores.png", false));
            enterScr      = new Sprite(graphics, new Texture2D("Application/Assets/enterscorescreen.png", false));

            //Sounds
            Bgm bgm = new Bgm("/Application/Assets/intro.mp3");

            bgmp      = bgm.CreatePlayer();
            bgmp.Loop = true;
            bgmp.Play();

            //Major components
            player      = new Player(graphics);
            wpn         = new WeaponBasic(graphics);
            enemies     = new List <Enemy>();
            projectiles = new List <Projectile>();
            testers     = new List <Sprite>();        //*x for visually testing hitboxes

            //Create portal
            Texture2D t = new Texture2D("Application/Assets/portal.png", false);

            portal            = new Sprite(graphics, t);
            portal.Position.X = (graphics.Screen.Rectangle.Width / 2)
                                - (portal.Width / 2);
            portal.Position.Y = (graphics.Screen.Rectangle.Height / 2)
                                - (portal.Height / 2);

            //Create portal projectile shield
            t                = new Texture2D("Application/Assets/shine.png", false);
            shine            = new Sprite(graphics, t);
            shine.Position.X = (graphics.Screen.Rectangle.Width / 2)
                               - (shine.Width / 2);
            shine.Position.Y = (graphics.Screen.Rectangle.Height / 2)
                               - (shine.Height / 2);

            //PausedScreen sprite setup
            pauseScr = new Sprite(graphics, new Texture2D("Application/Assets/pausedscreen.png", false));
            pauseScr.SetColor(1f, 1f, 1f, .4f);

            //Add Item pickups
            flamethrower            = new Sprite(graphics, wpnFTex);
            flamethrower.Position.X = (graphics.Screen.Rectangle.Width / 3)
                                      - (flamethrower.Width / 2);
            flamethrower.Position.Y = (graphics.Screen.Rectangle.Height / 3)
                                      - (flamethrower.Height / 2);
            flameBox = new Rectangle(flamethrower.Position.X, flamethrower.Position.Y, flamethrower.Width, flamethrower.Height);

            lazer            = new Sprite(graphics, wpnLTex);
            lazer.Position.X = (graphics.Screen.Rectangle.Width * 2 / 3) + rand.Next(-100, 101)
                               - (lazer.Width / 2);
            lazer.Position.Y = (graphics.Screen.Rectangle.Height * 2 / 3) + rand.Next(100, 101)
                               - (lazer.Height / 2);
            lazerBox = new Rectangle(lazer.Position.X, lazer.Position.Y, lazer.Width, lazer.Height);

            //Start clock
            clock = new Stopwatch();
            clock.Start();

            //Initialize UI
            UISystem.Initialize(graphics);
            sceneGame = new Scene();

            label1            = new Label();
            label1.X          = 20;
            label1.Y          = 10;
            label1.Width      = 1000;
            label1.Text       = "Score: " + score;
            initialL1FontSize = label1.Font.Size;
            initialL1Height   = label1.Height;
            label1.TextColor  = new UIColor(1f, .25f, .25f, 1f);
            sceneGame.RootWidget.AddChildLast(label1);

            label2            = new Label();
            label2.X          = 20;
            label2.Y          = graphics.Screen.Height - 40;
            label2.Width      = 800;
            label2.Text       = "Health: " + player.Health;
            initialL2FontSize = label2.Font.Size;
            initialL2Height   = label2.Height;
            initialL2Y        = label2.Y;
            label2.TextColor  = new UIColor(1f, .25f, .25f, 1f);
            sceneGame.RootWidget.AddChildLast(label2);

            sceneScores = new Scene();

            label3         = new Label();
            label3.X       = 333;
            label3.Y       = 400;
            label3.Width   = 600;
            label3.Height += 35;

            try
            {
                StreamReader sr    = new StreamReader("/Documents/highscores.txt");
                string       tempS = sr.ReadLine();
                if (tempS.Length > 0)
                {
                    hiScore     = Double.Parse(tempS.Substring(3));
                    label3.Text = tempS.Substring(0, 3) + ": " + hiScore;
                }
                else
                {
                    label3.Text = "No High Score, Yet!";
                }
                sr.Close();
            }
            catch (FileNotFoundException)
            {
                label3.Text = "File Not Found!";
            }

            label3.Font.Size += 30;
            label3.TextColor  = new UIColor(0f, 0f, 0f, 1f);
            sceneScores.RootWidget.AddChildLast(label3);

            sceneHiScore = new Scene();

            label4            = new Label();
            label4.X          = 550;
            label4.Y          = 400;
            label4.Width      = 500;
            label4.Height    += 18;
            label4.Font.Size += 30;
            label4.Text       = "A";
            label4.TextColor  = new UIColor(0f, 0f, 0f, 1f);
            sceneHiScore.RootWidget.AddChildLast(label4);

            UISystem.SetScene(sceneGame, null);

            //*x tester = new Sprite (graphics, projBTex);
        }
예제 #22
0
        public static void Initialize()
        {
            //Set up director and UISystem.
            Director.Initialize();
            UISystem.Initialize(Director.Instance.GL.Context);

            //Set game scene
            gameScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            gameScene.Camera.SetViewFromViewport();

            //Set the ui scene.
            uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel panel = new Panel();

            panel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;

            scoreLabel = new Sce.PlayStation.HighLevel.UI.Label();
            scoreLabel.HorizontalAlignment = HorizontalAlignment.Left;
            scoreLabel.VerticalAlignment   = VerticalAlignment.Top;

            scoreLabel.TextShadow                  = new TextShadowSettings();
            scoreLabel.TextShadow.Color            = new UIColor(0.0f, 0.0f, 0.0f, 1.0f);
            scoreLabel.TextShadow.HorizontalOffset = 2.0f;
            scoreLabel.TextShadow.VerticalOffset   = 2.0f;

            scoreLabel.SetPosition(
                Director.Instance.GL.Context.GetViewport().Width / 2 - scoreLabel.Width / 2,
                Director.Instance.GL.Context.GetViewport().Width *0.1f - scoreLabel.Height / 2);

            scoreLabel.Text = "Score: " + score.ToString();

            airLabel = new Sce.PlayStation.HighLevel.UI.Label();
            airLabel.HorizontalAlignment = HorizontalAlignment.Right;
            airLabel.VerticalAlignment   = VerticalAlignment.Top;

            airLabel.TextShadow                  = new TextShadowSettings();
            airLabel.TextShadow.Color            = new UIColor(0.0f, 0.0f, 0.0f, 1.0f);
            airLabel.TextShadow.HorizontalOffset = 2.0f;
            airLabel.TextShadow.VerticalOffset   = 2.0f;

            airLabel.SetPosition(
                Director.Instance.GL.Context.GetViewport().Width / 2 - airLabel.Width / 2,
                Director.Instance.GL.Context.GetViewport().Width *0.1f - airLabel.Height / 2);
            airLabel.Text = "Air: " + air.ToString();

            windowWidth  = Director.Instance.GL.Context.GetViewport().Width;
            windowHeight = Director.Instance.GL.Context.GetViewport().Height;

            panel.AddChildLast(scoreLabel);
            panel.AddChildLast(airLabel);
            uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(uiScene);

            //Create the background.
            background = new Background(gameScene);

            //Create the flappy guy
            bird = new Bird(gameScene);

            //Create some chains.
            chain    = new Chain[OBSTACLE_COUNT];
            chain[0] = new Chain(windowWidth * 0.5f, gameScene);
            chain[1] = new Chain(windowWidth, gameScene);

            //Create seamines and attach to chain
            seamine    = new Mine[OBSTACLE_COUNT];
            seamine[0] = new Mine((X = chain[0].GetX + chain[0].GetMaxX) - 80, Y = chain[0].GetY + chain[0].GetMaxY, gameScene);
            seamine[1] = new Mine((X = chain[1].GetX + chain[1].GetMaxX) - 80, Y = chain[1].GetY + chain[1].GetMaxY, gameScene);

            //Create Bubbles
            bubble = new List <Bubble>();
            bubble.Add(new Bubble(windowWidth / 4, -70.0f, 0.75f, gameScene));
            bubble.Add(new Bubble(windowWidth / 2, -42.0f, 0.25f, gameScene));
            bubble.Add(new Bubble((windowWidth / 4) * 3, -103.0f, 0.5f, gameScene));
            bubble.Add(new Bubble(windowWidth, -129.0f, 0.5f, gameScene));

            //Run the scene.
            Director.Instance.RunWithScene(gameScene, true);
        }
        public static void Initialize()
        {
            // Set up the graphics system
            graphics = new GraphicsContext();
            UISystem.Initialize(graphics);

            // Initiliaze a new scene
            scene = new Scene();

            // Build a play button
            Button play_btn = new Button();

            play_btn.X             = 50f;
            play_btn.Y             = 50f;
            play_btn.Width         = 50f;
            play_btn.Height        = 50f;
            play_btn.ButtonAction += HandlePlay_btnButtonAction;
            CustomButtonImageSettings play_btn_bg = new CustomButtonImageSettings();
            ImageAsset play_image = new ImageAsset("play.png");

            play_btn_bg.BackgroundNormalImage   = play_image;
            play_btn_bg.BackgroundDisabledImage = play_image;
            play_btn_bg.BackgroundPressedImage  = play_image;
            play_btn.CustomImage = play_btn_bg;
            play_btn.Style       = ButtonStyle.Custom;
            // Add the button to the scene
            scene.RootWidget.AddChildFirst(play_btn);


            // Build a Pause button
            Button pause_btn = new Button();

            pause_btn.X             = 120f;
            pause_btn.Y             = 50f;
            pause_btn.Width         = 50f;
            pause_btn.Height        = 50f;
            pause_btn.ButtonAction += HandlePause_btnButtonAction;
            CustomButtonImageSettings pause_btn_bg = new CustomButtonImageSettings();
            ImageAsset pause_image = new ImageAsset("pause.png");

            pause_btn_bg.BackgroundNormalImage   = pause_image;
            pause_btn_bg.BackgroundDisabledImage = pause_image;
            pause_btn_bg.BackgroundPressedImage  = pause_image;
            pause_btn.CustomImage = pause_btn_bg;
            pause_btn.Style       = ButtonStyle.Custom;
            // Add the button to the scene
            scene.RootWidget.AddChildFirst(pause_btn);


            // Build a Stop button
            Button stop_btn = new Button();

            stop_btn.X             = 190f;
            stop_btn.Y             = 50f;
            stop_btn.Width         = 50f;
            stop_btn.Height        = 50f;
            stop_btn.ButtonAction += HandleStop_btnButtonAction;
            CustomButtonImageSettings stop_btn_bg = new CustomButtonImageSettings();
            ImageAsset stop_image = new ImageAsset("stop.png");

            stop_btn_bg.BackgroundNormalImage   = stop_image;
            stop_btn_bg.BackgroundDisabledImage = stop_image;
            stop_btn_bg.BackgroundPressedImage  = stop_image;
            stop_btn.CustomImage = stop_btn_bg;
            stop_btn.Style       = ButtonStyle.Custom;
            // Add the button to the scene
            scene.RootWidget.AddChildFirst(stop_btn);

            // Set the scene
            UISystem.SetScene(scene, null);
        }
예제 #24
0
        public HUD(GraphicsContext graphics, int totalPlayerNum)
        {
            UISystem.Initialize(graphics);

            //decarations
            Scene scene = new Scene();
            Label lblName, lblScore, lblLocation, lblHP;

            characterName     = new List <Label>();
            characterHP       = new List <Label>();
            characterScore    = new List <Label>();
            characterLocation = new List <Label>();
            float colorRed = 1, colorGreen = 1, colorBlue = 1;
            int   labelSpacing = graphics.Screen.Rectangle.Width / Math.Max(totalPlayerNum, 1);

            //Loop to create a list of labels.
            for (int characterNum = 0; characterNum < totalPlayerNum; characterNum++)
            {
                if (characterNum == 0)
                {
                    colorRed   = 1;
                    colorGreen = 0;
                    colorBlue  = 0;
                }
                if (characterNum == 1)
                {
                    colorRed   = 0;
                    colorGreen = 1;
                    colorBlue  = 0;
                }
                if (characterNum == 2)
                {
                    colorRed   = 0;
                    colorGreen = 0;
                    colorBlue  = 1;
                }
                if (characterNum == 3)
                {
                    colorRed   = 1;
                    colorGreen = 1;
                    colorBlue  = 0;
                }

                //Name
                lblName                     = new Label();
                lblName.X                   = 0 + labelSpacing * (characterNum);
                lblName.Y                   = 10;
                lblName.Width               = graphics.Screen.Rectangle.Width / Math.Max(totalPlayerNum, 1);
                lblName.Text                = "Name: ";
                lblName.TextColor           = new UIColor(colorRed, colorGreen, colorBlue, 1);
                lblName.HorizontalAlignment = HorizontalAlignment.Center;
                scene.RootWidget.AddChildLast(lblName);
                characterName.Add(lblName);

                //HP
                lblHP                     = new Label();
                lblHP.X                   = 0 + labelSpacing * (characterNum);
                lblHP.Y                   = characterName[characterNum].Y + characterName[characterNum].Height;
                lblHP.Width               = graphics.Screen.Rectangle.Width / Math.Max(totalPlayerNum, 1);
                lblHP.Text                = "HP: X";
                lblHP.TextColor           = new UIColor(colorRed, colorGreen, colorBlue, 1);
                lblHP.HorizontalAlignment = HorizontalAlignment.Center;
                scene.RootWidget.AddChildLast(lblHP);
                characterHP.Add(lblHP);

                //Score
                lblScore                     = new Label();
                lblScore.X                   = 0 + labelSpacing * (characterNum);
                lblScore.Y                   = characterHP[characterNum].Y + characterHP[characterNum].Height;
                lblScore.Width               = graphics.Screen.Rectangle.Width / Math.Max(totalPlayerNum, 1);
                lblScore.Text                = "Score: 0";
                lblScore.TextColor           = new UIColor(colorRed, colorGreen, colorBlue, 1);
                lblScore.HorizontalAlignment = HorizontalAlignment.Center;
                scene.RootWidget.AddChildLast(lblScore);
                characterScore.Add(lblScore);

//				//where am I? (I now can show you where everyone is)
//				lblLocation = new Label();
//				lblLocation.X = 0 + labelSpacing * (characterNum);
//				lblLocation.Y = characterScore[characterNum].Y + characterScore[characterNum].Height;
//				lblLocation.Width = graphics.Screen.Rectangle.Width / Math.Max(totalPlayerNum,1);
//				lblLocation.Text = "";
//				lblLocation.TextColor = new UIColor (colorRed, colorGreen, colorBlue, 1);
//				lblLocation.HorizontalAlignment = HorizontalAlignment.Center;
//				scene.RootWidget.AddChildLast(lblLocation);
//				characterLocation.Add(lblLocation);
            }

            //where am I? (This is outside the loop because it should only render once.)
            pausedText       = new Label();
            pausedText.Width = 600;
            pausedText.X     = graphics.Screen.Rectangle.Width / 2 - pausedText.Width / 2;
            pausedText.Y     = graphics.Screen.Rectangle.Height / 2 - pausedText.Height / 2;
            pausedText.HorizontalAlignment = HorizontalAlignment.Center;
            pausedText.Text      = "";
            pausedText.TextColor = new UIColor(1, 0, 0, 1);
            scene.RootWidget.AddChildLast(pausedText);

            //			//where am I? (This is outside the loop because it should only render once.)
//			instructionText = new Label();
//			instructionText.X = 10;
//			instructionText.Y = graphics.Screen.Rectangle.Height - instructionText.Height - 10;
//			instructionText.Width = 800;
//			instructionText.Text = "Press 'Start' (keyboard X) to show location.";
//			instructionText.TextColor = new UIColor (1, 1, 1, 1);
//			scene.RootWidget.AddChildLast(instructionText);

//			//ammo on the screen count
//			ammoText = new Label();
//			ammoText.X = 10;
//			ammoText.Y = graphics.Screen.Rectangle.Height - instructionText.Height - 20;
//			ammoText.Width = 800;
//			ammoText.Text = "ammo: ";
//			ammoText.TextColor = new UIColor (1, 1, 1, 1);
//			scene.RootWidget.AddChildLast(ammoText);

            //set scene
            UISystem.SetScene(scene, null);
        }
예제 #25
0
        public void Initialize()
        {
            //initialize the director and set the clear colour to black
            Director.Initialize();
            Director.Instance.GL.Context.SetClearColor(Colors.Black);

            //set the viewport to the size of the offscreen framebuffer
            Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.GL.Context.SetViewport(0, 0, 960, 544);

            //loading fonts - currently not used
            UIFontMap    = new FontMap(new Font(FontAlias.System, 20, FontStyle.Bold));
            LargeFontMap = new FontMap(new Font(FontAlias.System, 48, FontStyle.Bold));

            //create a camera for the UI
            UICamera = new Camera2D(Director.Instance.GL, Director.Instance.DrawHelpers);
            UICamera.SetViewFromViewport();

            //make a map manager object
            MapManager.Instance = new MapManager();

            //make a new Game object
            Game.Instance = new Game();

            //make a new game over object
            GameOverScene.Instance = new GameOverScene();

            //make a new MainMenu object
            MainMenu.Instance = new MainMenu();

            //make a new PauseScene object
            PauseScene.Instance = new PauseScene();

            //make a new LevelSelectScene object
            LevelSelectScene.Instance = new LevelSelectScene();

            //make a tutorial object
            TutorialScene.Instance = new TutorialScene();



            Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.ReplaceScene(MainMenu.Instance);

            //timer object to measure amount of time it takes to render a frame
            timer = new System.Diagnostics.Stopwatch();

            //additional framebuffer
            offscreenBuffer = new FrameBuffer();

            //set the size of the framebuffer to be exactly the same as the vita's screen
            Texture2D tex2d = new Texture2D(960, 544, false, PixelFormat.Rgba, PixelBufferOption.Renderable);

            offscreenBuffer.SetColorTarget(tex2d, 0);


            //offscreenSprite to use as a back framebuffer
            offscreenSprite = new SpriteUV(new TextureInfo(tex2d));

            /*
             * For unknown reasons, the framebuffer needs to be scaled 2x and flipped to display correctly
             * the issue has been noted on Sony's forums but nobody knows the answer
             *
             * */
            offscreenSprite.Quad.S = new Vector2(2.0f, 2.0f);
            offscreenSprite.Quad.T = new Vector2(-1.0f, -1.0f);
            offscreenSprite.FlipV  = true;
            Support.LoadGameParameters();

            Support.screenWidth  = GraphicsContext.ScreenSizes [0].Width;
            Support.screenHeight = GraphicsContext.ScreenSizes [0].Height;


            //setup UI
            UISystem.Initialize(Director.Instance.GL.Context);
            UISystem.SetScene(new GameUI());
        }