Ejemplo n.º 1
0
        private static void _SetupEffect(ImGuiXNAState self, Effect _effect)
        {
            ImGuiIO io = ImGui.IO;

#if FNA
            const float translate = 0f;
#else
            const float translate = 0.5f;
#endif

            if (_effect is BasicEffect)
            {
                BasicEffect effect = (BasicEffect)_effect;
                effect.World              = Matrix.Identity;
                effect.View               = Matrix.Identity;
                effect.Projection         = Matrix.CreateOrthographicOffCenter(translate, io.DisplaySize.x + translate, io.DisplaySize.y + translate, translate, -1f, 1f);
                effect.TextureEnabled     = true;
                effect.VertexColorEnabled = true;
                return;
            }

            if (_effect is AlphaTestEffect)
            {
                AlphaTestEffect effect = (AlphaTestEffect)_effect;
                effect.World              = Matrix.Identity;
                effect.View               = Matrix.Identity;
                effect.Projection         = Matrix.CreateOrthographicOffCenter(translate, io.DisplaySize.x + translate, io.DisplaySize.y + translate, translate, -1f, 1f);
                effect.VertexColorEnabled = true;
                return;
            }

            throw new Exception("Default ImGuiXNAState.SetupEffect can't deal with " + _effect.GetType().FullName + ", please provide your own delegate.");
        }
Ejemplo n.º 2
0
        private static void _SetEffectTexture(ImGuiXNAState self, Effect _effect, Texture2D texture)
        {
            ImGuiIO io = ImGui.IO;

            if (_effect is BasicEffect)
            {
                BasicEffect effect = (BasicEffect)_effect;
                effect.Texture = texture;
                return;
            }

            if (_effect is AlphaTestEffect)
            {
                AlphaTestEffect effect = (AlphaTestEffect)_effect;
                effect.Texture = texture;
                return;
            }

            throw new Exception("Default ImGuiXNAState.SetEffectTexture can't deal with " + _effect.GetType().FullName + ", please provide your own delegate.");
        }