Ejemplo n.º 1
0
        public ScoreSheet(UILayer layer, Font font) : base(layer)
        {
            Font = font;
            fields.Clear();
            maxScale = new vec2(fullSize / smallSize);

            var rc = new ImageRenderComponent(layer.Gl, "Resource/Images/UI/Other/scorePaper2.png");

            RenderComponent       = rc;
            imgSize               = ((vec2)rc.Image.Size * smallSize).ScaleToScreen();
            Quad                  = new QuadMesh(imgSize);
            Transform.Translation = new vec2((-layer.UIFrameBuffer.BoundTexture.Size.x / 2) + (Quad.Size.x / 2) + screenPadding, smallSizeHeight);

            layer.AddComponent(this);

            Font.Size = 30 * Program.Settings.ScreenRatio.x * 1.5f;

            for (int i = 0; i < 18; i++)
            {
                var t = new SheetField(this, layer, Font, fieldFuncs[i], !nonLockableIndices.Contains(i), new vec2(fieldLocs[i * 2], -fieldLocs[i * 2 + 1]));
                fields.Add(t);
            }

            OnClick += SheetClicked;
            ClearFields();
        }
Ejemplo n.º 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);

            // TODO: use this.Content to load your game content here
            //image = Content.Load<Texture2D>("Images/winnie");

            gd.player.LoadContent();

            Texture2D            t   = Content.Load <Texture2D>("Images/platform");
            ImageRenderComponent irc = new ImageRenderComponent("platform", platform, ref t);

            platform.addComponent(irc);

            // Установить размер объекта
            platform.Size = new Vector2(t.Width, t.Height);  // TODO может быть перенести в конструктор компонента?

            platform.Position = new Vector2(50.0f, 400.0f);
        }