コード例 #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            // TODO: Add your drawing code here
            Plasmacore.draw();

            base.Draw(gameTime);
        }
コード例 #2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                back_pressed = true;
                Plasmacore.on_key(true, 27, true);
            }
            else if (back_pressed)
            {
                back_pressed = false;
                Plasmacore.on_key(false, 27, true);
            }

            foreach (TouchLocation loc in TouchPanel.GetState())
            {
                int id = loc.Id;
                int index;
                if (touch_indices.ContainsKey(id))
                {
                    index = touch_indices[id];
                }
                else
                {
                    index             = touch_indices.Count + 1;
                    touch_indices[id] = index;
                }

                if (loc.State == TouchLocationState.Pressed)
                {
                    Plasmacore.on_mouse_button_press(index, loc.Position.X, loc.Position.Y, 1);
                }
                else if (loc.State == TouchLocationState.Moved)
                {
                    Plasmacore.on_mouse_move_absolute(index, loc.Position.X, loc.Position.Y);
                }
                else if (loc.State == TouchLocationState.Released)
                {
                    Plasmacore.on_mouse_button_release(index, loc.Position.X, loc.Position.Y, 1);
                    touch_indices.Remove(id);
                }
            }

            Plasmacore.update();

            base.Update(gameTime);
        }
コード例 #3
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()
        {
            // TODO: Add your initialization logic here
            Plasmacore.configure(Content, GraphicsDevice,
                                 PlasmacoreSettings.display_width, PlasmacoreSettings.display_height);

            Accelerometer accelerometer = new Accelerometer();

            try
            {
                accelerometer.Start();
                accelerometer.ReadingChanged += new EventHandler <AccelerometerReadingEventArgs>(
                    AccelerometerReadingChanged);
            }
            catch (Exception)
            {
            }

            base.Initialize();
        }
コード例 #4
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     Plasmacore.launch();
 }