Ejemplo n.º 1
0
        public DisplayTest()
        {
            _display = DisplayController.GetDefault();

            ParallelDisplayControllerSettings _settings = new ParallelDisplayControllerSettings()
            {
                Width          = 800,
                Height         = 480,
                PixelClockRate = 9600000, // not used in native code
                PixelPolarity  = false,
                //OutputEnablePolarity = true, // this must be true
                //OutputEnableIsFixed = true,
                HorizontalFrontPorch     = 8,
                HorizontalBackPorch      = 43,
                HorizontalSyncPulseWidth = 2,
                HorizontalSyncPolarity   = false,
                VerticalFrontPorch       = 2,
                VerticalBackPorch        = 2,
                VerticalSyncPulseWidth   = 10,
                VerticalSyncPolarity     = false,
                DataFormat = DisplayDataFormat.Rgb565 // not really correct: it is Rgb888 for Disco-746 display...
            };

            _display.SetConfiguration(_settings);
            _display.DrawString("\f\n\n* Discovery STM32F69 board *\n\n");
            _display.DrawString("* TinyCLR 1.0.0 pvw for STM32F7 *");
            _screen = Graphics.FromHdc(_display.Hdc);
        }
Ejemplo n.º 2
0
    public void ToggleFullscreen()
    {
        DisplayController display = Helper.LoadDisplayController();

        display.ToggleFullscreen();
        UpdateFullscreenToggleText();
    }
 // Start is called before the first frame update
 void Start()
 {
     currentDisplay = GameObject.Find("displayImage").GetComponent <DisplayController>();
     dialPadLights  = GameObject.FindGameObjectsWithTag("DialPadLight");
     GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("General/Light_Neutral");
     Debug.Log("start4-dialPad");
 }
Ejemplo n.º 4
0
        public AltoSystem()
        {
            _scheduler = new Scheduler();

            _memBus             = new MemoryBus();
            _mem                = new Memory.Memory();
            _keyboard           = new Keyboard();
            _diskController     = new DiskController(this);
            _displayController  = new DisplayController(this);
            _mouseAndKeyset     = new MouseAndKeyset();
            _ethernetController = new EthernetController(this);
            _orbitController    = new OrbitController(this);
            _audioDAC           = new AudioDAC(this);
            _organKeyboard      = new OrganKeyboard(this);
            _tridentController  = new TridentController(this);

            _cpu = new AltoCPU(this);

            // Attach memory-mapped devices to the bus
            _memBus.AddDevice(_mem);
            _memBus.AddDevice(_keyboard);
            _memBus.AddDevice(_mouseAndKeyset);
            _memBus.AddDevice(_audioDAC);
            _memBus.AddDevice(_organKeyboard);

            Reset();
        }
    void Start()
    {
        //Create the map with cell data we need
        map = new Map(Parameters.mapWidth, Parameters.cellWidth);

        //Generate obstacles
        //Has to do it from this script or the obstacles might be created after this script has finished and mess things up
        //Need the start car so we can avoid adding obstacles on it
        //Car startCar = new Car(SimController.current.GetSelfDrivingCarTrans(), SimController.current.GetActiveCarData());
        Vector3 startPos = SimController.current.GetSelfDrivingCarTrans().position;

        int startTime = Environment.TickCount;

        this.GetComponent <ObstaclesGenerator>().InitObstacles(map, startPos);

        string timeText = DisplayController.GetDisplayTimeText(startTime, Environment.TickCount, "Generate obstacles and Voronoi diagram");

        Debug.Log(timeText);


        //Create the textures showing various stuff, such as the distance to nearest obstacle
        //debugController.DisplayCellObstacleIntersection(map);
        displayController.GenerateTexture(map, DisplayController.TextureTypes.Flowfield_Obstacle);
        displayController.GenerateTexture(map, DisplayController.TextureTypes.Voronoi_Field);
        displayController.GenerateTexture(map, DisplayController.TextureTypes.Voronoi_Diagram);
    }
Ejemplo n.º 6
0
        private void DrawGroundLayers(SpriteBatch spriteBatch)
        {
            //Draw Ground Layers
            ScreenController.graphicsDevice.Viewport = camera.viewport;
            ScreenController.graphicsDevice.SetRenderTarget(DisplayController.GetRenderTarget(worldObjectsRender));
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, camera.TranslationMatrix(1f, 1f));
            world.DrawGroundLayers(spriteBatch, camera.drawPoints, mapObjectsDraw);
            spriteBatch.End();

            //Draw burnt layer
            if (mapObjectsDraw.IsBurntTiles())
            {
                ScreenController.graphicsDevice.SetRenderTarget(DisplayController.GetRenderTarget(burntLayerRender));
                ScreenController.graphicsDevice.Clear(Color.Transparent);
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, camera.TranslationMatrix(1f, 1f));
                mapObjectsDraw.DrawBurntLayer(spriteBatch);
                spriteBatch.End();

                /*  //Soften the burnt
                 * ScreenController.graphicsDevice.SetRenderTarget(DisplayController.GetRenderTarget(burntToSoftenRender));
                 * spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null);
                 * spriteBatch.Draw(DisplayController.GetRenderTarget(burntLayerRender), Vector2.Zero, Color.White * 0.5f);
                 * spriteBatch.End();*/

                //Back to world render
                ScreenController.graphicsDevice.SetRenderTarget(DisplayController.GetRenderTarget(worldObjectsRender));
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null);
                spriteBatch.Draw(DisplayController.GetRenderTarget(burntLayerRender), Vector2.Zero, Color.White * 0.85f);
                spriteBatch.End();
            }
        }
Ejemplo n.º 7
0
        private void DrawFinalToScreen(SpriteBatch spriteBatch)
        {
            if (GameController.inGameState != InGameState.INMENU)  //Standard draw
            {
                ScreenController.graphicsDevice.SetRenderTarget(null);
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null);
                spriteBatch.Draw(DisplayController.GetRenderTarget(worldLightingRender), Vector2.Zero, Color.White);
                spriteBatch.End();
            }
            else   //In menu so draw Blur
            {
                ScreenController.graphicsDevice.SetRenderTarget(DisplayController.GetRenderTarget(blurRender));
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, Effectlighting);
                Effectlighting.Parameters["red"].SetValue(WorldController.globalRed);
                Effectlighting.Parameters["green"].SetValue(WorldController.globalGreen);
                Effectlighting.Parameters["blue"].SetValue(WorldController.globalBlue);
                spriteBatch.Draw(DisplayController.GetRenderTarget(worldLightingRender), Vector2.Zero, Color.White);
                spriteBatch.End();

                ScreenController.graphicsDevice.SetRenderTarget(DisplayController.GetRenderTarget(blurRenderTwo));
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null);
                Effectblur.Parameters["Texture"].SetValue(DisplayController.GetRenderTarget(blurRender));
                Effectblur.CurrentTechnique.Passes[0].Apply();
                spriteBatch.Draw(DisplayController.GetRenderTarget(blurRender), Vector2.Zero, Color.White);
                spriteBatch.End();

                ScreenController.graphicsDevice.SetRenderTarget(null);
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null);
                Effectblur.Parameters["Texture"].SetValue(DisplayController.GetRenderTarget(blurRenderTwo));
                Effectblur.CurrentTechnique.Passes[1].Apply();
                spriteBatch.Draw(DisplayController.GetRenderTarget(blurRenderTwo), Vector2.Zero, Color.White);
                spriteBatch.End();
            }
        }
Ejemplo n.º 8
0
        public void Run_PathContainsUppercaseFile_DisplaysProperColor()
        {
            const ConsoleColor exeColor = ConsoleColor.Green;
            const string       fileName = "SomeExecutable.EXE";
            var fileEntries             = TestHelper.GetFileEntries(fileName);

            // Setup

            var consoleAdapterMock = new Mock <IConsoleAdapter>();

            Dependency.RegisterInstance(consoleAdapterMock.Object);

            var settingsRepoMock = new Mock <ISettingsRepository>();

            settingsRepoMock.Setup(sr => sr.GetExtensionColor(".exe")).Returns(exeColor);
            Dependency.RegisterInstance(settingsRepoMock.Object);

            // Test

            var displayController = new DisplayController();

            displayController.Display(new RunSettings(), fileEntries);

            // Assert

            consoleAdapterMock.Verify(ca => ca.WriteLine(fileName, ConsoleColor.Green), Times.Once());
        }
Ejemplo n.º 9
0
        public void Run_HasFileLength_LengthIsWrittenToConsole()
        {
            var fileEntry = new FileEntry
            {
                FullName = "SomeFile.txt",
                Length   = 123456789
            };

            string expectedLengthString = SizeFormatter.GetSizeString(fileEntry.Length);

            // Setup

            var settingsRepoMock = new Mock <ISettingsRepository>();

            Dependency.RegisterInstance(settingsRepoMock.Object);

            var consoleAdapterMock = new Mock <IConsoleAdapter>();

            Dependency.RegisterInstance(consoleAdapterMock.Object);

            // Test

            var displayController = new DisplayController();

            displayController.Display(new RunSettings(), fileEntry.AsArray());

            // Assert

            consoleAdapterMock.Verify(ca => ca.Write(expectedLengthString), Times.Once());
        }
Ejemplo n.º 10
0
        public Application(DisplayController display)
        {
            DisplayController displayController = display;

            if (displayController == null)
            {
                throw new ArgumentException();
            }
            this.display = displayController;
            WindowManager.EnsureInstance(this.display);
            Application._stylusMaxX = (int)this.display.ActiveSettings.Width;
            Application._stylusMaxY = (int)this.display.ActiveSettings.Height;
            lock (typeof(Application.GlobalLock))
            {
                if (Application._appCreatedInThisAppDomain)
                {
                    throw new InvalidOperationException("application is a singleton");
                }
                Application._appInstance               = this;
                Application.IsShuttingDown             = false;
                Application._appCreatedInThisAppDomain = true;
            }
            this.InitializeForEventSource();
            this.InputProvider = new InputProvider(this);
            Dispatcher.SetFinalDispatcherExceptionHandler(new DispatcherExceptionEventHandler(Application.DefaultContextExceptionHandler));
            this.Dispatcher.BeginInvoke(new DispatcherOperationCallback(this.StartupCallback), (object)null);
        }
Ejemplo n.º 11
0
        public void Run_ContainsDirectory_DisplaysDirectoryCorrectly()
        {
            var fileEntry = new FileEntry
            {
                FullName    = "ThisDirectory",
                IsDirectory = true
            };

            string actualString = string.Empty;

            // Setup

            var settingsRepoMock = new Mock <ISettingsRepository>();

            Dependency.RegisterInstance(settingsRepoMock.Object);

            var consoleAdapterMock = new Mock <IConsoleAdapter>();

            consoleAdapterMock.Setup(ca => ca.Write(It.IsAny <object>(), ConsoleColor.Magenta)).Callback <object, ConsoleColor>((s, c) => actualString = s.ToString());
            Dependency.RegisterInstance(consoleAdapterMock.Object);

            // Test

            var displayController = new DisplayController();

            displayController.Display(new RunSettings(), fileEntry.AsArray());

            // Assert

            Assert.IsTrue(actualString.StartsWith("Folder"));
        }
Ejemplo n.º 12
0
        public void DrawCellRecalculateList()
        {
            int i = 0;

            ScreenController.graphicsDevice.SetRenderTarget(DisplayController.GetRenderTarget(renderTargetTextureId));
            DisplayController.spriteBatch1.Begin(SpriteSortMode.Deferred);

            while (!redrawQueue.IsEmpty)
            {
                if (redrawQueue.TryDequeue(out Point point))
                {
                    int cellX = point.X - (xMajor * tilesPerCell);
                    int cellY = point.Y - (yMajor * tilesPerCell);

                    Tile      tile        = WorldController.world.tileGrid[point.X, point.Y];
                    Rectangle destination = new Rectangle(cellX * tilePixel, cellY * tilePixel, tilePixel, tilePixel);

                    Color color = GetTileColor(tile);
                    AddLayerDraw(tile, destination, color);
                    AddMapObjectDraw(tile, destination, point.X, point.Y, color);
                    i++;
                }
                else
                {
                    break;
                }
            }

            DisplayController.spriteBatch1.End();
            ScreenController.graphicsDevice.SetRenderTarget(null);
        }
Ejemplo n.º 13
0
    // Start is called before the first frame update
    void Start()
    {
        this.rewardedAd = new RewardedAd(adUnitId);        //インスタンス生成

        DisplayControllerInstance = GameObject.Find("Main Camera").GetComponent <DisplayController>();
        CreditManagerInstance     = GameObject.Find("Main Camera").GetComponent <CreditManager>();

        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();

        // Load the rewarded ad with the request.
        this.rewardedAd.LoadAd(request);

        // Called when an ad request has successfully loaded.
        this.rewardedAd.OnAdLoaded += HandleRewardedAdLoaded;
        // Called when an ad request failed to load.
        this.rewardedAd.OnAdFailedToLoad += HandleRewardedAdFailedToLoad;
        // Called when an ad is shown.
        this.rewardedAd.OnAdOpening += HandleRewardedAdOpening;
        // Called when an ad request failed to show.
        this.rewardedAd.OnAdFailedToShow += HandleRewardedAdFailedToShow;
        // Called when the user should be rewarded for interacting with the ad.
        this.rewardedAd.OnUserEarnedReward += HandleUserEarnedReward;
        // Called when the ad is closed.
        this.rewardedAd.OnAdClosed += HandleRewardedAdClosed;
    }
Ejemplo n.º 14
0
        /// <summary>Constructs a new instance.</summary>
        /// <param name="DigitalPin9onGSocket">Pin 9 on Socket G.</param>
        public DisplayT35(int DigitalPin9onGSocket)
        {
            var controller = GpioController.GetDefault();

            this.backlightPin = controller.OpenPin(DigitalPin9onGSocket);
            this.backlightPin.SetDriveMode(GpioPinDriveMode.Output);
            this.BacklightEnabled = true;
            var displayController = DisplayController.GetDefault(); //Currently returns the hardware LCD controller by default

            //Enables the display
            displayController.ApplySettings(new ParallelDisplayControllerSettings
            {
                Width                    = ScreenWidth,
                Height                   = ScreenHeight,
                PixelClockRate           = 16625,
                PixelPolarity            = true,
                OutputEnablePolarity     = true,
                OutputEnableIsFixed      = true,
                HorizontalFrontPorch     = 51,
                HorizontalBackPorch      = 29, // Was 27 causing 2 pixel shift x axis
                HorizontalSyncPulseWidth = 41,
                HorizontalSyncPolarity   = false,
                VerticalFrontPorch       = 16,
                VerticalBackPorch        = 3, // Was 8
                VerticalSyncPulseWidth   = 10,
                VerticalSyncPolarity     = false,
            });

            Screen = Graphics.FromHdc(displayController.Hdc); //Calling flush on the object returned will flush to the display represented by Hdc. Only one active display is supported at this time.
        }
Ejemplo n.º 15
0
        private void SetupLegacySupport(Camera camera, bool isEnabled)
        {
            if (isEnabled && _displayController == null)
            {
                // OSVR doesn't support deferred renderer for now.
                if (camera.renderingPath != RenderingPath.Forward)
                {
                    QualitySettings.antiAliasing = 0;
                }

                _displayController = camera.transform.parent.gameObject.AddComponent <DisplayController>();
                camera.gameObject.AddComponent <VRViewer>();

                // Recenter and mirror mode.
                StartCoroutine(FinishSetup());
            }
            else if (_displayController != null)
            {
                Destroy(_displayController);
                Destroy <OsvrMirrorDisplay>();
                Destroy <VREye>();
                Destroy <VRSurface>();
                Destroy <VRViewer>();
                Destroy <OsvrRenderManager>(false);
                _displayController = null;
            }
        }
Ejemplo n.º 16
0
    public void DataReady(DataController dataCtrl)
    {
        localShopCtrl  = GetComponent <LocalShopController> ();
        dataController = dataCtrl;
        for (int i = 0; i < dataCtrl.players.Count; i++)
        {
            PlayerInfo player = dataCtrl.players[i];
            if (player.type == PlayerType.LOCAL)
            {
                localPlayerInfo  = player;
                localPlayerIndex = i;
                break;
            }
        }
        localShopCtrl.dataController   = dataController;
        localShopCtrl.localPlayerIndex = localPlayerIndex;
        if (localPlayerIndex != -1)
        {
            localShopCtrl.Init();
            UpdateLocalPlayerShop(dataCtrl.PlayerShop);
            dataCtrl.OnPlayerShopsChange += PlayerShopsChangeHandler;
        }

        DisplayController displayCtrl = GetComponent <DisplayController>();

        displayCtrl.DataReady(dataController, localPlayerInfo);
        Debug.Log("LocalPlayerCtrl dataready over");
    }
        private IDateRange GetRangeFrom(DateTime[] dateArray, Similarity similarityResult, CultureInfo currentCulture)
        {
            const string hyphen        = "—";
            const string formatStyle   = "d";
            DateTime     firstDate     = dateArray.First();
            DateTime     lastDate      = dateArray.Last();
            string       dateSeparator = currentCulture.DateTimeFormat.DateSeparator;

            switch (similarityResult)
            {
            // 01.05.2017
            case Similarity.SameDay:
                return(new DateRangeSameDay(formatStyle, firstDate, currentCulture));

            // 01-05.01.2017
            case Similarity.SameMonth:
                return(new DateRangeSameMonth(hyphen, formatStyle, firstDate, lastDate, currentCulture, dateSeparator));

            // 01.01 – 05.02.2017
            case Similarity.SameYear:
                return(new DateRangeSameYear(hyphen, formatStyle, firstDate, lastDate, currentCulture, dateSeparator));

            // 01.01.2016 – 05.01.2017
            case Similarity.NoSimilarity:
                return(new DateRangeVarious(hyphen, formatStyle, firstDate, lastDate, currentCulture));

            default:
                throw new ArgumentOutOfRangeException(DisplayController.SetMessageColor(ErrorInvalidFormatStrategy,
                                                                                        DisplayController.Color.DarkRed));
            }
        }
Ejemplo n.º 18
0
 void Awake()
 {
     recentered         = false;
     _clientKit         = FindObjectOfType <ClientKit>();
     _displayController = FindObjectOfType <DisplayController>();
     _vrController      = FindObjectOfType <OsvrUnityNativeVR>();
 }
Ejemplo n.º 19
0
        //Render order
        //Draw Ground Layers
        //Draw Burnt Layers
        //Draw Objects
        //Draw Shadows
        //Draw Fire and Smoke
        //Draw Lighting


        private void DrawShadows(SpriteBatch spriteBatch)
        {
            //Switch RenderTarget to ShadowTarget
            ScreenController.graphicsDevice.SetRenderTarget(DisplayController.GetRenderTarget(shadowMaskInvertedRender));
            ScreenController.graphicsDevice.Clear(Color.Black);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, camera.TranslationMatrix(1f, 1f));
            mapObjectsDraw.DrawShadows(spriteBatch);
            spriteBatch.End();

            ScreenController.graphicsDevice.SetRenderTarget(DisplayController.GetRenderTarget(shadowMaskRender));
            ScreenController.graphicsDevice.Clear(Color.Black);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, camera.TranslationMatrix(1f, 1f));
            mapObjectsDraw.DrawLightsOverShadows(spriteBatch);
            spriteBatch.End();

            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, null, null, null, EffectshadowInverter);
            EffectshadowInverter.Parameters["darkness"].SetValue(WorldController.shadowDarkness);
            spriteBatch.Draw(DisplayController.GetRenderTarget(shadowMaskInvertedRender), Vector2.Zero, Color.White);
            spriteBatch.End();

            ScreenController.graphicsDevice.SetRenderTarget(DisplayController.GetRenderTarget(worldShadowsRender));
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, Effectshadow);
            spriteBatch.Draw(DisplayController.GetRenderTarget(worldObjectsRender), Vector2.Zero, Color.White);
            spriteBatch.End();
        }
Ejemplo n.º 20
0
        static void Main()
        {
            var backlight = GpioController.GetDefault().OpenPin(G120E.GpioPin.P3_17);

            backlight.SetDriveMode(GpioPinDriveMode.Output);
            backlight.Write(GpioPinValue.Low);

            var displayController = DisplayController.GetDefault();

            // Enter the proper display configurations
            displayController.SetConfiguration(new ParallelDisplayControllerSettings {
                Width                    = 320,
                Height                   = 240,
                DataFormat               = DisplayDataFormat.Rgb565,
                PixelClockRate           = 15_000_000,
                PixelPolarity            = false,
                DataEnablePolarity       = true,
                DataEnableIsFixed        = true,
                HorizontalFrontPorch     = 51,
                HorizontalBackPorch      = 27,
                HorizontalSyncPulseWidth = 41,
                HorizontalSyncPolarity   = false,
                VerticalFrontPorch       = 16,
                VerticalBackPorch        = 8,
                VerticalSyncPulseWidth   = 10,
                VerticalSyncPolarity     = false,
            });
Ejemplo n.º 21
0
        private void InitRendering()
        {
            //Render Targets
            worldObjectsRender       = DisplayController.AddRenderTarget(camera.viewport.Width, camera.viewport.Height, true);
            worldShadowsRender       = DisplayController.AddRenderTarget(camera.viewport.Width, camera.viewport.Height, true);
            worldLightingRender      = DisplayController.AddRenderTarget(camera.viewport.Width, camera.viewport.Height, false);
            lightingMaskRender       = DisplayController.AddRenderTarget(camera.viewport.Width, camera.viewport.Height, false);
            shadowMaskInvertedRender = DisplayController.AddRenderTarget(camera.viewport.Width, camera.viewport.Height, false);
            shadowMaskRender         = DisplayController.AddRenderTarget(camera.viewport.Width, camera.viewport.Height, false);
            blurRender          = DisplayController.AddRenderTarget(camera.viewport.Width, camera.viewport.Height, false);
            blurRenderTwo       = DisplayController.AddRenderTarget(camera.viewport.Width, camera.viewport.Height, false);
            burntLayerRender    = DisplayController.AddRenderTarget(camera.viewport.Width, camera.viewport.Height, false);
            burntToSoftenRender = DisplayController.AddRenderTarget(camera.viewport.Width, camera.viewport.Height, false);

            //Effects
            Effectshadow = GraphicsManager.GetEffect(Engine.ContentStorage.EffectType.Shadow);
            Effectshadow.Parameters["shadowMask"].SetValue(DisplayController.GetRenderTarget(shadowMaskRender));
            Effectlighting = GraphicsManager.GetEffect(Engine.ContentStorage.EffectType.Lighting);
            Effectlighting.Parameters["lightMask"].SetValue(DisplayController.GetRenderTarget(lightingMaskRender));

            EffectshadowInverter = GraphicsManager.GetEffect(Engine.ContentStorage.EffectType.ShadowInverter);
            EffectshadowInverter.Parameters["shadowMask"].SetValue(DisplayController.GetRenderTarget(shadowMaskInvertedRender));
            EffectshadowInverter.Parameters["shadowMask"].SetValue(DisplayController.GetRenderTarget(shadowMaskInvertedRender));

            Effectsoften = GraphicsManager.GetEffect(Engine.ContentStorage.EffectType.Soften);
            Effectsoften.Parameters["Texture"].SetValue(DisplayController.GetRenderTarget(burntLayerRender));

            Effectblur = GraphicsManager.GetEffect(Engine.ContentStorage.EffectType.Blur);
        }
Ejemplo n.º 22
0
            // This couroutine is called every frame.
            IEnumerator EndOfFrame()
            {
                while (true)
                {
                    yield return(new WaitForEndOfFrame());

                    if (DisplayController.UseRenderManager && DisplayController.CheckDisplayStartup())
                    {
                        // Issue a RenderEvent, which copies Unity RenderTextures to RenderManager buffers
#if UNITY_5_2 || UNITY_5_3
                        GL.Clear(false, true, Camera.backgroundColor);
                        GL.IssuePluginEvent(DisplayController.RenderManager.GetRenderEventFunction(), OsvrRenderManager.RENDER_EVENT);
                        if (DisplayController.showDirectModePreview)
                        {
                            Camera.Render();
                        }
#else
                        Debug.LogError("GL.IssuePluginEvent failed. This version of Unity cannot support RenderManager.");
                        DisplayController.UseRenderManager = false;
#endif
                    }
                    //if we disabled the dummy camera, enable it here
                    if (_disabledCamera)
                    {
                        Camera.enabled  = true;
                        _disabledCamera = false;
                    }
                }
            }
Ejemplo n.º 23
0
        /// <summary>
        /// Initializes the hardware.
        /// </summary>
        void Initialize()
        {
            var rgbLed = new RgbLed(
                Device,
                Device.Pins.OnboardLedRed,
                Device.Pins.OnboardLedGreen,
                Device.Pins.OnboardLedBlue
                );

            rgbLed.SetColor(RgbLed.Colors.Red);

            Console.WriteLine("Initialize hardware...");

            // Analog Temp Sensor
            Console.WriteLine("Initializing analog temp sensor");
            analogTemperature = new AnalogTemperature(
                device: Device,
                analogPin: Device.Pins.A00,
                sensorType: AnalogTemperature.KnownSensorType.LM35
                );

            // display
            this.displayController = new DisplayController();

            // WiFi adapter
            Console.WriteLine("Initializaing wifi adapter.");
            Device.InitWiFiAdapter().Wait();

            rgbLed.SetColor(RgbLed.Colors.Green);
        }
Ejemplo n.º 24
0
        public static void Main()
        {
            UCMStandard.SetModel(UCMModel.UC5550);

            var gpioController    = GpioController.GetDefault();
            var displayController = DisplayController.GetDefault();

            var backlight = gpioController.OpenPin(UCMStandard.GpioPin.A);

            backlight.SetDriveMode(GpioPinDriveMode.Output);
            backlight.Write(GpioPinValue.High);

            displayController.SetConfiguration(new ParallelDisplayControllerSettings {
                Width                    = 800,
                Height                   = 480,
                DataFormat               = DisplayDataFormat.Rgb565,
                HorizontalBackPorch      = 46,
                HorizontalFrontPorch     = 16,
                HorizontalSyncPolarity   = false,
                HorizontalSyncPulseWidth = 1,
                DataEnableIsFixed        = false,
                DataEnablePolarity       = false,
                PixelClockRate           = 24_000_000,
                PixelPolarity            = false,
                VerticalBackPorch        = 23,
                VerticalFrontPorch       = 7,
                VerticalSyncPolarity     = false,
                VerticalSyncPulseWidth   = 1
            });
Ejemplo n.º 25
0
            // The main rendering loop, should be called late in the pipeline, i.e. from OnPreCull
            // Set our viewer and eye poses and render to each surface.
            void DoRendering()
            {
                // update poses once DisplayConfig is ready
                if (DisplayController.CheckDisplayStartup())
                {
                    if (_hmdConnectionError)
                    {
                        _hmdConnectionError = false;
                        Debug.Log("[OSVR-Unity] HMD connection established. You can ignore previous error messages indicating Display Startup failure.");
                    }

                    // update the viewer's head pose
                    // currently getting viewer pose from DisplayConfig always
                    UpdateViewerHeadPose(GetViewerPose(ViewerIndex));

                    // each viewer updates its eye poses, viewports, projection matrices
                    UpdateEyes();
                }
                else
                {
                    if (!_hmdConnectionError)
                    {
                        //report an error message once if the HMD is not connected
                        //it can take a few frames to connect under normal operation, so inidcate when this error has been resolved
                        _hmdConnectionError = true;
                        Debug.LogError("[OSVR-Unity] Display Startup failed. Check HMD connection.");
                    }
                }
            }
Ejemplo n.º 26
0
            // This couroutine is called every frame.
            IEnumerator EndOfFrame()
            {
                while (true)
                {
                    yield return(new WaitForEndOfFrame());

                    if (DisplayController.UseRenderManager && DisplayController.CheckDisplayStartup())
                    {
                        // Issue a RenderEvent, which copies Unity RenderTextures to RenderManager buffers
#if UNITY_5_2 || UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6
                        GL.Viewport(_emptyViewport);
                        GL.Clear(false, true, Camera.backgroundColor);
                        GL.IssuePluginEvent(DisplayController.RenderManager.GetRenderEventFunction(), OsvrRenderManager.RENDER_EVENT);
                        if (DisplayController.showDirectModePreview)
                        {
                            Camera.Render();
                        }
#else
                        Debug.LogError("[OSVR-Unity] GL.IssuePluginEvent failed. This version of Unity cannot support RenderManager.");
                        DisplayController.UseRenderManager = false;
#endif
                    }
                    //if we disabled the dummy camera, enable it here
                    if (_disabledCamera)
                    {
                        Camera.enabled  = true;
                        _disabledCamera = false;
                    }
                    //Sends queued-up commands in the driver's command buffer to the GPU.
                    //only accessible in Unity 5.4+ API
#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0 || UNITY_4_7 || UNITY_4_6)
                    GL.Flush();
#endif
                }
            }
Ejemplo n.º 27
0
        /// <summary>Constructs a new instance.</summary>
        /// <param name="DigitalPin9onGSocket">Pin 9 on Socket G.</param>
        public void ConfigureDisplay()
        {
            display = DisplayController.GetDefault();

            var controllerSetting = new
                                    GHIElectronics.TinyCLR.Devices.Display.ParallelDisplayControllerSettings
            {
                Width                    = 480,
                Height                   = 272,
                DataFormat               = GHIElectronics.TinyCLR.Devices.Display.DisplayDataFormat.Rgb565,
                PixelClockRate           = 10000000,
                PixelPolarity            = false,
                DataEnablePolarity       = false,
                DataEnableIsFixed        = false,
                HorizontalFrontPorch     = 2,
                HorizontalBackPorch      = 2,
                HorizontalSyncPulseWidth = 41,
                HorizontalSyncPolarity   = false,
                VerticalFrontPorch       = 2,
                VerticalBackPorch        = 2,
                VerticalSyncPulseWidth   = 10,
                VerticalSyncPolarity     = false,
            };

            display.SetConfiguration(controllerSetting);
            display.Enable();


            Screen = Graphics.FromHdc(display.Hdc); //Calling flush on the object returned will flush to the display represented by Hdc. Only one active display is supported at this time.

            var ptr  = Memory.UnmanagedMemory.Allocate(640 * 480 * 2);
            var data = Memory.UnmanagedMemory.ToBytes(ptr, 640 * 480 * 2);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 发送药师登录状态到屏
        /// </summary>
        public void SendLoginStatus(DisplayController displayController, string screenIp, int screenPort, ushort status)
        {
            smartThreadPool.QueueWorkItem(() =>
            {
                try
                {
                    MsgLoginStatus loginStatus = new MsgLoginStatus();

                    loginStatus.RowAddress = BitConverter.GetBytes(GetScreenAddress(ScreenMsgType.LoginStatus));
                    Array.Reverse(loginStatus.RowAddress);//大小端转换

                    loginStatus.Status = BitConverter.GetBytes(status);
                    Array.Reverse(loginStatus.Status);                                  //大小端转换

                    PackSendData(displayController, screenIp, screenPort, loginStatus); //发送药师信息到屏
                }
                catch (Exception ex)
                {
                    InternalLogger.Log.Error("发送药师登录状态到屏出错:" + ex.Message);
                }
            });

            if (status == 0)//0未登录状态,清空所有
            {
                ClearAllScreen(displayController, screenIp, screenPort);
            }
        }
Ejemplo n.º 29
0
        public static void InitializeDisplay()
        {
            var backlight = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PA15);

            backlight.SetDriveMode(GpioPinDriveMode.Output);

            backlight.Write(GpioPinValue.High);

            DisplayController = GHIElectronics.TinyCLR.Devices.Display.DisplayController.GetDefault();

            var controllerSetting = new GHIElectronics.TinyCLR.Devices.Display.ParallelDisplayControllerSettings {
                // 480x272
                Width                    = 480,
                Height                   = 272,
                DataFormat               = GHIElectronics.TinyCLR.Devices.Display.DisplayDataFormat.Rgb565,
                PixelClockRate           = 10000000,
                PixelPolarity            = false,
                DataEnablePolarity       = false,
                DataEnableIsFixed        = false,
                HorizontalFrontPorch     = 2,
                HorizontalBackPorch      = 2,
                HorizontalSyncPulseWidth = 41,
                HorizontalSyncPolarity   = false,
                VerticalFrontPorch       = 2,
                VerticalBackPorch        = 2,
                VerticalSyncPulseWidth   = 10,
                VerticalSyncPolarity     = false,
            };

            DisplayController.SetConfiguration(controllerSetting);
            DisplayController.Enable();
        }
Ejemplo n.º 30
0
 // Start is called before the first frame update
 void Start()
 {
     currentDisplay = GameObject.Find("displayImage").GetComponent <DisplayController>();
     currentDisplay.Current_screen_W3 = 0;
     image = GameObject.FindGameObjectWithTag("ScreenImage");
     //source.playOnAwake = false;
 }
            void Awake()
            {
                _clientKit = ClientKit.instance;
                _displayController = FindObjectOfType<DisplayController>();

                if (recenterOnPlay)
                    SetRoomRotation();
            }
Ejemplo n.º 32
0
    void clear()
    {
        uiController.hide = true;
        uiController.clear();

        if (displayController != null)
            displayController.EraseBoard();

        displayController = null;
        mapController = null;
        gameState = null;
        result = 0;
        mode = 0;
    }
Ejemplo n.º 33
0
    void init(int modeNumber)
    {
        clear ();

        uiController.hide = false;
        uiController.reset();
        uiController.setup(modeNumber,withPruning);

        displayController = display.GetComponent<DisplayController>();
        displayController.EraseBoard();

        Board board = new Board();
        gameState = new GameState( board );

        map = new GameObject("Map");
        map.transform.parent = gameObject.transform;
        map.AddComponent<MapController>();
        mapController = map.GetComponent<MapController>();

        displayController.DisplayBoard(gameState,map.transform);

        mapController.gameState = gameState;
    }
 void Awake()
 {
     _clientKit = FindObjectOfType<ClientKit>();
     _displayController = FindObjectOfType<DisplayController>();
 }