예제 #1
0
        public Action()
        {
            _drawer = new GraphicTools();

            //First: Clean the map
            _drawer.ClearInterface();
        }
예제 #2
0
 void IContentUpdatableFromMediaEngine.SetProjection(ProjectionMode projection)
 {
     lock (localCritical)
     {
         primitive?.Dispose();
         primitive      = GraphicTools.CreateGeometry(projection, graphicsDevice);
         projectionMode = projection;
     };
 }
예제 #3
0
 /**
  * Taptaptap is a mini-game.
  *
  * Auto-launching at instanciation
  */
 public Taptaptap()
 {
     _drawer = new GraphicTools();
     if (Stats.Player.TaptaptapScore < 1000)
     {
         StartingAnimation();
         Play();
     }
     MenuBar.Display();
 }
예제 #4
0
        /// <summary>
        /// This method is used to display the permanent UI on the top part of the console.
        /// </summary>
        public static void Display()
        {
            GraphicTools drawer                  = new GraphicTools();
            int          NumberOfTabs            = _menu.Length;
            int          TotalStringLengthOfMenu = String.Join("", _menu).Length;
            int          AvailableSpace          = (Console.WindowWidth - TotalStringLengthOfMenu);
            // 1 margin for left & right side of an element
            int MarginsSize = AvailableSpace / (NumberOfTabs * 2);

            //Line 1 - Border
            Console.BackgroundColor = ConsoleColor.Black;
            drawer.HorizontalLine(0, '-');

            //Line 2 - Items + Separators
            Console.SetCursorPosition(0, 1);
            for (int menuItem = 0; menuItem < NumberOfTabs; menuItem++)
            {
                //Margin of tabs
                //divise par 2 car 2x la même opération
                for (int j = 0; j < MarginsSize; j++)
                {
                    Console.Write(' ');
                }
                ConsoleColor previousColor = Console.ForegroundColor;
                if (Stats._activeTab != null)
                {
                    //Change the color for the active tab
                    Console.ForegroundColor = (_menu[menuItem].Contains(Stats._activeTab)) ? ConsoleColor.Green : ConsoleColor.White;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.White;
                }
                //Writing the item
                Console.Write(_menu[menuItem]);
                //Switch back the color
                Console.ForegroundColor = previousColor;
                //Spacing between tabs
                for (int j = 1; j < MarginsSize; j++)
                {
                    Console.Write(" ");
                }
                if (menuItem < NumberOfTabs - 1)
                {
                    Console.Write("|");
                }
            }

            // Line 3 - Border
            drawer.HorizontalLine(2, '-');
            drawer.Cursor_StandBy();
        }
예제 #5
0
        //Constructeur
        public Game()
        {
            Console.OutputEncoding = Encoding.UTF8;
            Console.SetWindowSize(120, 30);
            // Loading the save
            Stats.Initializer();
            GraphicTools _drawer = new GraphicTools();

            Console.Title = "CMD_ Adventure";   //define console title
            //_drawer.CrazyConsoleRandomNumber();    //<--------------------------------réactiver a la fin du dev.
            Console.ForegroundColor = _UIcolor;
            //_drawer.TitleScreen();                    //<--------------------------------réactiver a la fin du dev.
            new Taptaptap();
            _mutexLifeBar = true;
        }
예제 #6
0
        public void TrackData(float t, SharpDX.Quaternion quaternion, byte fov)
        {
            //double rad2deg = 180 / Math.PI;
            var v = GraphicTools.QuaternionToYawPitch(quaternion);
            // angle from quaternion should be always [-4PI, 4PI], no need for while loop
            double yaw     = (Math.PI * 9 + v.X) % (2 * Math.PI) - Math.PI; // => [-PI, +PI]
            double pitch   = -v.Y;                                          // => [-PI/2, PI/2]
            double yaw01   = yaw / (2 * Math.PI) + 0.5;
            double pitch01 = pitch / Math.PI + 0.5;

            TrackData(t, yaw01, pitch01, fov);

            Bivrost.Log.LoggerManager.Publish("history.t", t);
            Bivrost.Log.LoggerManager.Publish("history.yaw", yaw * 180f / Math.PI);
            Bivrost.Log.LoggerManager.Publish("history.pitch", pitch * 180f / Math.PI);
            Bivrost.Log.LoggerManager.Publish("history.yaw01", yaw01);
            Bivrost.Log.LoggerManager.Publish("history.pitch01", pitch01);
        }
예제 #7
0
        public static void Display()
        {
            GraphicTools drawer = new GraphicTools();

            while (true)
            {
                if (Game._mutexLifeBar)
                {
                    Game._mutexLifeBar = false;

                    string vie = "Vie: " + Stats.Player.Life + "/" + Stats.Player.MaxLife;
                    double coefficient_barre_de_vie = 1 + ((Stats.Player.MaxLife - Stats.Player.Life) / Stats.Player.MaxLife);

                    ConsoleColor previousBackColor = Console.BackgroundColor;
                    ConsoleColor previousForeColor = Console.ForegroundColor;

                    Console.ForegroundColor = ConsoleColor.White;
                    //dark green for visibility
                    Console.BackgroundColor = ConsoleColor.DarkGreen;
                    //avoid visual glitch
                    Console.CursorVisible = false;

                    Console.SetCursorPosition(0, 3);
                    string greenBackground = "";
                    for (int i = 0; i < Console.WindowWidth * coefficient_barre_de_vie; i++)
                    {
                        greenBackground += ' ';
                    }
                    //coloring background
                    Console.Write(greenBackground);
                    drawer.CenterWrite(3, vie);

                    Console.ForegroundColor = previousForeColor;
                    Console.BackgroundColor = previousBackColor;

                    Console.CursorVisible = true;
                    drawer.Cursor_StandBy();
                    Game._mutexLifeBar = true;
                    drawer.Wait(1000);
                }
            }
        }
예제 #8
0
        public void Setup(object pars)//ScreenCaptureParams captureParams)
        {
            logger.Debug("ScreenSource::Setup()");

            if (state != CaptureState.Closed)
            {
                throw new InvalidOperationException("Invalid capture state " + State);
            }

            syncEvent = new AutoResetEvent(false);

            VideoCaptureDevice captureParams = pars as VideoCaptureDevice;

            if (captureParams == null)
            {
                throw new ArgumentException();
            }
            var srcRect  = Rectangle.Empty;
            var destSize = Size.Empty;
            var hwnd     = IntPtr.Zero;

            if (captureParams.CaptureMode == CaptureMode.Screen)
            {
                var screenCaptParams = (ScreenCaptureDevice)pars;
                this.CaptureProps = screenCaptParams.Properties;

                srcRect = screenCaptParams.CaptureRegion;

                var srcLocation = srcRect.Location;
                var srcSize     = GraphicTools.DecreaseToEven(srcRect.Size);
                srcRect = new Rectangle(srcLocation, srcSize);

                //srcRect = new Rectangle(x, y, width, height);
                if (screenCaptParams.CaptureRegion != srcRect)
                {
                    screenCaptParams.CaptureRegion = srcRect;
                }

                destSize = captureParams.Resolution;

                if (destSize.IsEmpty)
                {
                    destSize = new Size(srcRect.Width, srcRect.Height);
                }
            }
            else if (captureParams.CaptureMode == CaptureMode.AppWindow)
            {
                var windowCaptParams = (WindowCaptureDevice)pars;
                this.CaptureProps = windowCaptParams.Properties;

                srcRect = windowCaptParams.ClientRect;

                var srcLocation = srcRect.Location;
                var srcSize     = GraphicTools.DecreaseToEven(srcRect.Size);
                srcRect = new Rectangle(srcLocation, srcSize);

                destSize = captureParams.Resolution;

                if (destSize.IsEmpty)
                {
                    destSize = new Size(srcRect.Width, srcRect.Height);
                }

                hwnd = windowCaptParams.hWnd;
            }



            try
            {
                //var captureDescr = captureParams.CaptureDescription;

                var captArgs = new object[]
                {
                    hwnd,
                };

                screenCapture = ScreenCapture.Create(CaptureProps.CaptureType, captArgs);
                screenCapture.CaptureMouse = CaptureProps.CaptureMouse;
                screenCapture.AspectRatio  = CaptureProps.AspectRatio;

                var d3d11Capture = screenCapture as ITexture2DSource;
                if (d3d11Capture != null)
                {
                    d3d11Capture.UseHwContext = CaptureProps.UseHardware;
                    this.hwContext            = d3d11Capture;
                    this.AdapterId            = d3d11Capture.AdapterId;
                }

                screenCapture.Init(srcRect, destSize);
                //screenCapture.Init(srcRect);


                this.SharedBitmap = screenCapture.VideoBuffer;

                deviceReady = true;

                state = CaptureState.Initialized;
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                LastError = ex;

                errorCode = (int)SharedTypes.ErrorCode.NotInitialized;

                CleanUp();

                state = CaptureState.Closed;
                throw;
            }
        }
예제 #9
0
 /// <summary>
 /// Add walking sound effects.
 /// </summary>
 /// <param name="walkSound">walking sound effects as a *.midi | *.wav files.</param>
 public void SetWalkingSound(GraphicTools.SoundBox walkSound)
 {
     walkingSound = walkSound;
 }