예제 #1
0
파일: Program.cs 프로젝트: elfen20/iseskin
        private void Initialize()
        {
            //Bitmap32.Loader = new SkiaBitmap32Loader();

            string configFile = FileSystem.Combine(FileSystem.ProgramDirectory, "../../../config", "IseSkin.ini");

            config = IniReader.FromFile(configFile);

            renderer = new Glfw3Renderer();
            if (!renderer.IsAvailable)
            {
                throw new Exception("renderer is not available!");
            }
            IRenderDevice[] devs = renderer.GetDevices();
            if (devs.Length < 1)
            {
                throw new Exception("no devices found");
            }
            renderer.Closed             += WindowClosed;
            renderer.MouseButtonChanged += MBChanged;
            renderer.FrameBufferChanged += FBChanged;
            renderer.Initialize(devs[0], RendererMode.Window, RendererFlags.WaitRetrace, 1024, 768, "OpenGL Test");
            iseSkin = new IseSkin(renderer);
            UpdateConfig();
            initDone = true;
        }
예제 #2
0
파일: Program.cs 프로젝트: elfen20/iseskin
 private void MBChanged(object sender, glfw3.MouseButtonEventArgs e)
 {
     if (e.Button == glfw3.MouseButton.ButtonLeft)
     {
         Vector3 pos = IseSkin.PositionTransform(Vector3.Create(e.PositionNorm.X, e.PositionNorm.Y, 0));
         //iseSkin.Sprites["3"].Sprite.Position = pos;
     }
     if (e.Button == glfw3.MouseButton.ButtonRight)
     {
         UpdateConfig();
     }
 }
예제 #3
0
        public void AlignSprite()
        {
            Vector3 translate = Vector3.Empty;

            switch (Alignment & BoxAlignment.XFlags)
            {
            case BoxAlignment.Left:
                translate.X = (Sprite.Scale.X - MaxSize.X) / 2f;
                break;

            case BoxAlignment.Center:
                translate.X = 0;
                break;

            case BoxAlignment.Right:
                translate.X = (MaxSize.X - Sprite.Scale.X) / 2f;
                break;

            default:
                throw new Exception(string.Format("Invalid alignment '{0}'!", Alignment & BoxAlignment.XFlags));
            }
            switch (Alignment & BoxAlignment.YFlags)
            {
            case BoxAlignment.Top:
                translate.Y = (Sprite.Scale.Y - MaxSize.Y) / 2f;
                break;

            case BoxAlignment.Center:
                translate.Y = 0;
                break;

            case BoxAlignment.Bottom:
                translate.Y = (MaxSize.Y - Sprite.Scale.Y) / 2f;
                break;

            default:
                throw new Exception(string.Format("Invalid alignment '{0}'!", Alignment & BoxAlignment.YFlags));
            }
            Sprite.Position = IseSkin.PositionTransform(Position + translate);
        }