protected override void Initialize()
 {
     DrawingHelper.Initialize(GraphicsDevice);
     CONTENT_MANAGER.spriteBatch  = new SpriteBatch(GraphicsDevice);
     CONTENT_MANAGER.GameInstance = this;
     Primitive2DActionGenerator.CreateThePixel(CONTENT_MANAGER.spriteBatch);
     base.Initialize();
 }
        protected override void Initialize()
        {
            CONTENT_MANAGER.LocalRootPath = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Program)).Location);
            DrawingHelper.Initialize(GraphicsDevice);
            CONTENT_MANAGER.spriteBatch       = new SpriteBatch(GraphicsDevice);
            CONTENT_MANAGER.gameInstance      = this;
            CONTENT_MANAGER.CurrentInputState = new InputState(Mouse.GetState(), Keyboard.GetState());

            Primitive2DActionGenerator.CreateThePixel(CONTENT_MANAGER.spriteBatch);

            base.Initialize();
        }
Esempio n. 3
0
        public InputBox(string text, Point position, Vector2?size, SpriteFont font, Color foregroundColor, Color backgroundColor)
        {
            Text     = text;
            Position = position;
            if (size != null)
            {
                Size = size.Value;
            }
            else
            {
                //todo auto calculate rect's size
            }
            Font            = font;
            ForegroundColor = foregroundColor;
            BackgroundColor = backgroundColor;
            CursorPosition  = 0;
            maxTextLength   = FindMaxTextLength();
            textSpacing     = rect.Width / maxTextLength;
            ignoreCharacter = new List <char>();

            rectTexture = TextureRenderer.Render(CONTENT_MANAGER.spriteBatch, new Vector2(rect.Width, rect.Height), Vector2.Zero, backgroundColor, 1, Primitive2DActionGenerator.DrawRectangle(new Rectangle(0, 0, rect.Width, rect.Height), backgroundColor));

            CONTENT_MANAGER.GameInstance.Window.TextInput += TextInputHandler;
        }