Beispiel #1
0
        protected override void DrawWindowContent()
        {
            // left
            {
                Vector2 childSize = ImGui.GetContentRegionAvail();
                childSize.X *= 0.2f;
                ImGui.BeginChild("##left", childSize);
                {
                    ImGuiUtils.BeginGroupFrame();

                    if (ImGui.Button("Load"))
                    {
                        ImGuiStyleConfig.Load(new IniConfig("style"));
                    }

                    ImGuiUtils.SmartSeparator();

                    if (ImGui.Button("Save"))
                    {
                        ImGuiStyleConfig.Save(new IniConfig("style"));
                    }

                    ImGuiUtils.EndGroupFrame();
                }
                ImGui.EndChild();
            }

            ImGui.SameLine();

            // right
            {
                Vector2 childSize = ImGui.GetContentRegionAvail();
                ImGui.BeginChild("##right", childSize);
                {
                    ImGui.ShowStyleEditor();

                    ImGui.EndChild();
                }
                ImGui.EndChild();
            }
        }
Beispiel #2
0
        public override void OnAttach()
        {
            //dockspaceIconTexture = new Rendering.Textures.Texture(Properties.Resources.DefaultWindowIcon.ToBitmap());
            //dockspaceIconTexture.SetFilterParameter(Rendering.Textures.FilterParameter.Nearest);

            if (!LoadConfig(EditorConfig))
            {
                PushModal(new ActionModal("Config seems to be corrupted!", ActionModal.ButtonFlags.OK));
            }
            if (!ImGuiStyleConfig.Load(new IniConfig("style")))
            {
                PushModal(new ActionModal("Config seems to be corrupted!", ActionModal.ButtonFlags.OK));
            }

            // --- test code
            Context.Scene = new Scene();
            for (int i = -5; i <= 5; i++)
            {
                if (i == 0)
                {
                    Entity okl = Context.Scene.CreateEntity();
                    okl.Transform.WorldPosition = new Vector3(i, 0, 0);
                    okl.AddComponent(new TagComponent("Main"));
                    okl.AddComponent(new SpriteRendererComponent()
                    {
                        Color = new Vector4(0, 1, 0, 1)
                    });
                    okl.AddComponent(new CameraComponent(new OrthographicCamera()
                    {
                        OrthographicSize = 10
                    }));
                    continue;
                }
                Entity ent = Context.Scene.CreateEntity();
                ent.Transform.WorldPosition = new Vector3(i, 0, 0);
                ent.AddComponent(new SpriteRendererComponent()
                {
                    Color = new Vector4(1, 1, 1, 1),                                              /*Sprite = new CrossEngine.Rendering.Sprites.Sprite(AssetManager.Textures.LoadTexture("textures/prototype_512x512_grey1.png"))*/
                });
                ent.AddComponent(new TagComponent("asd" + i));
                ent.AddComponent(new RigidBodyComponent()
                {
                    LinearFactor = new Vector3(1, 1, 0), AngularFactor = new Vector3(0, 0, 1)
                });
                ent.AddComponent(new Box2DColliderComponent());
            }

            Entity ground = Context.Scene.CreateEntity();

            ground.Transform.Scale    = new Vector3(10, 1, 1);
            ground.Transform.Position = new Vector3(0, -5, 0);
            ground.AddComponent(new SpriteRendererComponent()
            {
                Color = new Vector4(1, 1, 1, 1),                                                 /*Sprite = new CrossEngine.Rendering.Sprites.Sprite(AssetManager.Textures.LoadTexture("textures/prototype_512x512_grey1.png"))*/
            });
            ground.AddComponent(new RigidBodyComponent()
            {
                Mass = 0, Static = true, LinearFactor = new Vector3(1, 1, 0), AngularFactor = new Vector3(0, 0, 1)
            });
            ground.AddComponent(new Box2DColliderComponent());
            //ground.AddComponent(new ExcComponent());

            //CrossEngine.Serialization.Json.JsonSerializer serializer = new CrossEngine.Serialization.Json.JsonSerializer(CrossEngine.Serialization.Json.JsonSerialization.CreateBaseConvertersCollection());
            //string json = serializer.Serialize(Scene);
            //Log.App.Debug(json);
            //CrossEngine.Serialization.Json.JsonDeserializer deserializer = new CrossEngine.Serialization.Json.JsonDeserializer(CrossEngine.Serialization.Json.JsonSerialization.CreateBaseConvertersCollection());
            //Scene = (Scene)deserializer.Deserialize(json, typeof(Scene));

            Application.Instance.Window.SetVSync(false);

            // ---
        }