コード例 #1
0
ファイル: GamePage.xaml.cs プロジェクト: jayhxmo/twerkopter
        public GamePage(LaunchActivatedEventArgs args)
        {
            this.InitializeComponent();

            // Create the game.
            _game = XamlGame<MainGame>.Create(args, Window.Current.CoreWindow, this);
        }
コード例 #2
0
ファイル: MainGame.cs プロジェクト: jayhxmo/twerkopter
        /// <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()
        {
            this.IsMouseVisible = true;

            // TODO: Add your initialization logic here
            viewport = GraphicsDevice.Viewport;

            me = this;

            ButtonSize = new Vector2(viewport.Width * 0.12f, viewport.Width * 0.06f);

            playLocation = new Vector2((viewport.Width / 2) - ButtonSize.X - (viewport.Height / 40), viewport.Height * 0.6f);
            rateLocation = new Vector2((viewport.Width / 2) + (viewport.Height / 40), viewport.Height * 0.6f);

            player = new Player(viewport);
            obstacles = new Obstacles(viewport);

            ScoreboardSize = new Vector2(viewport.Width * .4f, (viewport.Width * .4f) / 124 * 76);
            ScoreboardLocation = new Vector2((viewport.Width - ScoreboardSize.X) / 2, viewport.Height);

            MedalSize = new Vector2(70 * ScoreboardSize.Y / 194);
            MedalLocation = new Vector2(27 * (ScoreboardSize.X / 320), 76 * (ScoreboardSize.Y / 194));

            base.Initialize();
        }