示例#1
0
        private void SetupSubsystems()
        {
            var w      = (float)Game.Inst.Window.ClientRectangle.Width;
            var h      = (float)Game.Inst.Window.ClientRectangle.Height;
            var aspect = h / w;
            var wl     = -1.2f;
            var wr     = 1.2f;
            var wb     = -aspect;
            var wt     = aspect;

            var clearColor  = new Color(0xffffffff);// new Color(0xff708090);
            var worldBounds = new Rectangle(wt, wr, wb, wl);

            SetSubsystems(
                new LifetimeSubsystem(),

                new AISubsystem(),
                new InputSubsystem(),

                new PongControlsSubsystem(),

                new PhysicsSubsystem(worldBounds),

                new EffectsSubsystem(),
                m_GraphicsSubsystem = new GraphicsSubsystem()
            {
                ClearColor = clearColor
            }

#if DEBUG
                , new PerformanceInfoSubsystem()
#endif
                );
        }
示例#2
0
        private void createScene()
        {
            App = new Application();

            model      = App.SetModel <Model>();
            controller = App.SetController <Controller>();
            view       = App.AddView <View>();

            GraphicsSubsystem renderingP = App.AddSubSystem <GraphicsSubsystem>();

            // Model
            model.AddProcessor <UserUpdateProcessor>();
            model.AddProcessor <UserLateUpdateProcessor>();
            model.AddProcessor <CameraProcess>();

            // Controller
            List <Type> processorOrder = new List <Type>();

            processorOrder.Add(typeof(UserUpdateProcessor));
            processorOrder.Add(typeof(UserLateUpdateProcessor));
            processorOrder.Add(typeof(CameraProcess));
            controller.SetOrder(processorOrder);

            // View
            view.AddSubSystem(renderingP, 0);
        }
        private void MakeDefaultSystem()
        {
            // Controller에 프로세서를 연결하고 실행 순서를 지정합니다.
            controller.AddProcessor <UserUpdateProcessor>();
            controller.AddProcessor <UserLateUpdateProcessor>();
            controller.AddProcessor <RenderProcessor>();

            controller.SetOrder(typeof(UserUpdateProcessor), 0);
            controller.SetOrder(typeof(UserLateUpdateProcessor), 1);
            controller.SetOrder(typeof(RenderProcessor), 2);

            // Subsystem을 생성하고 View에 Subsystem을 추가합니다.
            GraphicsSubsystem gss = App.AddSubsystem <GraphicsSubsystem>();

            view.AddSubsystem(gss);
            view.SetOrder(gss, 0);
        }
        public MainWindow()
        {
            renderSubsystem = SimulationApplication.Instance.getApp().AddSubsystem <GraphicsSubsystem>();

            InitializeComponent();

            Window_ListBox.ItemsSource = list_ViewWindow;

            this.Sample_Button.Click += SampleButton_Click;

            this.SizeChanged     += MainWindow_SizeChanged;
            this.LocationChanged += MainWindow_LocationChanged;

            this.Closed += MainWindow_Closed;

            AddView();
        }
示例#5
0
        public void begin()
        {
            logger.info("begin");
            _graphics = CoreRegistry.require <GraphicsSubsystem>(GraphicsSubsystem.Uri);

            _entity = CoreRegistry.put(EntityManager.Uri, new EntityManager());

            _components = CoreRegistry.put(ComponentSystemManager.Uri, new ComponentSystemManager());
            _components.register(PhysicsSystem.Uri, new PhysicsSystem());
            _components.register(RenderSystem.Uri, new RenderSystem());

            _components.init();

            var id = _entity.create();

            var position = _entity.addComponent(id, "position", new Position());

            position.x = 1f;
            position.y = 1f;

            //var velocity = _entity.addComponent(id, "velocity", new Velocity());
            //velocity.x = 2;
            //velocity.y = 1.5f;


            var meshdata = new MeshData();

            meshdata.vertices = new Vector3[] { new Vector3(-1, 1, 0), new Vector3(0, -1, 0), new Vector3(1, 1, 0) };
            meshdata.indices  = new ushort[] { 0, 1, 2 };

            var mesh = new Mesh()
            {
                mesh = Assets.Assets.generateAsset(AssetType.MESH, meshdata)
            };

            _entity.addComponent(id, "mesh", mesh);
            //OpenGL.GL.Vertex2(-1.0f, 1.0f);
            //OpenGL.GL.Color3(Color.SpringGreen.r, Color.SpringGreen.g, Color.SpringGreen.b);
            //OpenGL.GL.Vertex2(0.0f, -1.0f);
            //OpenGL.GL.Color3(Color.Ivory.r, Color.Ivory.g, Color.Ivory.b);
            //OpenGL.GL.Vertex2(1.0f, 1.0f);
        }
        public MainWindow()
        {
            // renderSubsystem은 모든 View에 동일한 인스턴스를 등록할 것이므로 하나만 생성
            renderSubsystem = SimulationApplication.Instance.getApp().AddSubsystem <GraphicsSubsystem>();

            InitializeComponent();

            Window_ListBox.ItemsSource = list_ViewWindow;

            this.AddView_Button.Click    += AddViewButton_Click;
            this.RemoveView_Button.Click += RemoveViewButton_Click;
            this.RemoveAll_Button.Click  += RemoveAllButton_Click;
            this.Show_Button.Click       += ShowButton_Click;
            this.Hide_Button.Click       += HideButton_Click;
            this.Start_Button.Click      += StartButton_Click;
            this.Stop_Button.Click       += StopButton_Click;

            this.SizeChanged     += MainWindow_SizeChanged;
            this.LocationChanged += MainWindow_LocationChanged;

            this.Closed += MainWindow_Closed;
        }
示例#7
0
        /*-------------------------------------
         * CONSTRUCTORS
         *-----------------------------------*/

        public CameraShakeEffect(GraphicsSubsystem graphicsSubsystem, float duration = 0.3f) : base(duration)
        {
            m_GraphicsSubsystem = graphicsSubsystem;
        }