Ejemplo n.º 1
0
        }                                                                         // value-copy for const correctness.

        #region Init
        public RogueForm()
        {
#if DEBUG
            if (null != s_ooao)
            {
                throw new InvalidOperationException("only one main form");
            }
#endif
            Logger.WriteLine(Logger.Stage.INIT_MAIN, "creating main form...");
            Logger.WriteLine(Logger.Stage.INIT_MAIN, "Form::InitializeComponent...");
            InitializeComponent();
            Text = SetupConfig.GAME_NAME + " - " + SetupConfig.GAME_VERSION;
            if (SetupConfig.Video == SetupConfig.eVideo.VIDEO_GDI_PLUS)
            {
                Text += " (GDI+)";
            }
            switch (SetupConfig.Sound)
            {
            case SetupConfig.eSound.SOUND_WAV:
                Text += " (sndWAV)";
                break;

            case SetupConfig.eSound.SOUND_NOSOUND:
                Text += " (nosound)";
                break;
            }
            Logger.WriteLine(Logger.Stage.INIT_MAIN, "Form::SetClientSizeCore...");
            SetClientSizeCore(RogueGame.CANVAS_WIDTH, RogueGame.CANVAS_HEIGHT);
            Logger.WriteLine(Logger.Stage.INIT_MAIN, "Form::SetStyle...");
            SetStyle(ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint, true);
            Logger.WriteLine(Logger.Stage.INIT_MAIN, "create font 1...");
            m_NormalFont = new Font("Lucida Console", 8.25f, FontStyle.Regular);
            Logger.WriteLine(Logger.Stage.INIT_MAIN, "create font 2...");
            m_BoldFont = new Font("Lucida Console", 8.25f, FontStyle.Bold);
            Logger.WriteLine(Logger.Stage.INIT_MAIN, "register with IRogueUI...");
            IRogueUI.UI = this;
            Logger.WriteLine(Logger.Stage.INIT_MAIN, "create RogueGame...");
            RogueGame.Init();
            Logger.WriteLine(Logger.Stage.INIT_MAIN, "bind form...");
            s_ooao = this;
            m_GameCanvas.FillGameForm();
            Logger.WriteLine(Logger.Stage.INIT_MAIN, "creating main form done.");
        }
Ejemplo n.º 2
0
 protected override void OnSizeChanged(EventArgs e)
 {
     base.OnSizeChanged(e);
     m_GameCanvas.FillGameForm();
     Invalidate(true);
 }