Example #1
0
        internal static void AlertWindowResized(DWindow window)
        {
            GL.Viewport(0, 0, window.Width, window.Height);

            IVector res = new IVector(window.Width, window.Height);

            gridSize = res / (new IVector(1920, 1080) / hdScale);

            cachedUnitSize             = GetUnitSize(gridSize);
            cachedUnitScreenPositions  = new Vector[gridSize.y * gridSize.x];
            cachedUnitFontPositions    = new Vector[gridSize.y * gridSize.x];
            cachedUnitForegroundColors = new Color[gridSize.y * gridSize.x];
            cachedUnitBackgroundColors = new Color[gridSize.y * gridSize.x];

            IVector oldSize = rootCanvas.Size;

            bool rootCanvasSizeChanged = gridSize != oldSize;

            CBuffer oldBuffer = rootBuffer;

            rootCanvas.ChangeSize(gridSize);
            rootBuffer = rootCanvas.buffer;

            rootCanvas.SignalRender();

            if (rootCanvasSizeChanged)
            {
                window.Title = $"Dae | Size: {gridSize.x}x{gridSize.y}";
            }

            unitMaterial?.Set("size", GetUnitSize(gridSize) * unitScale);

            CBuffer.Blit(oldBuffer, rootBuffer, IVector.zero, oldBuffer.Size, IVector.zero);

            for (int y = 0; y < gridSize.y; y++)
            {
                for (int x = 0; x < gridSize.x; x++)
                {
                    CUnit unit = rootBuffer[x, y];
                    int   aPos = (y * gridSize.x) + x;
                    cachedUnitScreenPositions[aPos] = DMath.P01ToN1P1(GetCorrectedPosition(new Vector(x, y))).ReversedYFull;
                }
            }
        }
Example #2
0
        // Initialize/Start DAE
        internal static void Start()
        {
            rootBuffer = new CBuffer(new IVector(0, 0));
            rootCanvas = new RootCanvas(rootBuffer, RenderTarget.defaultRenderTarget);

            DWindow window = new DWindow();

            window.ProcessEvents();
            window.RenderFrameToScreen();

            // Initialize the static Graphics class
            Graphics.Initialize();

            // Clear out the screen (make sure it's not white when we start up the window) (Burns my eyes)
            GL.ClearColor(0, 0, 0, 1);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            window.Title = "LOADING ...";

            window.RenderFrameToScreen();

            window.Title = "LOADING PLUGINS ...";

            // Initialize PluginSystem
            PluginSystem.LoadPluginsFromAssembly(Assembly.GetExecutingAssembly());

            PluginSystem.LoadDllsFromPath(Util.CurrentPath + "Plugins/");

            window.Title = "LOADING START-UP SCRIPT...";

            Loader.PrepareScript();
            Loader.Run();

            Foo foo = new Foo(new IVector(30, 20));

            rootCanvas.AddComponent(foo);

            Button b1 = new Button(new IVector(15, 5));

            b1.position += 1;
            foo.AddComponent(b1);

            Button b2 = new Button(new IVector(15, 5));

            b2.position = b1.Size + 1;
            foo.AddComponent(b2);

            Time.OnSecond += OnSecond;

            window.Title = "Dae";

            IsRunning = true;

            logicTickThread = new Thread(TickLoop);
            logicTickThread.Start();

            // Enter the main loop
            Run();

            // Actually shutdown/free DAE from the system (GPU, Hooks & Memory)
            Shutdown();
        }
Example #3
0
 internal static void AlertWindowClosing(DWindow window)
 {
     window.closing = true;
 }
Example #4
0
 internal static void AlertWindowCreated(DWindow window)
 {
     windows.Add(window);
 }
Example #5
0
 public void Regenerate(DWindow window)
 {
     Regenerate(new Vector(window.Width, window.Height));
 }
Example #6
0
 public RenderTarget(DWindow window, bool isStatic = false)
 {
     allRenderTargets.Add(this);
     GenerateFrameBuffer(new Vector(window.Width, window.Height));
     this.isStatic = isStatic;
 }