コード例 #1
0
 public StartMenuState(Engine.Font titleFont)
 {
     _title = new Text("Shooter", titleFont);
     _title.SetColor(new Color(0, 0, 0, 1));
     // Centerre on the x and place somewhere near the top
     _title.SetPosition(-_title.Width / 2, 300);
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: griffenclaw/Farm
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Engine game = new Engine())
     {
         game.Run();
     }
 }
コード例 #3
0
        public PredictionsModel(string team1, string team2)
        {
            m_Engine = new Engine.Engine();

            this.Team1 = m_Engine.TeamFromName(team1);
            this.Team2 = m_Engine.TeamFromName(team2);
        }
コード例 #4
0
        public SplashScreenState(StateSystem system, TextureManager textureManager, Engine.Font titleFont, SoundManager soundManager)
        {
            _system = system;

            //sound
            _soundManager = soundManager;
            _soundManager.MasterVolume(0.01f);

            //title font
            _title = new Text("Immune Cells vs. Invaders", titleFont);
            _title.SetColor(new Color(0, 0, 0, 1));
            _title.SetPosition(-_title.Width / 2, 300);

            // good guys
            _character1.Texture = textureManager.Get("phagocyte");
            _character1.SetScale(2, 2);
            _character1.SetPosition(-150, 100);

            //bad guys
            _invader1.Texture = textureManager.Get("tatoo_dye");
            _invader1.SetScale(2, 2);
            _invader1.SetPosition(200, 100);

            _invader2.Texture = textureManager.Get("parasite");
            _invader2.SetScale(2, 2);
            _invader2.SetPosition(200, 0);

               // _soundManager.PlaySound("intro_music");
        }
コード例 #5
0
        void BuildEngine()
        {
            var world = new Engine.World(Arena.FromFile("Res/arena1.txt"));

            engine = new Engine.Engine(world);
            engine.PlayerHitEvent += Engine_PlayerHitEvent;
        }
コード例 #6
0
        public MeshContainer(Engine.Serialize.Mesh M)
        {
            if (M != null)
            {
                LocalAABBMax = M.AABBMax;
                LocalAABBMin = M.AABBMin;

                VertexsCount = M.VertexCount;
                FaceCount = M.FaceCount;
                BytesPerVertex = M.VertexData.Length / VertexsCount;

                using (var vertices = new DataStream(BytesPerVertex * VertexsCount, true, true))
                {
                    vertices.WriteRange<byte>(M.VertexData, 0, M.VertexData.Length);
                    vertices.Position = 0;
                    Vertexs = new Buffer(ModelViewer.Program.device, vertices, BytesPerVertex * VertexsCount, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
                    binding = new VertexBufferBinding(Vertexs, BytesPerVertex, 0);
                }

                using (var indices = new DataStream(4 * FaceCount * 3, true, true))
                {
                    indices.WriteRange<byte>(M.IndexData, 0, M.IndexData.Length);
                    indices.Position = 0;
                    Indices = new Buffer(ModelViewer.Program.device, indices, 4 * FaceCount * 3, ResourceUsage.Default, BindFlags.IndexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
                }
            }
        }
コード例 #7
0
ファイル: Block.cs プロジェクト: beamery/bTris
 public Block(TextureManager textureManager, Engine.Color color, int gridPosX, int gridPosY)
 {
     sprite = new Sprite();
     sprite.Texture = textureManager.Get("block");
     sprite.SetScale(0.625, 0.625);
     sprite.SetColor(color);
     this.gridPosX = gridPosX;
     this.gridPosY = gridPosY;
 }
コード例 #8
0
ファイル: Program.cs プロジェクト: JasonCrease/FootPred
        static void Main(string[] args)
        {
            Engine.Engine engine = new Engine.Engine();

            Team team1 = engine.TeamFromName("Belgium");
            Team team2 = engine.TeamFromName("Italy");

            var probs     = engine.GetMatchProbs(team1, team2);
            var scoreGrid = engine.GetScoreGrid(team1, team2);
        }
コード例 #9
0
        public override void AddOutcome(Engine.Actions redAction, Engine.Actions blueAction, Engine.Players winner)
        {
            lastRedAction = redAction;
            lastBlueAction = blueAction;
            lastWinner = winner;

            if (winner == Engine.Players.NONE)
                ++draws;
            else
                draws = 0;
        }
コード例 #10
0
 public override Engine.Actions GetNextThrow(Engine.Players player)
 {
     if (lastWinner == player) {
         return lastWinner == Engine.Players.RED ? lastRedAction : lastBlueAction;
     } else {
         if (draws > 2)
             return ChooseRandom ();
         else
             return player == Engine.Players.RED ? WhatBeats (lastBlueAction) : WhatBeats (lastRedAction);
     }
 }
コード例 #11
0
        public MultiMeshContainer(Engine.Serialize.MeshesContainer MC)
        {
            if (MC != null)
            {
                //Transform = Matrix.Scaling(1);

                Hardpoints = MC.HardPoints;
                if (MC.Materials != null && MC.Geometry != null && MC.Geometry.Meshes != null)
                {
                    BSP = MC.Geometry.BSP;
                    LocalAABBMax = MC.Geometry.AABBMax;
                    LocalAABBMin = MC.Geometry.AABBMin;

                    Meshes = new Serialize.MeshLink[MC.Materials.Length];
                    Materials = new MaterialContainer[MC.Materials.Length];
                    for (int i = 0; i < MC.Materials.Length; i++)
                    {
                        Meshes[i] = MC.Geometry.Meshes[i];
                        Materials[i] = new MaterialContainer(MC.Materials[i]);
                    }

                    VertexsCount = MC.Geometry.VertexCount;
                    BytesPerVertex = MC.Geometry.VertexData.Length / VertexsCount;
                    FaceCount = MC.Geometry.IndexData.Length / 12;

                    using (var vertices = new DataStream(BytesPerVertex * VertexsCount, true, true))
                    {
                        vertices.WriteRange<byte>(MC.Geometry.VertexData, 0, MC.Geometry.VertexData.Length);
                        vertices.Position = 0;
                        Vertexs = new Buffer(ModelViewer.Program.device, vertices, BytesPerVertex * VertexsCount, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
                        binding = new VertexBufferBinding(Vertexs, BytesPerVertex, 0);
                    }

                    using (var indices = new DataStream(4 * FaceCount * 3, true, true))
                    {
                        indices.WriteRange<byte>(MC.Geometry.IndexData, 0, MC.Geometry.IndexData.Length);
                        indices.Position = 0;
                        Indices = new Buffer(ModelViewer.Program.device, indices, 4 * FaceCount * 3, ResourceUsage.Default, BindFlags.IndexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
                    }

                    BufferDescription bd = new BufferDescription();
                    bd.SizeInBytes = Marshal.SizeOf(typeof(ShaderConstants));
                    bd.Usage = ResourceUsage.Dynamic;
                    bd.BindFlags = BindFlags.ConstantBuffer;
                    bd.CpuAccessFlags = CpuAccessFlags.Write;
                    bd.OptionFlags = ResourceOptionFlags.None;
                    bd.StructureByteStride = 0;

                    constantsBuffer = new Buffer(ModelViewer.Program.device, bd);
                    constants = new ShaderConstants();
                }
            }
        }
コード例 #12
0
        public StartMenuState(Engine.Font titleFont, Engine.Font generalFont, Input input, StateSystem system)
        {
            _system = system;

            _generalFont = generalFont;
            _input = input;
            InitializeMenu();
            _title = new Text("Shooter", titleFont);
            _title.SetColor(new Color(0, 0, 0, 1));
            // Centerre on the x and place somewhere near the top
            _title.SetPosition(-_title.Width / 2, 300);
        }
コード例 #13
0
        public PauseGameState(Engine.Font titleFont, Engine.Font generalFont, Input input, StateSystem system)
        {
            _input = input;
            _system = system;
            _generalFont = generalFont;
            InitializeMenu();
            _title = new Text("Pause", titleFont);
            _title.SetColor(new Color(0, 0, 0, 1));

            // Center on x and move toward the top
            _title.SetPosition(-_title.Width / 2, 300);
        }
コード例 #14
0
        public StartMenuState(Engine.Font titleFont, Engine.Font generalFont, Input input, StateSystem system)
        {
            _system = system;
            _input = input;
            _generalFont = generalFont;
            InitializeMenu();

            _title = new Text("Immunity vs. Invaders", titleFont);
            _title.SetColor(new Color(0, 0, 0, 1));

            _title.SetPosition(-_title.Width / 2, 300);
        }
コード例 #15
0
ファイル: GLUtil.cs プロジェクト: iq110/csharpgameprogramming
 internal static void RenderPolygonFilled(Engine.PathFinding.ConvexPolygon polygon)
 {
     Gl.glBegin(Gl.GL_POLYGON);
     {
         foreach (Point p in polygon.Vertices)
         {
             GLUtil.DrawPointVertex(p);
         }
         GLUtil.DrawPointVertex(polygon.Vertices.First());
     }
     Gl.glEnd();
 }
コード例 #16
0
ファイル: Program.cs プロジェクト: dpetrova/OOP
        static void Main()
        {
            var buildingFactory = new BuildingFactory();
            var unitFactory     = new UnitFactory();
            var resourceFactory = new ResourceFactory();
            var reader          = new ConsoleReader();
            var writer          = new ConsoleWriter();
            var data            = new EmpiresData();

            var engine = new Engine.Engine(buildingFactory, resourceFactory, unitFactory, data, reader, writer);

            engine.Run();
        }
コード例 #17
0
        public Renderer(Input input, Engine.Engine e, int playerID)
        {
            this.input = input;
            engine     = e;
            pID        = playerID;
            cam        = new Camera(input.Viewport(), new Vector3(0.0f, 0.0f, 5.0f), new Vector3(0.0f, 0.0f, -1.0f));
            float x = 8.0f;
            float y = x / cam.AspectRatio;

            cam.Proj = Matrix4.CreateOrthographicOffCenter(-x, x, -y, y, -10.0f, 10.0f);
            //cam.Proj = Matrix4.CreatePerspectiveFieldOfView(OpenTK.MathHelper.DegreesToRadians(90), cam.AspectRatio, 0.01f, 10.0f);
            fontManager   = new FontManager(cam);
            worldRenderer = new WorldRenderer(e.World, cam, fontManager);
            tableRenderer = new TableRenderer();
        }
コード例 #18
0
        public StartMenuState(Engine.Font titleFont, Engine.Font generalFont, Input input, StateSystem system, TextureManager textureManager)
        {
            _system = system;

            _generalFont = generalFont;
            _input = input;
            _textureManager = textureManager;
            _blockManager = new BlockManager(_textureManager, 0, 0, new Vector(1, 1, 1));
            DropBlocks();
            InitializeMenu();
            _title = new Text("Subway Tetris", titleFont);
            _title.SetColor(new Color(0.85f, 0.85f, 0.10f, 1));
            // Centerre on the x and place somewhere near the top
            _title.SetPosition(-_title.Width / 2, 300);
        }
コード例 #19
0
        //Different from PieSliceSensorArray in that EnemyRobots are used as targets instead
        // of goal points. 
        public void update(Engine.Environment env, List<Robot> robots, CollisionManager cm)
        {
            List<float> translatedEnemyAngles = new List<float>();
            // Start at 1: Assume all robots after first are enemies
            for (int i = 1; i < robots.Count; i++)
            {
                EnemyRobot er = (EnemyRobot) robots[i];
                if (!er.stopped) // Only sense prey robots that are active
                {
                    Point2D temp = new Point2D((int)er.location.x, (int)er.location.y);

                    temp.rotate((float)-(owner.heading), owner.circle.p);  //((float)-(owner.heading * 180.0 / 3.14), owner.circle.p);

                    //translate with respect to location of navigator
                    temp.x -= (float)owner.circle.p.x;
                    temp.y -= (float)owner.circle.p.y;

                    //what angle is the vector between target & navigator
                    float angle = angleValue((float)temp.x, (float)temp.y);// (float)temp.angle();

                    translatedEnemyAngles.Add(angle);
                }
            }

            //fire the appropriate radar sensor
            for (int i = 0; i < radarAngles1.Count; i++)
            {
                signalsSensors[i].setSignal(0.0);

                for (int a = 0; a < translatedEnemyAngles.Count; a++)
                {
                    float angle = translatedEnemyAngles[a];

                    if (angle >= radarAngles1[i] && angle < radarAngles2[i])
                    {
                        signalsSensors[i].setSignal(1.0);
                    }

                    if (angle + 360.0 >= radarAngles1[i] && angle + 360.0 < radarAngles2[i])
                    {
                        signalsSensors[i].setSignal(1.0);
                    }
                }
            }

        }
コード例 #20
0
ファイル: game.cs プロジェクト: rvIceBreaker/Crawler
        /*static NativeWindow wnd;

        static GraphicsContext gp;*/
        static void Main()
        {
            //Stopwatch frameWatch = new Stopwatch();
            //frameWatch.Start();

            //Engine Init
            Engine.Engine engine = new Engine.Engine();
            engine.Initialize();
            /*//Setup window
            wnd = new NativeWindow(800, 600, "Game_GL", GameWindowFlags.Default, GraphicsMode.Default, DisplayDevice.Default);
            wnd.Visible = true;
            //Graphics context
            gp = new GraphicsContext(GraphicsMode.Default, wnd.WindowInfo);
            gp.MakeCurrent(wnd.WindowInfo);
            (gp as IGraphicsContextInternal).LoadAll();

            GL.Enable(EnableCap.DepthTest);
            GL.ClearColor(0.5f, 0.5f, 0.5f, 0);

            frameWatch.Start();

            //Frame
            while (wnd.Exists)
            {
                wnd.ProcessEvents();

                if (!Engine.Engine.mIsAlive)
                    wnd.Close();

                //Engine.Engine.mStartTime
                double seconds = frameWatch.Elapsed.Seconds;

                //engine.Frame(seconds);

                //Can't swap buffers if our context is invalid (no window handle)
                if(wnd.Exists)
                    gp.SwapBuffers();

                frameWatch.Reset();
                frameWatch.Start();
            }*/
        }
コード例 #21
0
        //per default we use the goal point of the environment as our target point. 
        public void update(Engine.Environment env, List<Robot> robots, CollisionManager cm)
        {
            Point2D temp = new Point2D((int)env.goal_point.x, (int)env.goal_point.y);

            temp.rotate((float)-(owner.heading), owner.circle.p);  //((float)-(owner.heading * 180.0 / 3.14), owner.circle.p);

            //translate with respect to location of navigator
            temp.x -= (float)owner.circle.p.x;
            temp.y -= (float)owner.circle.p.y;

            //what angle is the vector between target & navigator
            float angle = angleValue((float)temp.x, (float) temp.y);// (float)temp.angle();

        //!    angle *= 57.297f;//convert to degrees

            //fire the appropriate radar sensor
            for (int i = 0; i < radarAngles1.Count; i++)
            {
                signalsSensors[i].setSignal(0.0);
                //radar[i] = 0.0f;

                if (angle >= radarAngles1[i] && angle < radarAngles2[i])
                {
                    signalsSensors[i].setSignal(1.0);
                 //   Console.WriteLine(i);
                }
                //radar[i] = 1.0f;

                if (angle + 360.0 >= radarAngles1[i] && angle + 360.0 < radarAngles2[i])
                {
                    signalsSensors[i].setSignal(1.0);
                   // Console.WriteLine(i);
                }
//                    radar[i] = 1.0f;

                
               // inputs[sim_engine.robots[0].rangefinders.Count + i] = sim_engine.radar[i];

            }

        }
コード例 #22
0
 public PlayingState(StateSystem system, TextureManager manager, Input input, Engine.Font infoFont, Vector playArea, Vector clientSize)
 {
     _system = system;
     _textureManager = manager;
     _input = input;
     _infoFont = infoFont;
     _playArea = playArea;
     _clientSize = clientSize;
     InitializeMenu();
     _paused = false;
     _blockManager = new BlockManager(_textureManager, clientSize.X, clientSize.Y, new Vector(_scalingFactor, _scalingFactor, 0));
     if (_scalingFactor < 1.0 && _scalingFactor > 0.5)
     {
         _playArea.X += _blockManager.BlockWidth * _scalingFactor;
     }
     _blockManager.SetBounds(-(_playArea.Y), _playArea.Y, -(_playArea.X), _playArea.X);
     _scoreText = new Text("Score: " + _blockManager.CompletedRows, _infoFont);
     _scoreText.SetPosition((clientSize.X / 2) - 250, 0);
     _scoreText.SetColor(new Color(0.19f, 0.8f, 0.19f, 1));
     _pausedText = new Text("PAUSED", _infoFont);
     _pausedText.SetPosition(-_pausedText.Width/2, 250);
     _pausedText.SetColor(new Color(0.35f, 0.35f, 0.67f, 1));
     GameStart();
 }
コード例 #23
0
 public HelperPoint_Lamps( Engine.MapSystem.MapObject ownerEntity )
     : base(ownerEntity)
 {
     this.__ownerEntity = ownerEntity;
     ownerEntity.PostCreated += delegate( Engine.EntitySystem.Entity __entity, System.Boolean loaded ) { if( Engine.EntitySystem.LogicSystemManager.Instance != null )PostCreated( loaded ); };
 }
コード例 #24
0
 public virtual void AddOutcome(Engine.Actions redAction, Engine.Actions blueAction, Engine.Players winner)
 {
 }
コード例 #25
0
 public virtual Engine.Actions GetNextThrow(Engine.Players player)
 {
     return ChooseRandom ();
 }
コード例 #26
0
        public static void Main(string[] args)
        {
            if (args.Length == 3) {
                string redAI = args [0];
                string blueAI = args [1];
                int count = int.Parse (args [2]);

                Random stream = new Random ();

                Engine engine = new Engine ();
                LetItRideAI letItRideAI = new LetItRideAI (stream.Next());
                RandomAI randomAI = new RandomAI (stream.Next());

                RPSAI red = (redAI == "LetItRide" ? letItRideAI : randomAI);
                RPSAI blue = (blueAI == "LetItRide" ? letItRideAI : randomAI);

                int redWins = 0;
                int blueWins = 0;
                int draws = 0;

                for (int index = 0; index < count; ++index) {
                    Engine.Actions redAction = red.GetNextThrow (Engine.Players.RED);
                    Engine.Actions blueAction = blue.GetNextThrow (Engine.Players.BLUE);

                    Engine.Players winner = engine.Throw (redAction, blueAction);

                    switch (winner) {
                    case Engine.Players.NONE:
                        ++draws;
                        break;
                    case Engine.Players.RED:
                        ++redWins;
                        break;
                    case Engine.Players.BLUE:
                        ++blueWins;
                        break;
                    }

                    red.AddOutcome (redAction, blueAction, winner);
                    blue.AddOutcome (redAction, blueAction, winner);

                    string outcome = (winner == Engine.Players.NONE ? "Draw" : (winner == Engine.Players.RED ? "Red" : "Blue"));
                    Console.WriteLine (redAI + " " + blueAI + " " + count + " " + outcome);
                }

            } else {
                Console.WriteLine ("Usage: Engine.exe {LetItRide|Random} {LetItRide|Random} {count}");
            }
        }
コード例 #27
0
        private Engine.Actions WhatBeats(Engine.Actions play)
        {
            switch (play) {
            case Engine.Actions.ROCK: return Engine.Actions.PAPER;
            case Engine.Actions.PAPER: return Engine.Actions.SCISSORS;
            case Engine.Actions.SCISSORS: return Engine.Actions.ROCK;
            }

            return Engine.Actions.ROCK;
        }
コード例 #28
0
ファイル: MainWindow.cs プロジェクト: APCTGroup3/GPL
    void RunBtnClicked(object sender, EventArgs eventArgs)
    {
        //Execute the program

        string sourceCode = editor.Buffer.Text;

        if (sourceCode.Length > 1)
        {
            if (this.useNLPLexer)
            {
                // use the NLP lexer to format the code
                var             lines          = sourceCode.Split('\n');
                NLP_Lexer.Lexer nlpLexer       = new NLP_Lexer.Lexer("7DOTRBXV6DLL22FQUJRKOMSCOEUL5XG5"); // Create NLP Lexer with access token for wit.ai
                string          tempSourceCode = "";                                                      // Init
                foreach (var line in lines)                                                               //Loop through lines
                {
                    try {
                        tempSourceCode += nlpLexer.Tokenise(line); // Add wit ai output to sourcecode
                        Console.WriteLine(tempSourceCode);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
                // Make sure that there is code in ttempSourceCode before executing it
                if (tempSourceCode.Length > 0)
                {
                    sourceCode = tempSourceCode;
                }
            }

            // Start the exectuion

            CoreParser.Lexer lexer = new CoreParser.Lexer(sourceCode);
            try
            {
                // Tokenise
                lexer.Tokenise();
                List <Token> tokens = lexer.getTokenList();

                // Parse from returned token list
                CoreParser.Parser.Parser   parser = new CoreParser.Parser.Parser();
                CoreParser.Parser.AST.Node ast    = parser.Parse(tokens);

                // Execute the parse tree
                ParserEngine.Engine.Engine engine = new Engine.Engine();
                engine.Run(ast);

                // Display parse tree if user has toggled it
                if (this.useParseTreeDisplay)
                {
                    // Open a new window
                    GUI.ParseTreeDisplay parseTreeDisplay = new GUI.ParseTreeDisplay(ast);
                    parseTreeDisplay.Title = "Parse Tree";
                    parseTreeDisplay.ShowAll();
                }
            }
            // Display errors encountered during execution in alert
            catch (Exception e)
            {
                MessageDialog md = new MessageDialog(this,
                                                     DialogFlags.DestroyWithParent, MessageType.Error,
                                                     ButtonsType.Close, e.Message);
                md.Run();
                md.Destroy();
            }

            // Collect console output
            var consoleOutput = ConsoleOutput.Instance.GetOutput();
            if (consoleOutput != null)
            {
                // As long as there is console output, get the window and display it
                GUI.ConsoleWindow consoleWindow  = GUI.ConsoleWindow.Instance;
                ScrolledWindow    consoleWrapper = new ScrolledWindow(); // Make Console Window scrollable
                TextView          console        = new TextView();
                consoleWrapper.Add(console);
                consoleWindow.Add(consoleWrapper);

                // Write the console output to the console window
                foreach (var line in consoleOutput)
                {
                    // Write output to console window
                    console.Buffer.Text = console.Buffer.Text + "\n" + line;
                }
                consoleWindow.ShowAll();
            }
        }
    }
コード例 #29
0
 public void open_Click( Engine.UISystem.EButton sender )
 {
     Engine.EntitySystem.LogicClass __class = Engine.EntitySystem.LogicSystemManager.Instance.MapClassManager.GetByName( "Terminal_Welcome1" );
     Engine.EntitySystem.LogicSystem.LogicDesignerMethod __method = (Engine.EntitySystem.LogicSystem.LogicDesignerMethod)__class.GetMethodByName( "open_Click" );
     __method.Execute( this, new object[ 1 ]{ sender } );
 }
コード例 #30
0
 public void exit_Click( Engine.UISystem.EButton sender )
 {
     GameWorld.Instance.NeedWorldDestroy = true;
 }
コード例 #31
0
 public PathCreationState(Input input, PathData pathData, Engine.Font numberFont)
 {
     _input = input;
     _pathData = pathData;
     _font = numberFont;
 }
コード例 #32
0
ファイル: Block.cs プロジェクト: beamery/bTris
 public Block(TextureManager textureManager, Engine.Color color)
     : this(textureManager, color, 0, 0)
 {
 }
コード例 #33
0
ファイル: Engine.cs プロジェクト: ericrrichards/fps
        public Engine(EngineSetup setup = null)
        {
            XmlConfigurator.Configure();

            _loaded = false;
            _setup = new EngineSetup();
            if (setup != null) {
                _setup = setup;
            }
            _gEngine = this;

            var d3d = new Direct3D();
            var enumeration = new DeviceEnumeration(d3d);
            if (enumeration.ShowDialog() != DialogResult.OK) {
                ReleaseCom(d3d);
                return;
            }

            Window = new FpsForm {
                Name = "WindowClass",
                Text = _setup.Name,
                FormBorderStyle = enumeration.Windowed ? FormBorderStyle.FixedSingle : FormBorderStyle.None,
                Size = new Size(800, 600)
            };

            var pp = new PresentParameters {
                BackBufferWidth = enumeration.SelectedDisplayMode.Width,
                BackBufferHeight = enumeration.SelectedDisplayMode.Height,
                BackBufferFormat = enumeration.SelectedDisplayMode.Format,
                BackBufferCount = _setup.TotalBackBuffers,
                SwapEffect = SwapEffect.Discard,
                DeviceWindowHandle = Window.Handle,
                Windowed =  enumeration.Windowed,
                EnableAutoDepthStencil =  true,
                AutoDepthStencilFormat = Format.D24S8,
                FullScreenRefreshRateInHertz = enumeration.SelectedDisplayMode.RefreshRate,
                PresentationInterval = enumeration.VSync ? PresentInterval.Default :  PresentInterval.Immediate,
                Multisample = MultisampleType.None,
                MultisampleQuality = 0,
                PresentFlags = PresentFlags.None

            };
            enumeration.Dispose();

            _device = new Device(d3d, 0, DeviceType.Hardware, Window.Handle, CreateFlags.MixedVertexProcessing, pp);

            ReleaseCom(d3d);

            _device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Anisotropic);
            _device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Anisotropic);
            _device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear);

            var proj = Matrix.PerspectiveFovLH(
                (float) (Math.PI/4),
                (float)pp.BackBufferWidth/pp.BackBufferHeight,
                0.1f/_setup.Scale, 1000.0f/_setup.Scale
            );
            _device.SetTransform(TransformState.Projection, proj);
            _displayMode = new SlimDX.Direct3D9.DisplayMode {
                Width = pp.BackBufferWidth,
                Height = pp.BackBufferHeight,
                RefreshRate = pp.FullScreenRefreshRateInHertz,
                Format = pp.BackBufferFormat
            };
            _currentBackBuffer = 0;

            _sprite = new Sprite(_device);

            Window.Show();
            Window.Activate();
            _states = new List<State>();
            CurrentState = null;

            ScriptManager = new ResourceManager<Script>();

            Input = new Input(Window);

            if (_setup.StateSetup != null) {
                _setup.StateSetup();
            }

            _loaded = true;
            _running = true;
        }
コード例 #34
0
ファイル: MainForm.cs プロジェクト: whztt07/NeoAxisCommunity
		void AddTextWithShadow( GuiRenderer renderer, Engine.Renderer.Font font, string text, Vec2 position,
			HorizontalAlign horizontalAlign, VerticalAlign verticalAlign, ColorValue color )
		{
			Vec2 shadowOffset = 2.0f / renderer.ViewportForScreenGuiRenderer.DimensionsInPixels.Size.ToVec2();

			renderer.AddText( font, text, position + shadowOffset, horizontalAlign, verticalAlign,
				new ColorValue( 0, 0, 0, color.Alpha / 2 ) );
			renderer.AddText( font, text, position, horizontalAlign, verticalAlign, color );
		}
コード例 #35
0
ファイル: Block.cs プロジェクト: harvPrentiss/Subway-Tetris
 public void SetColor(Engine.Color color)
 {
     _sprite.SetColor(color);
 }