示例#1
0
        public TestForm()
        {
            InitializeComponent();

            this.perspectiveViewPictureBox.MouseWheel += perspectiveViewPictureBox_MouseWheel;
            this.KeyPreview           = true;
            this.zoomTrackBar.Visible = false;
            this.perspectiveViewPictureBox.BackColor = Color.Black;

            ResourceLoader loader = new ResourceLoader("en-en");

            loader.RegisterString("login_title", "Connect to server");
            loader.RegisterString("login_login", "Login");
            loader.RegisterString("login_password", "Password");
            loader.RegisterString("login_local", "Custom server");
            loader.RegisterString("login_register", "Register new account");
            loader.RegisterString("login_connect", "Connect");
            loader.RegisterString("dialog_title", "Dialog");
            loader.RegisterString("dialog_text", "Dialog text that could be very long,\nwith |caaaaaadifferent|r |c336699colors|r, languages ({0}) and may even contain |tsettings_icon:64:64|t images.");
            loader.RegisterString("button_yes", "Yes");
            loader.RegisterString("button_no", "Yes!");

            m_windowController         = new WinFormsController(perspectiveViewPictureBox.Width, perspectiveViewPictureBox.Height, 1.5f, 0.85f, false, "assets");
            m_windowController.OnInit += HandleOnInit;

            m_windowController.RegisterSpriteAtlas("assets/font5.bin");

            WidgetManager.LoadUI(System.IO.File.ReadAllText("assets/ui.xml"));

            updateTimer.Start();
        }
示例#2
0
        public TestForm()
        {
            InitializeComponent();

            this.KeyPreview = true;
            this.perspectiveViewPictureBox.BackColor = Color.Black;
            perspectiveViewPictureBox.Paint         += delegate { UpdateDrawFps(); };

            ResourceLoader loader = new ResourceLoader("en-en");

            loader.RegisterString("login_title", "Connect to server");
            loader.RegisterString("login_login", "Login");
            loader.RegisterString("login_password", "Password");
            loader.RegisterString("login_local", "Custom server");
            loader.RegisterString("login_register", "Register new account");
            loader.RegisterString("login_connect", "Connect");
            loader.RegisterString("dialog_title", "Dialog");
            loader.RegisterString("dialog_text", "Dialog text that could be very long,\nwith |caaaaaadifferent|r |c336699colors|r, languages ({0}) and may even contain |tsettings_icon:64:64|t images.");
            loader.RegisterString("button_yes", "Yes");
            loader.RegisterString("button_no", "Yes!");
            loader.RegisterString("tooltip_connect", "Start connection");

            m_windowController         = new WinFormsController(perspectiveViewPictureBox.Width, perspectiveViewPictureBox.Height, 1.5f, 0.6f, false, "assets");
            m_windowController.OnInit += HandleOnInit;

            m_windowController.RegisterSpriteAtlas("assets/font5.bin");

            WidgetManager.LoadUI(System.IO.File.ReadAllText("assets/ui.xml"));

            this.perspectiveViewPictureBox.Init(m_windowController);

            m_updateDelegate = new Action(DoUpdate);

            const int targetFps = 60;

            m_averageFrameTime = m_averageFrameUpdateTime = 1000.0f / targetFps;
            m_lastFrameDraw    = m_lastFrameUpdate = Environment.TickCount; // unprecise timer
            m_updateTimer      = new System.Threading.Timer(delegate { BeginInvoke(m_updateDelegate); UpdateUpdateFps(); }, null, 500, (int)m_averageFrameTime);
        }