コード例 #1
0
        void mouseClicked(int x, int y)
        {
            Rectangle mouseClickedRect = new Rectangle(x, y, 10, 10);
            Rectangle startButtonRect = new Rectangle((int)startButtonPosition.X, (int)startButtonPosition.Y,125, 40);
            Rectangle highScoreButtonRect = new Rectangle((int)highScoreButtonPosition.X, (int)highScoreButtonPosition.Y, 200, 40);
            Rectangle aboutButtonRect = new Rectangle((int)aboutButtonPosition.X, (int)aboutButtonPosition.Y, 135, 40);

            Console.WriteLine(GraphicsDevice.Viewport.Width + "  " +GraphicsDevice.Viewport.Height);
            if (mouseClickedRect.Intersects(startButtonRect))
            {
                screen = playScreen;
            }
            else if (mouseClickedRect.Intersects(highScoreButtonRect))
            {
                screen = highScoreScreen;
            }
            else if (mouseClickedRect.Intersects(aboutButtonRect))
            {
                screen = aboutScreen;
            }
        }
コード例 #2
0
 public void afterEvent(object obj, EventArgs e)
 {
     Console.WriteLine("halo");
     screen = null;
 }
コード例 #3
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);

            highScoreScreen = new HighScoreScreen(this.Content, new EventHandler(afterEvent));
            playScreen = new Playing(this.Content, new EventHandler(afterEvent), GraphicsDevice);
            aboutScreen = new About(this.Content, new EventHandler(afterEvent));

            screen = null;

            backgroundImage = Content.Load<Texture2D>(@"picture/keliling indonesia");
            startButton = Content.Load<Texture2D>(@"picture/button main");
            startButtonPosition = new Vector2(350, 260);

            highScoreButton = Content.Load<Texture2D>(@"picture/button nilai tertinggi");
            highScoreButtonPosition = new Vector2(305, 310);

            aboutButton = Content.Load<Texture2D>(@"picture/button tentang");
            aboutButtonPosition = new Vector2(335, 360);

            puzzleFont = Content.Load<Texture2D>(@"picture/tulisan puzzle");
            // TODO: use this.Content to load your game content here
        }