/// <summary>
        /// Constructor.
        /// </summary>
        public GameScreen(ScreenManager screenManager) : base(screenManager)
        {
            if (!(Game.Machine.Rasterizer is MathboxRenderer mathboxRenderer))
            {
                throw new Exception();
            }
            MathboxRenderer = mathboxRenderer;
            Alphanumerics   = new AlphanumericsRenderer(this);

            TransitionOnTime  = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            PauseAction = new InputAction(
                new Buttons[] { Buttons.Start, Buttons.Back },
                new Keys[] { Keys.Escape },
                true);
        }
            public ObjectRenderer(MathboxRenderer mathboxRenderer)
            {
                Parent             = mathboxRenderer;
                DisplayListManager = Parent.DisplayListManager;
                Memory             = Parent.Memory;

#if WIDESCREEN_STARS
                // load 123 stars from ROM starfield
                byte[] table = Parent.Machine.Mathbox.ROM[2];
                for (int n = 0; n < 123; n++)
                {
                    int   addr = 0x3140 + n * 8;
                    Int16 x    = (Int16)(table[addr & 0x1FFF] * 256 + table[(addr + 1) & 0x1FFF]); addr += 2;
                    Int16 y    = (Int16)(table[addr & 0x1FFF] * 256 + table[(addr + 1) & 0x1FFF]); addr += 2;
                    Int16 z    = (Int16)(table[addr & 0x1FFF] * 256 + table[(addr + 1) & 0x1FFF]); addr += 2;
                    Stars[n] = new Vector3(x, y, z);
                }

                // fill in the blanks with some more random stars
                PRNG r = new PRNG(0xDEAD);
                for (int n = 123; n < Stars.Length;)
                {
                    const int size  = 10000;
                    double    theta = 2 * Math.PI * r.NextDouble;
                    double    phi   = Math.Acos(1 - 2 * r.NextDouble);
                    double    x     = size * Math.Sin(phi) * Math.Cos(theta);
                    double    y     = size * Math.Sin(phi) * Math.Sin(theta);
                    double    z     = size * Math.Abs(Math.Cos(phi));
                    if (x < -3000 || x > 3500)
                    {
                        Vector3 v = new Vector3((float)x, (float)y, (float)z);
                        v.Normalize();
                        v         *= 10000;
                        Stars[n++] = v;
                    }
                }
#endif
            }
Beispiel #3
0
 public DisplayList(MathboxRenderer mathboxRenderer)
 {
     Primitives = new Primitive(mathboxRenderer);
 }
Beispiel #4
0
 public Manager(MathboxRenderer mathboxRenderer)
 {
     MathboxRenderer = mathboxRenderer;
     Pool            = new ResourcePool(mathboxRenderer);
     WIP             = Pool.Get();
 }
Beispiel #5
0
 public ResourcePool(MathboxRenderer mathboxRenderer)
 {
     MathboxRenderer = mathboxRenderer;
 }
Beispiel #6
0
 public Primitive(MathboxRenderer mathboxRenderer)
 {
     MathboxRenderer = mathboxRenderer;
     VertexBuffer    = new VertexBuffer(mathboxRenderer.Game.GraphicsDevice, typeof(VertexPositionColor), MaxVertices, BufferUsage.WriteOnly);
 }
 public TerrainRenderer(MathboxRenderer mathboxRenderer)
 {
     Parent             = mathboxRenderer;
     Memory             = Parent.Memory;
     DisplayListManager = Parent.DisplayListManager;
 }