Esempio n. 1
0
 public static UI_SYSTEM instance()
 {
     if (Instance == null)
     {
         Instance = new UI_SYSTEM();
     }
     return(Instance);
 }
Esempio n. 2
0
        static public void Main(string[] args)
        {
            //


            //Font font = new Font("C:/Users/Пользователь/source/repos/SandySharp/SandySharp/EightBitDragon-anqx.ttf");

            //WINDOW
            window = new RenderWindow(new SFML.Window.VideoMode(640, 480), "SandySharp");
            window.SetVerticalSyncEnabled(true);
            window.Closed += Window_Closed;
            window.SetFramerateLimit(60);

            SceneManager.instance().start(window);
            SceneCreator.instance().start(window);
            //////////SCENE CREATION//////////////

            //.instance().loadScene1();
            SceneManager.instance().loadScene(SceneCreator.instance().createScene());

            Stopwatch stopwatch = new Stopwatch();

            //////////////////////////////////////


            while (window.IsOpen)
            {
                stopwatch.Restart();

                //SYSTEMS UPDATES
                SceneManager.instance().GlobalUpdate();
                TimeManager.instance().update();
                ViewSystem.Instance.update();
                BrushManager.instance().update();
                stopwatch.Stop();

                UI_SYSTEM.instance().update(stopwatch.ElapsedMilliseconds); //передаем gui данные для обновления



                window.DispatchEvents();
                window.Clear(SFML.Graphics.Color.Black);

                //DrawHere
                SceneManager.instance().DrawScene();
                UI_SYSTEM.instance().Draw();

                window.Display();
            }
        }
Esempio n. 3
0
        public void loadScene(Scene scene)
        {
            scene.initialisation();
            SceneManager.instance().setCurrentScene(scene);
            TimeManager.instance().start();
            ViewSystem.instance().start(scene.getLayers()[0].getSpriteToDraw());


            BrushManager.instance().start(scene.getLayers()[0].picture.image);

            foreach (var key in scene.colors.Keys)
            {
                BrushManager.instance().AddColor(scene.colors[key], key);
            }

            UI_SYSTEM.instance().start();
        }
Esempio n. 4
0
        public void loadScene1()
        {
            //COLORS

            Color sand1      = new Color(252, 235, 145);
            Color emptyP     = new Color(0, 0, 0);
            Color waterP     = new Color(101, 175, 182, 150);
            Color lightning  = new Color(108, 233, 236);
            Color fire       = new Color(191, 106, 2);
            byte  fireoffset = 42;
            Color fireActive = new Color(191, 148, 2);
            Color wood       = new Color(53, 33, 21);
            byte  woodoffset = 29;

            //MAIN__FIELD
            //Image image = new Image("C:/Users/Пользователь/Desktop/SandySharp/SandySharp/FirstScene.png");
            Image image       = new Image(160, 120, Color.Transparent);
            Image flame_field = new Image(160, 120, Color.Transparent);
            Image fire_field  = new Image(160, 120, Color.Transparent);

            image = Pixy.drawBorder(image);

            RenderObject picture       = new RenderObject(image);
            RenderObject flame_picture = new RenderObject(flame_field);
            RenderObject fire_picture  = new RenderObject(fire_field);

            //starts



            //SCENES AND LAYERS
            Scene scene       = new Scene(window);
            Layer main_layer  = new Layer(1, "main");
            Layer Fire_layer  = new Layer(2, "fire_layer");
            Layer flame_layer = new Layer(3, "flame_layer");



            //SIMULATIONS
            SandSimulation      sandSim      = new SandSimulation(sand1, image, "sand_sim");
            LiquidSimulation    liqSim       = new LiquidSimulation(waterP, image, "liquid_sim");
            FireSimulation      fireSim      = new FireSimulation(fire, fireoffset, wood, woodoffset, fire_field, image, waterP, "fire_sim");
            FlameSimulation     flameSim     = new FlameSimulation(fire, fireSim.getActiveFire(), fire_field, flame_field, "flame_sim");
            LightningSimulation lightningSim = new LightningSimulation(lightning, fireSim.getActiveFire(), fire_field, image, "lightning_sim");
            RainSimulation      rainSim      = new RainSimulation(waterP, lightning, image, fire_field, 0.1f, 0.08f, "rain_sim");


            scene.AddLayer(main_layer);
            scene.AddLayer(Fire_layer);
            scene.AddLayer(flame_layer);


            scene.AddObject(fireSim);
            scene.AddObject(flameSim);
            scene.AddObject(liqSim);
            scene.AddObject(sandSim);
            //scene.AddObject(lightningSim);
            //scene.AddObject(rainSim);

            main_layer.setLayerRenderObject(picture);
            Fire_layer.setLayerRenderObject(fire_picture);
            flame_layer.setLayerRenderObject(flame_picture);
            scene.initialisation();



            //SYSTEMS INICIALIZATION
            SceneManager.instance().setCurrentScene(scene);
            TimeManager.instance().start();
            ViewSystem.instance().start(picture.sprite);


            BrushManager.instance().start(image);
            BrushManager.instance().AddColor(waterP, "water");
            BrushManager.instance().AddColor(fireSim.getActiveFire(), "fire");
            BrushManager.instance().AddColor(sand1, "sand");
            BrushManager.instance().AddColor(wood, "wood");

            UI_SYSTEM.instance().start();

            //testPHYSICS
        }