コード例 #1
0
        static void Main(string[] args)
        {
            WindowCreateInfo windowCI = new WindowCreateInfo()
            {
                X            = 100,
                Y            = 100,
                WindowWidth  = 960,
                WindowHeight = 540,
                WindowTitle  = "Veldrid Tutorial"
            };
            Sdl2Window window = VeldridStartup.CreateWindow(ref windowCI);

            _graphicsDevice = VeldridStartup.CreateGraphicsDevice(window);

            textRenderer = new TextRender.TextRenderer(_graphicsDevice);
            text         = new Text(textRenderer, "Hello world!")
            {
                Position = new Vector2(200, 100),
                FontSize = 24,
                Color    = RgbaFloat.White
            };
            text.Initialize();

            text2 = new Text(textRenderer, "Test")
            {
                Position  = new Vector2(400, 150),
                FontSize  = 36,
                FontStyle = FontStyle.Bold,
                FontName  = "Courier New",
                Color     = RgbaFloat.Yellow
            };
            text2.Initialize();

            CreateResources();

            while (window.Exists)
            {
                window.PumpEvents();

                if (window.Exists)
                {
                    Draw();
                    Thread.Sleep(1);
                }
            }

            DisposeResources();
        }