protected override void Initialize()
 {
     try
     {
         Perf.Time($"{nameof(NeedlesslyComplexMainGame)}.Initialize", () =>
         {
             CurrentGame.Init(this);
             Resources.Init();
             // @todo #1 Bug: Update the GraphicsDeviceManager in the constructor, to avoid the window being mispositioned and visibly changing size
             CurrentDisplay.Init(_graphics, _display);
             Window.Position = new Point((GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width - CurrentDisplay.GameWidth) / 2,
                                         (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - CurrentDisplay.GameHeight) / 2 - 40); // Delete this once the above issue is fixed
             IsMouseVisible    = true;
             _uiSpriteBatch    = new SpriteBatch(GraphicsDevice);
             _worldSpriteBatch = new SpriteBatch(GraphicsDevice);
             Input.SetController(_controller);
             World.Init(_worldSpriteBatch);
             UI.Init(_uiSpriteBatch);
             _scene.Init();
             base.Initialize();
         });
     }
     catch (Exception e)
     {
         _errorHandler.Handle(new Exception("Error while Initializing MonoDragons Core engine", e));
     }
 }
Example #2
0
        static void Main(string[] args)
        {
            WeatherData    weatherData    = new WeatherData();
            CurrentDisplay currentDisplay = new CurrentDisplay(weatherData);

            weatherData.Set(12, 24);
            Console.Read();
        }
Example #3
0
        static void Main(string[] args)
        {
            Title.UpperIndent(Assembly.GetExecutingAssembly());

            var weaterStation  = new WeaterStation();
            var currentDisplay = new CurrentDisplay(weaterStation);

            TestMethod(weaterStation);

            Title.BottonIndent();
        }
Example #4
0
 private void InitDisplayIfNeeded()
 {
     if (!_areScreenSettingsPreCalculated)
     {
         var widthScale  = (float)GraphicsDevice.DisplayMode.Width / _defaultScreenSize.Width;
         var heightScale = (float)GraphicsDevice.DisplayMode.Height / _defaultScreenSize.Height;
         var scale       = widthScale > heightScale ? heightScale : widthScale;
         _display = new Display((int)Math.Round(_defaultScreenSize.Width * scale), (int)Math.Round(_defaultScreenSize.Height * scale),
                                true, scale);
     }
     CurrentDisplay.Init(_display);
 }
        protected override BitMatrix Transform()
        {
            InvocationCount++;
            switch (InvocationCount)
            {
            case 1:
                SubsequentDelayMs = 200;
                return(FruitMachine1());

            case 2:
                return(FruitMachine2());

            case 3:
                return(FruitMachine3());

            case 4:
                return(FruitMachine4());

            case 5:
                return(FruitMachine5());

            case 6:
                return(FruitMachine6());

            case 7:
                return(FruitMachine7());

            case 8:
                SubsequentDelayMs = 1000;
                return(FruitMachine8());

            default:
                try
                {
                    var bitmaps = CloneOriginals();
                    if (_currentDisplay == CurrentDisplay.Name)
                    {
                        for (var i = 0; i < 8; ++i)
                        {
                            bitmaps[i] = new BitArray(140);
                        }
                    }
                    return(bitmaps);
                }
                finally
                {
                    _currentDisplay = _currentDisplay == CurrentDisplay.Blank ? CurrentDisplay.Name : CurrentDisplay.Blank;
                }
            }
        }
        public void Display(ScriptVariable name = null)
        {
            var mode = name?.Name;

            if (mode != null)
            {
                if (!KalkDisplayModeHelper.TryParse(mode, out var fullMode))
                {
                    throw new ArgumentException($"Invalid display name `{mode}`. Expecting `std`, `dev` or `eng`.", nameof(name));
                }
                CurrentDisplay = fullMode;
            }

            WriteHighlightLine($"# Display mode: {CurrentDisplay.ToText()} ({CurrentDisplay})");
        }
Example #7
0
        static void ClassicWeather()
        {
            WeatherData    KyivWeather = new WeatherData();
            WeatherData    LvivWeather = new WeatherData();
            CurrentDisplay curDisplay  = new CurrentDisplay(KyivWeather);

            LvivWeather.RegisterObs(curDisplay);
            new ForecastDisplay(LvivWeather);
            LvivWeather.RegisterObs(new FormDisplay());
            for (int i = 0; i < 30; i++)
            {
                KyivWeather.SetMeasurement(GenerateWeather("Kyiv"));
                LvivWeather.SetMeasurement(GenerateWeather("Lviv"));
                Thread.Sleep(100);
            }
        }
Example #8
0
        protected void OnMove(object sender, EventArgs e)
        {
            if (inWindowModeTransition)
            {
                return;
            }

            if (WindowMode.Value == Configuration.WindowMode.Windowed)
            {
                // Values are clamped to a range of [-0.5, 1.5], so if more than half of the window was
                // outside of the combined screen area before the game was closed, it will be moved so
                // that at least half of it is on screen after a restart.
                windowPositionX.Value = Position.X;
                windowPositionY.Value = Position.Y;
            }

            windowDisplayIndex.Value = CurrentDisplay.GetIndex();
        }
Example #9
0
 protected override void Initialize()
 {
     Perf.Time($"{nameof(NeedlesslyComplexMainGame)}.Initialize", () =>
     {
         CurrentGame.Init(this);
         Resources.Init();
         InitDisplayIfNeeded();
         // @todo #1 Bug: Update the GraphicsDeviceManager in the constructor, to avoid the window being mispositioned and visibly changing size
         CurrentDisplay.Init(_graphics, _display);
         Window.Position = new Point(0, 0); // Delete this once the above issue is fixed
         IsMouseVisible  = true;
         _sprites        = new SpriteBatch(GraphicsDevice);
         Input.SetController(_controller);
         World.Init(_sprites);
         UI.Init(_sprites);
         _scene.Init();
         base.Initialize();
     });
 }
Example #10
0
 protected override BitMatrix Transform()
 {
     InvocationCount++;
     switch (InvocationCount)
     {
         case 1:
             SubsequentDelayMs = 200;
             return FruitMachine1();
         case 2:
             return FruitMachine2();
         case 3:
             return FruitMachine3();
         case 4:
             return FruitMachine4();
         case 5:
             return FruitMachine5();
         case 6:
             return FruitMachine6();
         case 7:
             return FruitMachine7();
         case 8:
             SubsequentDelayMs = 1000;
             return FruitMachine8();
         default:
             try
             {
                 var bitmaps = CloneOriginals();
                 if (_currentDisplay == CurrentDisplay.Name)
                 {
                     for (var i = 0; i < 8; ++i)
                     {
                         bitmaps[i] = new BitArray(140);
                     }
                 }
                 return bitmaps;
             }
             finally
             {
                 _currentDisplay = _currentDisplay == CurrentDisplay.Blank ? CurrentDisplay.Name : CurrentDisplay.Blank;
             }
     }
 }
Example #11
0
 protected override void Initialise(BitMatrix originals)
 {
     base.Initialise(originals);
     _currentDisplay = CurrentDisplay.Blank;
 }
Example #12
0
 public ClickUI()
     : this(CurrentDisplay.Get())
 {
 }
Example #13
0
 private void UpdateDisplay()
 {
     CurrentDisplay.UpdateDisplay(Display.ActualWidth, Display.ActualHeight);
 }
 protected override void Initialise(BitMatrix originals)
 {
     base.Initialise(originals);
     _currentDisplay = CurrentDisplay.Blank;
 }
Example #15
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            //Instantiate and construct
            database = new StorageDB(DBNameString);
            //Now
            UpdateLastLoadedDate(DateTime.Now);
            DisplayDB = new CurrentDisplay();

            this.DataContext = this;
        }