コード例 #1
0
        /// <summary> Initializes the ConsoleGame. Creates the instance of a ConsoleEngine and starts the game loop. </summary>
        /// <param name="width">Width of the window.</param>
        /// <param name="height">Height of the window.</param>
        /// <param name="fontW">Width of the font.</param>
        /// <param name="fontH">´Height of the font.</param>
        /// <param name="m">Framerate mode to run at.</param>
        /// <see cref="FramerateMode"/> <see cref="ConsoleEngine"/>
        //public void Construct(int width, int height, int fontW, int fontH, FramerateMode m, int fontsize = 16, string font = "Consolas") {
        public void Construct(int width, int height, int fontW, int fontH, FramerateMode m, short?fontSize = null, string fontName = null)
        {
            TargetFramerate = 30;

            Engine = new ConsoleEngine(width, height, fontW, fontH, fontSize, fontName);
            Create();

            if (m == FramerateMode.Unlimited)
            {
                gameThread = new Thread(new ThreadStart(GameLoopUnlimited));
            }
            if (m == FramerateMode.MaxFps)
            {
                gameThread = new Thread(new ThreadStart(GameLoopLocked));
            }
            Running = true;
            gameThread.Start();

            // gör special checks som ska gå utanför spelloopen
            // om spel-loopen hänger sig ska man fortfarande kunna avsluta
            while (Running)
            {
                CheckForExit();
            }
        }
コード例 #2
0
ファイル: ModelRenderer.cs プロジェクト: ktos/Rex-1
        public ModelRenderer(ConsoleEngine engine)
        {
            lightDirection = Vector3.Normalize(lightDirection);

            CameraPosition = StartingCameraPosition;
            CameraRotation = 0.0f;

            CameraForward = new Vector3(0, 0, 1);
            CameraLeft    = new Vector3(0, 0, 1);
            CameraRight   = new Vector3(0, 0, -1);

            this.consoleHeight = engine.WindowSize.Y;
            this.consoleWidth  = engine.WindowSize.X;
            this.Engine        = engine;

            aspectRatio = (float)consoleHeight / (float)consoleWidth;

            projectionMatrix = Matrix.ProjectionMatrix(fov, aspectRatio, near, far);
        }
コード例 #3
0
 public SimpleTimingWorker(TimingMaster timingMaster, string workerName, ConsoleGameEngine.ConsoleEngine engine) : base(timingMaster)
 {
     this.workerName = workerName;
     this.engine     = engine;
 }
コード例 #4
0
 public AnimationRenderer(ConsoleEngine engine)
 {
     this.engine = engine;
     batch       = new List <Animation>();
 }