“无法激活窗口的上下文”对于有效的SFML 2.0代码

时间:2013-05-27 08:20:56

标签: c# tfs sfml

出于某种原因,我一直在控制台中收到此错误:

failed to activate window's context

渲染窗口显示,它像往常一样全黑,但没有渲染任何内容。代码正常工作,但这来自Team Foundation Server。我无法弄清楚问题是什么:

using System;
using System.Collections.Generic;
using SFML.Audio;
using SFML.Graphics;
using SFML.Window;

namespace Engine
{
    class Program
    {
        //Test SFML Application
        public static void Main(String[] args)
        {
            RenderWindow window = new RenderWindow(new VideoMode(800, 600, 32), "FrostPlate Engine");
            Text t = new Text();
            Font f = new Font("C:/Windows/Fonts/Times New Roman.ttf");
            t.DisplayedString = "FrostPlate Engine";
            t.Font = f;
            t.Color = Color.White;


            FloatRect rect = t.GetLocalBounds();
            t.Origin = new Vector2f(rect.Width / 2, rect.Height / 2);
            t.Position = new Vector2f(window.Size.X / 2, window.Size.Y);

            while (window.IsOpen())
            {
                window.DispatchEvents();
                window.Clear();
                window.Draw(t);
                window.Display();
            }
        }
    }
}

任何人都知道我如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我正在与Vipar合作(他离线atm)。只是为了让你们知道这个错误实际上不再阻止程序工作...从我能说的。但它仍然是一个烦恼。该程序对窗口事件等反应良好,但无法创建该像素格式。