Пример #1
0
        public Button(HUD h, Texture2D tex, ButtonClick c)
        {
            hud = h;
            position = Vector2.Zero;
            texture = tex;
            click = c;

            center = new Vector2(texture.Width / 2, texture.Height / 2);
        }
Пример #2
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);

            voxelModel = Content.Load<Model>("Models\\highPolyCube");
            voxelTex = Content.Load<Texture2D>("Textures\\whiteTexture");

            backdropModel = Content.Load<Model>("Models\\flatePlane");
            backdropTex = Content.Load<Texture2D>("Textures\\grid");

            aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

            //Backdrop stuffs
            backdrop = new Backdrop(backdropModel, voxelTex, Matrix.Identity);
            floor = new Floor(new Vector3(10f, 10f, 10f), Vector3.Zero, voxelTex);

            //Cursor stuffs
            voxelCursor = new Voxel(voxelModel, placementWorld,
                voxelTex, new Vector3(1.0f, 1.0f, 1.0f));
            voxelCursor.alpha = 0.7f;
            voxelCursor.scale = 1.001f;

            //HUD stuffs
            hud = new HUD(this, spriteBatch);
            hud.LoadContent(Content, GraphicsDevice);
        }