Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Buttons
            MyGraphics.AddTexture("btn_practice", Content.Load <Texture2D>("Images/Buttons/practice"));
            MyGraphics.AddTexture("btn_close", Content.Load <Texture2D>("Images/Buttons/X"));
            MyGraphics.AddTexture("btn_TimeAttack", Content.Load <Texture2D>("Images/Buttons/TimeAttack"));
            MyGraphics.AddTexture("btn_Survival", Content.Load <Texture2D>("Images/Buttons/survival"));

            // Images
            MyGraphics.AddTexture("title", Content.Load <Texture2D>("Images/title2"));
            MyGraphics.AddTexture("g_up", Content.Load <Texture2D>("Images/up"));
            MyGraphics.AddTexture("g_down", Content.Load <Texture2D>("Images/down"));
            MyGraphics.AddTexture("g_left", Content.Load <Texture2D>("Images/left"));
            MyGraphics.AddTexture("g_right", Content.Load <Texture2D>("Images/right"));
            MyGraphics.AddTexture("g_peace", Content.Load <Texture2D>("Images/peace"));

            // Backgorund
            MyGraphics.AddTexture("mnu_back", Content.Load <Texture2D>("Images/MenuBackground"));
            MyGraphics.AddTexture("mnu_backcloud", Content.Load <Texture2D>("Images/BackCloud"));

            // Fonts
            MyFonts.AddFont("test", Content.Load <SpriteFont>("Fonts/Font"));
            MyFonts.AddFont("f_countdown", Content.Load <SpriteFont>("Fonts/fCountdown"));
            MyFonts.AddFont("f_time", Content.Load <SpriteFont>("Fonts/fTime"));
            MyFonts.AddFont("f_opac", Content.Load <SpriteFont>("Fonts/fOpac"));
        }
Пример #2
0
        public void Draw()
        {
            // Draw Background
            MyGraphics.sb.Draw(MyGraphics.GetTexture("mnu_back"), MyGraphics.screenRect, Color.White);
            MyGraphics.sb.Draw(MyGraphics.GetTexture("mnu_backcloud"), MyGraphics.screenRect, Color.White);

            switch (state)
            {
            case SurvivalState.Start:
                MyGraphics.sb.DrawString(MyFonts.GetFont("f_time"), "THUMBS UP TO START!",
                                         new Vector2(MyGraphics.screenRect.Center.X - 500, 50), Color.White);
                MyGraphics.sb.Draw(MyGraphics.GetTexture("g_up"), vGestLoc, Color.White);

                break;

            case SurvivalState.Count:
                MyGraphics.sb.DrawString(MyFonts.GetFont("f_countdown"), clCountDown.SecondsLeft.ToString(),
                                         new Vector2((MyGraphics.screenRect.Width / 2) - 150,
                                                     MyGraphics.screenRect.Height / 4), Color.White);
                break;

            case SurvivalState.Game:
                DrawGame();
                break;

            case SurvivalState.Finish:
                break;

            default:
                break;
            }
        }
Пример #3
0
        public void Draw()
        {
            MyGraphics.sb.Draw(MyGraphics.GetTexture("mnu_back"), MyGraphics.screenRect, Color.White);
            MyGraphics.sb.Draw(MyGraphics.GetTexture("mnu_backcloud"), rBackCloud, Color.White);
            MyGraphics.sb.Draw(MyGraphics.GetTexture("title"), vTitle, Color.White);

            MyGraphics.sb.Draw(MyGraphics.GetTexture("btn_practice"), rPractice, Color.White);
            MyGraphics.sb.Draw(MyGraphics.GetTexture("btn_TimeAttack"), rTimeAttack, Color.White);
            MyGraphics.sb.Draw(MyGraphics.GetTexture("btn_close"), rClose, Color.White);
            MyGraphics.sb.Draw(MyGraphics.GetTexture("btn_Survival"), rSurvival, Color.White);
        }
Пример #4
0
        public void DrawGame()
        {
            if (clTimer.isRunning)
            {
                MyGraphics.sb.DrawString(MyFonts.GetFont("f_time"), clTimer.SecondsLeft.ToString(), vTime, Color.White);
                MyGraphics.sb.DrawString(MyFonts.GetFont("f_time"), "SCORE:" + nScore.ToString(), new Vector2(10, 0), Color.White);

                //if (bAddSec)
                //{
                //    MyGraphics.sb.DrawString(MyFonts.GetFont("f_opac"), clTimer.SecondsLeft.ToString(), vTime, Color.White);
                //}

                switch (currGesture)
                {
                case PXCMGesture.Gesture.Label.LABEL_NAV_SWIPE_DOWN:
                    break;

                case PXCMGesture.Gesture.Label.LABEL_NAV_SWIPE_LEFT:
                    MyGraphics.sb.Draw(MyGraphics.GetTexture("g_left"), vGestLoc, Color.White);
                    break;

                case PXCMGesture.Gesture.Label.LABEL_NAV_SWIPE_RIGHT:
                    MyGraphics.sb.Draw(MyGraphics.GetTexture("g_right"), vGestLoc, Color.White);
                    break;

                case PXCMGesture.Gesture.Label.LABEL_NAV_SWIPE_UP:
                    break;

                case PXCMGesture.Gesture.Label.LABEL_POSE_BIG5:
                    break;

                case PXCMGesture.Gesture.Label.LABEL_POSE_PEACE:
                    MyGraphics.sb.Draw(MyGraphics.GetTexture("g_peace"), vGestLoc, Color.White);
                    break;

                case PXCMGesture.Gesture.Label.LABEL_POSE_THUMB_DOWN:
                    MyGraphics.sb.Draw(MyGraphics.GetTexture("g_down"), vGestLoc, Color.White);
                    break;

                case PXCMGesture.Gesture.Label.LABEL_POSE_THUMB_UP:
                    MyGraphics.sb.Draw(MyGraphics.GetTexture("g_up"), vGestLoc, Color.White);
                    break;

                default:
                    break;
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            MyGraphics.Init(spriteBatch, graphics);
            InputUtils.Init();
            MyMouse.Init();

            // Game Vars
            state = GameState.Menu;

            // Screens
            screenMenu     = new Menu();
            screenSurvival = new Survival();

            // Init Screens
            screenMenu.Init();
            screenSurvival.Init();
        }
Пример #6
0
        public void Init()
        {
            // Init Rectangles
            rPractice = new Rectangle(MyGraphics.screenRect.Right - MyGraphics.GetTexture("btn_practice").Bounds.Width, 100,
                                      MyGraphics.GetTexture("btn_practice").Width, MyGraphics.GetTexture("btn_practice").Height);
            rTimeAttack = new Rectangle(MyGraphics.screenRect.Left + 30, 50,
                                        MyGraphics.GetTexture("btn_TimeAttack").Width, MyGraphics.GetTexture("btn_TimeAttack").Height);
            rSurvival = new Rectangle(MyGraphics.screenRect.Width / 2 - (MyGraphics.GetTexture("btn_Survival").Width / 2), 0,
                                      MyGraphics.GetTexture("btn_Survival").Width, MyGraphics.GetTexture("btn_Survival").Height);
            rBackCloud = MyGraphics.screenRect;
            rClose     = new Rectangle(MyGraphics.screenRect.Right - MyGraphics.GetTexture("btn_close").Width, 0,
                                       MyGraphics.GetTexture("btn_close").Width, MyGraphics.GetTexture("btn_close").Height);
            vTitle = new Vector2((MyGraphics.screenRect.Width / 2) - (MyGraphics.GetTexture("title").Width / 2),
                                 MyGraphics.screenRect.Top);

            // Init MenuState
            msState = MenuState.Idle;
        }
Пример #7
0
        public void Init()
        {
            clCountDown = new ClockTimer();
            clTimer     = new ClockTimer();
            state       = SurvivalState.Start;
            nScore      = 0;
            bAddSec     = false;

            gestList = new List <PXCMGesture.Gesture.Label>()
            {
                PXCMGesture.Gesture.Label.LABEL_NAV_SWIPE_LEFT,
                PXCMGesture.Gesture.Label.LABEL_NAV_SWIPE_RIGHT,
                PXCMGesture.Gesture.Label.LABEL_POSE_THUMB_UP,
                PXCMGesture.Gesture.Label.LABEL_POSE_THUMB_DOWN,
                PXCMGesture.Gesture.Label.LABEL_POSE_PEACE
            };

            vGestLoc = new Vector2((MyGraphics.screenRect.Width / 2) - (MyGraphics.GetTexture("g_up").Width / 2),
                                   MyGraphics.screenRect.Height / 5);
            vTime = new Vector2((MyGraphics.screenRect.Right - 150), 0);
        }