コード例 #1
0
ファイル: Application.cs プロジェクト: qmhoang/Ogui
        /// <summary>
        /// Called after Application.Start has been called.  Override and place application specific
        /// setup code here after calling base method.
        /// </summary>
        /// <param name="info"></param>
        protected virtual void Setup(ApplicationInfo info)
        {
            if (!string.IsNullOrEmpty(info.Font))
            {
                TCODConsole.setCustomFont(info.Font, (int)info.FontFlags);
            }

            FpsLimit        = info.FpsLimit;
            _fpsFrameLength = FpsLimit == 0 ? 0 : MilliSecondsPerSecond / FpsLimit;
            _lastDrawMilli  = 0;

            UpdatesPerSecondLimit = info.UpdatesPerSecondLimit;
            _upsFrameLength       = UpdatesPerSecondLimit == 0 ? 0 : MilliSecondsPerSecond / UpdatesPerSecondLimit;
            _lastUpdateMilli      = 0;

            _delayFps = FpsLimit > UpdatesPerSecondLimit;

            TCODSystem.setFps(FpsLimit);

            TCODConsole.initRoot(info.ScreenSize.Width, info.ScreenSize.Height, info.Title,
                                 info.Fullscreen, info.RendererType);
            TCODConsole.setKeyboardRepeat(info.InitialDelay, info.IntervalDelay);

            TCODMouse.showCursor(true);

            if (SetupEventHandler != null)
            {
                SetupEventHandler(this, EventArgs.Empty);
            }

            Pigments = new PigmentMap(DefaultPigments.FrameworkDefaults,
                                      info.Pigments);
        }
コード例 #2
0
 static void Main(string[] args)
 {
     TCODConsole.initRoot(80, 50, "Z-Day", false);
     TCODSystem.setFps(30);
     TCODMouse.showCursor(false);
     Game.Current = new Game();
     Game.Current.Initialize();
     Game.Current.Play();
 }
コード例 #3
0
        public void initialize(bool restarting)
        {
            Console.WriteLine("Initializing...");
            gameStatus = GameStatus.LOADING;
            TCODConsole.initRoot(screenWidth, screenHeight, "Janus Roguelike", false);

            TCODMouse.showCursor(true);

            menuGui = new GUI.MenuGui(screenWidth, screenHeight);

            levels = new Dictionary <int, Level>();

            gui        = new GUI.Gui();
            loadingGui = new GUI.LoadingGui();
            messageGui = new GUI.MessageGui();
            defeatGui  = new GUI.DefeatGui();
            debugCommands.initialize(this);

            levels.Add(FIRST_LEVEL, new Level());

            levelnr = FIRST_LEVEL;
            //currentLevel = new Level();
            if (FIRST_LEVEL == int.MaxValue)
            {
                currentLevel.initialize(restarting, FIRST_LEVEL, typeof(Generators.TestLevelGenerator));
            }
            else
            {
                currentLevel.initialize(restarting, FIRST_LEVEL);
            }

            changeLevel(FIRST_LEVEL);

            player = new Player();
            player.getDestructible().ressurect();

            player.x = map.startx; //assign player position
            player.y = map.starty;

            player.fov.update();
            if (actorHandler.getActor(0) != null)
            {
                actorHandler.actors.Remove(actorHandler.getActor(0));
            }
            actorHandler.addActor(player);

            Saver.load();

            Console.WriteLine("Initializing Complete");


            render();

            lastKey    = new TCODKey();
            gameStatus = GameStatus.STARTUP;
        }
コード例 #4
0
ファイル: Application.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        #endregion
        #region Protected Methods
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Called after Application.Start has been called.  Override and place application specific
        /// setup code here after calling base method.
        /// </summary>
        /// <param name="info"></param>
        protected virtual void Setup(ApplicationInfo info)
        {
            if (!string.IsNullOrEmpty(info.Font))
            {
                TCODConsole.setCustomFont(info.Font,
                                          (int)(TCODFontFlags.LayoutTCOD | TCODFontFlags.Grayscale));
            }

            TCODConsole.initRoot(info.ScreenSize.Width, info.ScreenSize.Height, info.Title,
                                 info.Fullscreen, TCODRendererType.SDL);

            TCODMouse.showCursor(true);

            if (SetupEventHandler != null)
            {
                SetupEventHandler(this, EventArgs.Empty);
            }

            Pigments = new PigmentMap(DefaultPigments.FrameworkDefaults,
                                      info.Pigments);
        }