This project is read-only.

GUI doesnt display, 3D Content looks strange now

Sep 27, 2011 at 10:41 PM

Hey Devs,

i tried to implement your GUI into my Game but it does not work like I want it to.

I followed your sample but if I draw my GameComponent (which is in fact my gui) i get some strange blue screen or something like that (see image: http://www.abload.de/img/llll38id.jpg).

My Code is:

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Ruminate.GUI.Content;
using Ruminate.GUI.Framework;
using Ruminate.Utils;
using Ruminate;

namespace Project_eXistence
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class Login : Microsoft.Xna.Framework.DrawableGameComponent
    {
        RuminateGUI gui;
        Game gcgame;

        public Login(Game game)
            : base(game)
        {
            gcgame = game;
            // TODO: Construct any child components here
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {

            gui = new RuminateGUI(gcgame);
            base.Initialize();
        }

        protected override void LoadContent()
        {
            #region GUI Themes
            var cursor = gcgame.Content.Load<Texture2D>("SonsGui/Cursor");
            var font = gcgame.Content.Load<SpriteFont>("SonsGui/TextBox");
            var bTheme = new BorderTheme
            {
                BackGround = gcgame.Content.Load<Texture2D>("Default/BackGround"),
                BorderBackGround = gcgame.Content.Load<Texture2D>("Default/BorderBackGround"),

                EdgeStencil = gcgame.Content.Load<Texture2D>("Default/EdgeStencil"),
                CornerStencil = gcgame.Content.Load<Texture2D>("Default/CornerStencil"),

                EdgeOverlay = gcgame.Content.Load<Texture2D>("Default/EdgeOverlay"),
                CornerOverlay = gcgame.Content.Load<Texture2D>("Default/CornerOverlay"),

                Margine = 1
            };

            var bThemeThin = new BorderTheme
            {
                BackGround = gcgame.Content.Load<Texture2D>("Thin/BackGround"),
                BorderBackGround = gcgame.Content.Load<Texture2D>("Thin/BorderBackGround"),

                EdgeStencil = gcgame.Content.Load<Texture2D>("Thin/EdgeStencil"),
                CornerStencil = gcgame.Content.Load<Texture2D>("Thin/CornerStencil"),

                EdgeOverlay = gcgame.Content.Load<Texture2D>("Thin/EdgeOverlay"),
                CornerOverlay = gcgame.Content.Load<Texture2D>("Thin/CornerOverlay"),

                Margine = 1

            };
            #endregion
            var pan01 = new Pannel(5, 5, 150, 150, bThemeThin);
            pan01.AddChild(new TextBox(4,4,220,95,200,cursor,font,""));

            gui.AddElement(pan01);
            base.LoadContent();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here
            gui.Update();
            base.Update(gameTime);
            
        }

        public override void Draw(GameTime gameTime)
        {
            gui.Draw();
            base.Draw(gameTime);
            
        }
    }
}

I hope you can help me! :)

greetings,

Marvin

Sep 29, 2011 at 4:15 AM

Hey do you mind sending me the entire project including the content? Otherwise I'm just guessing. Most likely it has to do with my code changing a rendering state value and not setting it back to default or a conflict in how we handle transparency. 

If you don't attach it to an email to scott.franks.1990@gmail.com or post it here.

Oct 3, 2011 at 4:25 PM

Most likely its my code is altering a state, probably transparency, which is not being restored before your drawing code. If you comment out the drawing bit and the error persists but removing both the drawing and initialization of the GUI fixes the problem then you most likely need your alpha blending set to something other than Premultiplied which is what my GUI sets it to.

Nov 28, 2011 at 9:41 PM

Just wanting to say that I found the bug causing this and it has been fixed as of 1.0.2.