Inheritance: Flood.GUI.Renderers.Renderer
示例#1
0
        void InitializeGui()
        {
            GuiRenderer = new GwenRenderer();

            var textureName = "DefaultSkin.png";
            var defaultFont = new Flood.GUI.Font("Vera.ttf", 16);

            var resMan = FloodEngine.GetEngine().ResourceManager;
            var options = new ResourceLoadOptions {Name = textureName, AsynchronousLoad = false};
            var imageHandle = resMan.LoadResource<Image>(options);
            if (imageHandle.Id == 0)
                return;

            var skin = new TexturedSkin(GuiRenderer, imageHandle, defaultFont);
            Canvas = new Canvas(skin);

            var container = new Container(Canvas);
            var paneGroup = new PaneGroup(container);
            container.InsertPanel(paneGroup);
            paneGroup.AddPane(new Pane { Title = "PANE1" });
            paneGroup.AddPane(new Pane { Title = "PANE2" });

            Input = new GwenInput(FloodEngine.GetEngine().InputManager);
            Input.Initialize(Canvas);
        }
示例#2
0
        void InitializeGui()
        {
            GuiRenderer = new GwenRenderer();

            var textureName = "DefaultSkin.png";
            var defaultFont = new Font("Vera.ttf", 16);

            var resMan = Engine.GetEngine().ResourceManager;
            var options = new ResourceLoadOptions {Name = textureName, AsynchronousLoad = false};
            var imageHandle = resMan.LoadResource<Image>(options);
            if (imageHandle.Id == 0)
                throw new Exception("Could not load GUI texture: " + textureName);

            Skin = new TexturedSkin(GuiRenderer, imageHandle, defaultFont);
            Canvas = new Canvas(Skin);

            Input = new GwenInput(Engine.GetEngine().InputManager);
            Input.Initialize(Canvas);
        }
示例#3
0
文件: GUI.cs 项目: chartly/flood
        public GUI(string textureName, string defaultFontName, int defaultFontSize)
        {
            PlatformManager = new PlatformManager(CreateWxPlatformManager());

            Engine = new Engine(PlatformManager);
            Engine.Init();

            // Search for the location of the main assets folder.
            string assetsPath;
            if (!SearchForAssetsDirectory(out assetsPath))
                throw new Exception("Editor assets were not found");

            Archive = new ArchiveVirtual();
            Archive.MountDirectories(assetsPath, Allocator.GetHeap());

            ResourceManager = Engine.ResourceManager;
            ResourceManager.Archive = Archive;

            WindowManager = Engine.WindowManager;

            MainWindow = CreateWindow();
            var context = MainWindow.CreateContext(new RenderContextSettings());

            MainView = MainWindow.CreateView();
            MainView.ClearColor = Color.Red;

            MainWindow.MakeCurrent();
            context.Init();

            RenderDevice = Engine.RenderDevice;
            RenderDevice.ActiveView = MainView;

            var options = new ResourceLoadOptions {Name = textureName, AsynchronousLoad = false};
            var imageHandle = ResourceManager.LoadResource<Image>(options);
            if (imageHandle.Id == 0)
                return;

            Renderer = new GwenRenderer();
            Skin = new TexturedSkin(Renderer, imageHandle, new Flood.GUI.Font(defaultFontName, defaultFontSize));

            if (!Directory.Exists(StoredValuesDirectory))
                Directory.CreateDirectory(StoredValuesDirectory);
        }