Example #1
0
            /// <inheritdoc/>
            public void SetWindow(CoreWindow window)
            {
                this.window = window;

                // Safely dispose any previous instance
                RemoveAndDispose(ref deviceManager);
                RemoveAndDispose(ref target);
                RemoveAndDispose(ref cubeRenderer);

                // Creates a new DeviceManager (Direct3D, Direct2D, DirectWrite, WIC)
                deviceManager = ToDispose(new DeviceManager());

                // Use CoreWindowTarget as the rendering target (Initialize SwapChain, RenderTargetView, DepthStencilView, BitmapTarget)
                target = ToDispose(new CoreWindowTarget(window));

                // New CubeRenderer
                cubeRenderer = ToDispose(new CubeRenderer());
                var fpsRenderer = new FpsRenderer();

                // Add Initializer to device manager
                deviceManager.OnInitialize += target.Initialize;
                deviceManager.OnInitialize += cubeRenderer.Initialize;
                deviceManager.OnInitialize += fpsRenderer.Initialize;

                // Render the cube within the CoreWindow
                target.OnRender += cubeRenderer.Render;
                target.OnRender += fpsRenderer.Render;

                // Initialize the device manager and all registered deviceManager.OnInitialize
                deviceManager.Initialize(DisplayProperties.LogicalDpi);
            }
Example #2
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            // Place the frame in the current Window and ensure that it is active
            var swapChainPanel = new MainPage();

            Window.Current.Content = swapChainPanel;
            Window.Current.Activate();

            // Safely dispose any previous instance
            // Creates a new DeviceManager (Direct3D, Direct2D, DirectWrite, WIC)
            deviceManager = new DeviceManager();

            // New CubeRenderer
            renderer = new ShapeRenderer();
            var fpsRenderer = new FpsRenderer();

            // Use CoreWindowTarget as the rendering target (Initialize SwapChain, RenderTargetView, DepthStencilView, BitmapTarget)
            target = new SwapChainBackgroundPanelTarget(swapChainPanel);

            // Add Initializer to device manager
            deviceManager.OnInitialize += target.Initialize;
            deviceManager.OnInitialize += renderer.Initialize;
            deviceManager.OnInitialize += fpsRenderer.Initialize;

            // Render the cube within the CoreWindow
            target.OnRender += renderer.Render;
            target.OnRender += fpsRenderer.Render;

            // Initialize the device manager and all registered deviceManager.OnInitialize
            deviceManager.Initialize(DisplayProperties.LogicalDpi);

            // Setup rendering callback
            CompositionTarget.Rendering += CompositionTarget_Rendering;

            // Callback on DpiChanged
            DisplayProperties.LogicalDpiChanged += DisplayProperties_LogicalDpiChanged;
        }
Example #3
0
        public MPSCBP()
        {
            this.InitializeComponent();

            effectRenderer = new EffectRenderer(root, root);
            var fpsRenderer = new FpsRenderer();

            d2dTarget           = new SwapChainBackgroundPanelTarget(root);
            d2dTarget.OnRender += effectRenderer.Render;
            d2dTarget.OnRender += fpsRenderer.Render;

            deviceManager = new DeviceManager();
            deviceManager.OnInitialize += d2dTarget.Initialize;
            deviceManager.OnInitialize += effectRenderer.Initialize;
            deviceManager.OnInitialize += fpsRenderer.Initialize;

            deviceManager.Initialize(DisplayProperties.LogicalDpi);

            // Setup rendering callback
            CompositionTarget.Rendering += CompositionTarget_Rendering;
        }
        static void Main(string[] args)
        {
            StartSetupScreen();

            var      world    = new World();
            LevelOne levelOne = new LevelOne();

            var fpsCounter = new FramesPerSecondCounter(world);
            var fpsWriter  = new FpsRenderer(world);

            MapLevelDetails map = new MapLevelDetails(25, 11); // initialize map

            world.Set(map);
            MapRenderer mapRenderer = new MapRenderer(world);

            Queue <string> playerMessageQueue = new Queue <string>(2);

            world.Set(playerMessageQueue);
            MessageBoxRenderer messageBoxRenderer = new MessageBoxRenderer(world);

            HealthComponent health = new HealthComponent()
            {
                Health = new RegenerateAttribute()
                {
                    Current = 27, Max = 40, Name = "Health", RegenRatePerSecond = 0.5
                }
            };
            ManaComponent mana = new ManaComponent()
            {
                Mana = new RegenerateAttribute()
                {
                    Current = 25, Max = 30, Name = "Mana", RegenRatePerSecond = 0.2
                }
            };
            ExperienceBar xpBar = new ExperienceBar();

            PlayerStats playerStats = new PlayerStats("Dave", health, mana, xpBar);

            world.Set(playerStats);
            ConsoleInputSystem   playerInput          = new ConsoleInputSystem(world);
            PlayerMovementSystem playerMovementSystem = new PlayerMovementSystem(world);
            PlayerRenderSystem   player = new PlayerRenderSystem(world);
            PlayerPosition       playerStartPosition = new PlayerPosition(map, world); //initialize player

            playerStartPosition.MoveTo(27);
            world.Set(playerStartPosition);

            MonsterMoveController[] monsters = levelOne.CreateMonsters(world, map); //initialize monsters
            world.Set(monsters);
            MonsterMovementSystem monsterMovement  = new MonsterMovementSystem(world);
            MonsterRenderSystem   monstersRenderer = new MonsterRenderSystem(world);

            List <string> combatMessagesQueue = new List <string>(3);

            world.Set(combatMessagesQueue);
            CombatHandler combatHandler = new CombatHandler(world);

            world.Set(combatHandler);
            CombatMessages combatMessages = new CombatMessages(world);

            var updateSystems = new IUpdate[] { playerInput, playerMovementSystem, combatHandler, monsterMovement, fpsCounter, health, mana }; //Order is important!
            var renderSystems = new IRender[] { player, monstersRenderer, mapRenderer, messageBoxRenderer, combatMessages, fpsCounter, fpsWriter, health, mana, xpBar };

            GameEngine gameEngine = new GameEngine(updateSystems, renderSystems, player, monstersRenderer);

            mapRenderer.PrintMap(map.Map);
            gameEngine.Start();
        }
Example #5
0
        public override void Run()
        {
            // Create and Initialize the axis lines renderer
            var axisLines = ToDispose(new AxisLinesRenderer());

            axisLines.Initialize(this);

            // Create and Initialize the axis lines renderer
            var triangle = ToDispose(new TriangleRenderer());

            triangle.Initialize(this);

            //// Create and Initialize the axis lines renderer
            var quad = ToDispose(new QuadRenderer());

            quad.Initialize(this);

            //// Create and Initialize the axis lines renderer
            var sphere = ToDispose(new SphereRenderer(Vector3.Zero, .25f));

            sphere.Initialize(this);

            //// FPS renderer
            FpsRenderer fps = null;

            if (ShowFPS)
            {
                fps = ToDispose(new Common.FpsRenderer("Calibri", Color.CornflowerBlue, new Point(8, 8), 16));
                fps.Initialize(this);
            }

            //// Text renderer
            Common.TextRenderer textRenderer = null;
            if (ShowText)
            {
                textRenderer = ToDispose(new Common.TextRenderer("Calibri", Color.CornflowerBlue, new Point(8, 30), 12));
                textRenderer.Initialize(this);

                UpdateText = () =>
                {
                    textRenderer.Text =
                        String.Format("World rotation ({0}) (Up/Down Left/Right Wheel+-)\nView ({1}) (A/D, W/S, Shift+Wheel+-)"
                                      + "\nPress X to reinitialize the device and resources (device ptr: {2})"
                                      + "\nPress Z to show/hide depth buffer",
                                      rotation,
                                      V.TranslationVector,
                                      DeviceManager.Direct3DDevice.NativePointer);
                };

                UpdateText();
            }

            InitializeMatricies();
            Window.Resize     += Window_Resize;
            Window.KeyDown    += Window_KeyDown;
            Window.KeyUp      += Window_KeyUp;
            Window.MouseWheel += Window_MouseWheel;
            RenderLoop.Run(Window, () =>
            {
                // Clear DSV
                DeviceManager.Direct3DContext.ClearDepthStencilView(DepthStencilView,
                                                                    DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil,
                                                                    1.0f, 0);
                // Clear RTV
                DeviceManager.Direct3DContext.ClearRenderTargetView(RenderTargetView, Color.White);

                // VP matrix
                var VP = Matrix.Multiply(V, P);

                // MVP
                var MVP = M * VP;

                // Must transpose to use in HLSL
                MVP.Transpose();

                // Write MVP to constant buffer
                DeviceManager.Direct3DContext.UpdateSubresource(ref MVP, mvpBuffer);

                // Render our primitives
                axisLines.Render();
                quad.Render();
                MVP = sphere.M * VP;
                MVP.Transpose();
                DeviceManager.Direct3DContext.UpdateSubresource(ref MVP, mvpBuffer);
                sphere.Render();
                var v = sphere.RotationAngles;
                v.Y  += 0.016f;
                sphere.RotationAngles = v;
                triangle.Render();

                // FPS renderer
                if (fps != null)
                {
                    fps.Render();
                }

                // Text renderer
                if (textRenderer != null)
                {
                    textRenderer.Render();
                }

                Present();
            });
        }
Example #6
0
        protected BaseView(
            ImageViewerMain main,
            DeviceResources deviceResources,
            TextureLoader loader) : base(main, loader)
        {
            navigationFrame = new NavigationRenderer(
                deviceResources: deviceResources,
                loader: loader,
                view: this,
                depth: 0.005f,
                thickness: 0.002f,
                topLeft: new Vector3(Constants.X00, Constants.Y2, Constants.Z1 + Constants.DistanceFromUser),
                bottomLeft: new Vector3(Constants.X00, Constants.Y1, Constants.Z1 + Constants.DistanceFromUser),
                topRight: new Vector3(Constants.X01, Constants.Y2, Constants.Z0 + Constants.DistanceFromUser))
            {
                RotationY = 45,
            };


            settingViewer = new SettingViewer(main, deviceResources, loader);

            statusItems = new BasePlaneRenderer[24];

            statusItems[0] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X01, Constants.Y3, Constants.Z0),
                topLeft: new Vector3(Constants.X01, Constants.Y4, Constants.Z0),
                bottomRight: new Vector3(Constants.X02, Constants.Y3, Constants.Z0),
                topRight: new Vector3(Constants.X02, Constants.Y4, Constants.Z0))
            {
                TextPosition = new Vector2(20, 10),
                Text         = "WSI",
                FontSize     = 40.0f,
                ImageWidth   = 640,
            };

            statusItems[1] = new ZoomRenderer(
                view: this,
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X02, Constants.Y3, Constants.Z0),
                topLeft: new Vector3(Constants.X02, Constants.Y4, Constants.Z0),
                bottomRight: new Vector3(Constants.X05, Constants.Y3, Constants.Z0),
                topRight: new Vector3(Constants.X05, Constants.Y4, Constants.Z0))
            {
                ImageWidth = 720
            };

            statusItems[2] = new MemoryUseRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X05, Constants.Y3, Constants.Z0),
                topLeft: new Vector3(Constants.X05, Constants.Y4, Constants.Z0),
                bottomRight: new Vector3(Constants.X06, Constants.Y3, Constants.Z0),
                topRight: new Vector3(Constants.X06, Constants.Y4, Constants.Z0))
            {
                ImageWidth = 160
            };

            statusItems[3] = new FpsRenderer(
                view: this,
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X06, Constants.Y3, Constants.Z0),
                topLeft: new Vector3(Constants.X06, Constants.Y4, Constants.Z0),
                bottomRight: new Vector3(Constants.X07, Constants.Y3, Constants.Z0),
                topRight: new Vector3(Constants.X07, Constants.Y4, Constants.Z0))
            {
                ImageWidth = 160
            };

            statusItems[4] = new ClockRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X07, Constants.Y3, Constants.Z0),
                topLeft: new Vector3(Constants.X07, Constants.Y4, Constants.Z0),
                bottomRight: new Vector3(Constants.X09, Constants.Y3, Constants.Z0),
                topRight: new Vector3(Constants.X09, Constants.Y4, Constants.Z0))
            {
                ImageWidth = 240
            };

            statusItems[5] = new NameRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X01, Constants.Y2, Constants.Z0),
                topLeft: new Vector3(Constants.X01, Constants.Y3, Constants.Z0),
                bottomRight: new Vector3(Constants.X04, Constants.Y2, Constants.Z0),
                topRight: new Vector3(Constants.X04, Constants.Y3, Constants.Z0))
            {
                TextPosition    = new Vector2(10, 10),
                ImageWidth      = 960,
                ImageHeight     = 48,
                FontSize        = 25.0f,
                BackgroundColor = Colors.LightGray,
                Index           = 0
            };

            statusItems[6] = new NameRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X04, Constants.Y2, Constants.Z0),
                topLeft: new Vector3(Constants.X04, Constants.Y3, Constants.Z0),
                bottomRight: new Vector3(Constants.X09, Constants.Y2, Constants.Z0),
                topRight: new Vector3(Constants.X09, Constants.Y3, Constants.Z0))
            {
                TextPosition    = new Vector2(10, 10),
                ImageWidth      = 960,
                ImageHeight     = 48,
                FontSize        = 25.0f,
                BackgroundColor = Colors.LightGray,
                Index           = 1
            };

            statusItems[7] = new KeyRenderer(
                view: this,
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X01, Constants.Y0, Constants.Z0),
                topLeft: new Vector3(Constants.X01, Constants.Y1, Constants.Z0),
                bottomRight: new Vector3(Constants.X03, Constants.Y0, Constants.Z0),
                topRight: new Vector3(Constants.X03, Constants.Y1, Constants.Z0))
            {
                ImageWidth = 800
            };

            statusItems[8] = new DebugRenderer(
                view: this,
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X03, Constants.Y0, Constants.Z0),
                topLeft: new Vector3(Constants.X03, Constants.Y1, Constants.Z0),
                bottomRight: new Vector3(Constants.X06, Constants.Y0, Constants.Z0),
                topRight: new Vector3(Constants.X06, Constants.Y1, Constants.Z0))
            {
                ImageWidth = 720
            };

            statusItems[9] = new TileCounterRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X06, Constants.Y0, Constants.Z0),
                topLeft: new Vector3(Constants.X06, Constants.Y1, Constants.Z0),
                bottomRight: new Vector3(Constants.X08, Constants.Y0, Constants.Z0),
                topRight: new Vector3(Constants.X08, Constants.Y1, Constants.Z0))
            {
                ImageWidth = 240
            };

            statusItems[10] = new ScalerRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X08, Constants.Y0, Constants.Z0),
                topLeft: new Vector3(Constants.X08, Constants.Y1, Constants.Z0),
                bottomRight: new Vector3(Constants.X09, Constants.Y0, Constants.Z0),
                topRight: new Vector3(Constants.X09, Constants.Y1, Constants.Z0))
            {
                ImageWidth = 160
            };

            statusItems[11] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X00, Constants.Y3, Constants.Z1),
                topLeft: new Vector3(Constants.X00, Constants.Y4, Constants.Z1),
                bottomRight: new Vector3(Constants.X01, Constants.Y3, Constants.Z0),
                topRight: new Vector3(Constants.X01, Constants.Y4, Constants.Z0))
            {
                TextPosition = new Vector2(20, 10),
                Text         = "Z7",
                FontSize     = 40.0f,
                ImageWidth   = 960,
                ImageHeight  = 80,
            };

            statusItems[12] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X00, Constants.Y2, Constants.Z1),
                topLeft: new Vector3(Constants.X00, Constants.Y3, Constants.Z1),
                bottomRight: new Vector3(Constants.X01, Constants.Y2, Constants.Z0),
                topRight: new Vector3(Constants.X01, Constants.Y3, Constants.Z0))
            {
                TextPosition    = new Vector2(10, 10),
                Text            = "", //"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                FontSize        = 25.0f,
                ImageWidth      = 960,
                ImageHeight     = 48,
                BackgroundColor = Colors.LightGray
            };

            //statusItems[13] = new ImageRenderer(
            //    deviceResources: deviceResources,
            //    loader: loader,
            //    bottomLeft: new Vector3(Constants.X00, Constants.Y1, Constants.Z1),
            //    topLeft: new Vector3(Constants.X00, Constants.Y2, Constants.Z1),
            //    bottomRight: new Vector3(Constants.X01, Constants.Y1, Constants.Z0),
            //    topRight: new Vector3(Constants.X01, Constants.Y2, Constants.Z0))
            //{
            //    Position = new Vector3(0.0f, 0.0f, Constants.DistanceFromUser),
            //    TextureFile = "Content\\Textures\\base.png",
            //};

            histo = new HistologyView(deviceResources: deviceResources, loader: loader);

            statusItems[13] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X00, Constants.Y0, Constants.Z1),
                topLeft: new Vector3(Constants.X00, Constants.Y1, Constants.Z1),
                bottomRight: new Vector3(Constants.X01, Constants.Y0, Constants.Z0),
                topRight: new Vector3(Constants.X01, Constants.Y1, Constants.Z0))
            {
                TextPosition = new Vector2(20, 10),
                Text         = "", //"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                ImageWidth   = 960,
            };

            statusItems[14] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X09, Constants.Y3, Constants.Z0),
                topLeft: new Vector3(Constants.X09, Constants.Y4, Constants.Z0),
                bottomRight: new Vector3(Constants.X10, Constants.Y3, Constants.Z1),
                topRight: new Vector3(Constants.X10, Constants.Y4, Constants.Z1))
            {
                TextPosition = new Vector2(20, 10),
                Text         = "Klinisk anamnes, frågeställning, preparat beskrivning",
                FontSize     = 38.0f,
                ImageWidth   = 960,
            };

            statusItems[15] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X09, Constants.Y1, Constants.Z0),
                topLeft: new Vector3(Constants.X09, Constants.Y3, Constants.Z0),
                bottomRight: new Vector3(Constants.X10, Constants.Y1, Constants.Z1),
                topRight: new Vector3(Constants.X10, Constants.Y3, Constants.Z1))
            {
                TextPosition = new Vector2(20, 10),
                Text         = @"Anamnestext. 

Frågeställning / diagnos:                                               malignitet? staging

Anamnes: 
misstänkt distal kolangiocc, op pylorusbevarande whipple.tacksam us.

Preparatets natur:                                                          whipple resektat
Antal burkar / rör:                                                         1
Patienten ingår i standardiserade vårdförlopp:             nej",

                FontSize        = 34.0f,
                ImageWidth      = 1280,
                ImageHeight     = 1344,
                BackgroundColor = Colors.LightGray,
            };

            statusItems[16] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X09, Constants.Y0, Constants.Z0),
                topLeft: new Vector3(Constants.X09, Constants.Y1, Constants.Z0),
                bottomRight: new Vector3(Constants.X10, Constants.Y0, Constants.Z1),
                topRight: new Vector3(Constants.X10, Constants.Y1, Constants.Z1))
            {
                TextPosition = new Vector2(20, 10),
                Text         = "Provtagningsdatum:      2018-03-14 13:16 ",
                ImageWidth   = 960,
            };

            statusItems[17] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X00, Constants.Y3, Constants.Z2),
                topLeft: new Vector3(Constants.X00, Constants.Y4, Constants.Z2),
                bottomRight: new Vector3(Constants.X00, Constants.Y3, Constants.Z1),
                topRight: new Vector3(Constants.X00, Constants.Y4, Constants.Z1))
            {
                Text       = "", //"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                FontSize   = 40.0f,
                ImageWidth = 1440,
            };

            statusItems[18] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X00, Constants.Y2, Constants.Z2),
                topLeft: new Vector3(Constants.X00, Constants.Y3, Constants.Z2),
                bottomRight: new Vector3(Constants.X00, Constants.Y2, Constants.Z1),
                topRight: new Vector3(Constants.X00, Constants.Y3, Constants.Z1))
            {
                Text            = "", //"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                FontSize        = 25.0f,
                ImageWidth      = 1440,
                ImageHeight     = 48,
                BackgroundColor = Colors.LightGray,
            };

            statusItems[19] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X00, Constants.Y0, Constants.Z2),
                topLeft: new Vector3(Constants.X00, Constants.Y1, Constants.Z2),
                bottomRight: new Vector3(Constants.X00, Constants.Y0, Constants.Z1),
                topRight: new Vector3(Constants.X00, Constants.Y1, Constants.Z1))
            {
                Text       = "", //"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                ImageWidth = 1440,
            };

            statusItems[20] = new ImageRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X00, Constants.Y0, Constants.Z3 + Constants.Z1),
                topLeft: new Vector3(Constants.X00, Constants.Y4, Constants.Z3 + Constants.Z1),
                bottomRight: new Vector3(Constants.X00, Constants.Y0, Constants.Z3),
                topRight: new Vector3(Constants.X00, Constants.Y4, Constants.Z3))
            {
                Position    = new Vector3(0.0f, 0.0f, Constants.DistanceFromUser),
                TextureFile = "Content\\Textures\\help.jpg",
            };

            macro = new MacroView(deviceResources: deviceResources, loader: loader, connections: imageConnections);

            navMacroFrame = new NavigationFrameRenderer(deviceResources: deviceResources,
                                                        loader: loader,
                                                        depth: 0.005f,
                                                        thickness: 0.002f,
                                                        macro.Labels,
                                                        view: this,
                                                        topLeft: new Vector3(Constants.X00, Constants.Y2, Constants.Z2 + Constants.DistanceFromUser),
                                                        bottomLeft: new Vector3(Constants.X00, Constants.Y1, Constants.Z2 + Constants.DistanceFromUser),
                                                        topRight: new Vector3(Constants.X00, Constants.Y2, Constants.Z1 + Constants.DistanceFromUser))
                            //bottomRight: new Vector3(Constants.X00, Constants.Y1, Constants.Z1 + Constants.DistanceFromUser))
            {
                RotationY = 0,
            };
            //navMacroFrame.SetNavigationArea(690, 897, 3456, 2304, 0);
            navMacroFrame.SetNavigationArea(macro.labels[0]);

            //tl 690, 897,     tr 1399, 897,     br 690, 1416,    bl 1399, 1416


            ///Radiology Top bar
            statusItems[21] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X00, Constants.Y3, Constants.Z3),
                topLeft: new Vector3(Constants.X00, Constants.Y4, Constants.Z3),
                bottomRight: new Vector3(Constants.X00, Constants.Y3, Constants.Z2),
                topRight: new Vector3(Constants.X00, Constants.Y4, Constants.Z2))
                              //bottomLeft: new Vector3( Constants.X00, Constants.Y0, Constants.Z3 ),
                              //topLeft: new Vector3( Constants.X00, Constants.Y4, Constants.Z3 ),
                              //bottomRight: new Vector3( Constants.X00, Constants.Y0, Constants.Z2 ),
                              //topRight: new Vector3( Constants.X00, Constants.Y4, Constants.Z2 ),
            {
                TextPosition = new Vector2(20, 10),
                Text         = "MRI",
                FontSize     = 40.0f,
                ImageWidth   = 960,
                ImageHeight  = 80,
            };

            radiology = new RadiologyView(deviceResources: deviceResources, loader: loader, connections: imageConnections);

            navRadioFrame = new NavigationFrameRenderer(deviceResources: deviceResources,
                                                        loader: loader,
                                                        depth: 0.005f,
                                                        thickness: 0.002f,
                                                        macro.Labels,
                                                        view: this,
                                                        topLeft: new Vector3(Constants.X00, Constants.Y2, Constants.Z3 + Constants.DistanceFromUser),
                                                        bottomLeft: new Vector3(Constants.X00, Constants.Y1, Constants.Z3 + Constants.DistanceFromUser),
                                                        topRight: new Vector3(Constants.X00, Constants.Y2, Constants.Z2 + Constants.DistanceFromUser))
                            //bottomRight: new Vector3(Constants.X00, Constants.Y1, Constants.Z1 + Constants.DistanceFromUser))
            {
                RotationY = 0,
            };

            //Radiology Top LightGray bar
            statusItems[22] = new StatusBarRenderer(
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X00, Constants.Y2, Constants.Z3),
                topLeft: new Vector3(Constants.X00, Constants.Y3, Constants.Z3),
                bottomRight: new Vector3(Constants.X00, Constants.Y2, Constants.Z2),
                topRight: new Vector3(Constants.X00, Constants.Y3, Constants.Z2))
            {
                Text            = "", //"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                FontSize        = 25.0f,
                ImageWidth      = 1440,
                ImageHeight     = 48,
                BackgroundColor = Colors.LightGray,
            };

            //Radiology Bottom bar
            statusItems[23] = new RadiologyIndexRenderer(
                rv: radiology,
                deviceResources: deviceResources,
                loader: loader,
                bottomLeft: new Vector3(Constants.X00, Constants.Y0, Constants.Z3),
                topLeft: new Vector3(Constants.X00, Constants.Y1, Constants.Z3),
                bottomRight: new Vector3(Constants.X00, Constants.Y0, Constants.Z2),
                topRight: new Vector3(Constants.X00, Constants.Y1, Constants.Z2))
            {
                Text       = "Image: 265", //"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                ImageWidth = 1440,
                FontSize   = 40.0f,
            };

            Pointers = new BasePointerRenderer[2];

            Pointers[0] = new PointerRenderer(this, navigationFrame, deviceResources, loader,
                                              new BasePointerRenderer.Corners(
                                                  topLeft: new Vector3(Constants.X01, Constants.Y2, Constants.DistanceFromUser),
                                                  bottomLeft: new Vector3(Constants.X01, Constants.Y1, Constants.DistanceFromUser),
                                                  topRight: new Vector3(Constants.X09, Constants.Y2, Constants.DistanceFromUser),
                                                  bottomRight: new Vector3(Constants.X09, Constants.Y1, Constants.DistanceFromUser)))
            {
                Position = new Vector3(0, 0, Constants.DistanceFromUser)
            };

            Pointers[1] = new BasePointerRenderer(navigationFrame, deviceResources, loader,
                                                  new BasePointerRenderer.Corners(
                                                      topLeft: new Vector3(Constants.X00, Constants.Y2, Constants.Z1 + Constants.DistanceFromUser),
                                                      bottomLeft: new Vector3(Constants.X00, Constants.Y1, Constants.Z1 + Constants.DistanceFromUser),
                                                      topRight: new Vector3(Constants.X01, Constants.Y2, Constants.Z0 + Constants.DistanceFromUser),
                                                      bottomRight: new Vector3(Constants.X01, Constants.Y1, Constants.Z0 + Constants.DistanceFromUser)))
            {
                RotationY = 45.0f,
                Position  = new Vector3(0, 0, Constants.DistanceFromUser)
            };

            caseView = new CaseSelectionView(deviceResources, loader);

            model = new ObjRenderer(deviceResources, loader)
            {
                Position = new Vector3(Constants.MX, Constants.MY, Constants.MZ)
            };
        }
Example #7
0
        static void Main(string[] args)
        {
            System.Console.OutputEncoding = Encoding.Unicode;

            //System.Console.WriteLine("\u2665");
            //System.Console.WriteLine("\uF496");

            //System.Console.Write('\u003A');
            //System.Console.WriteLine('\u0029');//

            //System.Console.Write('\u263A');
            //System.Console.Write('♥');
            //System.Console.Write('♡');
            //System.Console.WriteLine('\u263B');
            //System.Console.Read();

            Console.SetWindowSize(120, 35);
            Console.CursorVisible = false;
            var world = new World();

            var health = new HealthComponent(world)
            {
                Health = new RegenAttribute
                {
                    Current = 50, Max = 100, Name = "Health", RegenRatePerSecond = 1
                }
            };
            var mana = new ManaComponent(world)
            {
                Mana = new RegenAttribute
                {
                    Current = 30, Max = 60, Name = "Mana", RegenRatePerSecond = 0.2
                }
            };

            var fpsCounter = new FramesPerSecondCounter(world);

            var fpsWriter = new FpsRenderer(world);

            var inputSystem = new ConsoleInputSystem(world);

            var playerRenderSystem  = new PlayerRenderSystem(world);
            var monsterRenderSystem = new MonsterRenderSystem(world);

            var playerMovement  = new PlayerMovementSystem(world);
            var monsterMovement = new MonsterMovementSystem(world);
            //Initialize Player position
            var initialPlayerPosition = new PlayerPosition();

            initialPlayerPosition.MoveTo(10, 10);
            world.Set(initialPlayerPosition);
            //initializ monster/s
            var initialMonsterPosition = new MonsterPosition();

            initialMonsterPosition.MoveTo(12, 12);
            world.Set(initialMonsterPosition);

            var updateSystems = new IUpdate[] { inputSystem, fpsCounter, playerMovement, monsterMovement, health, mana }; //Order is important!
            var renderSystems = new IRender[] { playerRenderSystem, monsterRenderSystem, health, mana, fpsWriter, fpsCounter };

            GameEngine gameEngine = new GameEngine(updateSystems, renderSystems);

            gameEngine.Start();
        }