• Home
  • Products
    • Game Engine
      • Base
      • Mathematics
      • Geometry
      • Physics
      • Particles
      • Animation
      • Graphics
      • Game
      • Game UI
    • Windows Forms
      • Docking Windows
      • Text Editor Control
  • Downloads
  • Buy
    • Overview
    • Professional
    • Indie
    • Non-Commercial
  • Support
    • Overview
    • Blog
    • Forum
    • License FAQ
    • Documentation
  • About
    • About Us
      • Services
    • Contact Us
    • Press
    • Legal Terms
      • Imprint (English)
      • Imprint (German)
Select the search type
 
  • Site
  • Web
Search
DigitalRune.com
Login |Register
NEWS News RSS Feed BLOG Blog RSS Feed FORUM News RSS Feed DOCUMENTATION DigitalRune Software on YouTube DigitalRune Software on Twitter
You are here: SupportForum

If you want to contribute to the forum discussions, please Register or Login.

SearchHome
  • 1
  • 2
  • 3
  • 4
  • 5
HomeHomeDigitalRune Sof...DigitalRune Sof...Game EngineGame EngineURGENT: sprite batch is making everything go crazyURGENT: sprite batch is making everything go crazy
Previous
 
Next
New Post
5/17/2012 7:48 AM
 
falconmick
No Ranking

Joined: 5/12/2012
Posts: 17
URGENT: sprite batch is making everything go crazy  Modified By falconmick  on 5/17/2012 8:11:58 AM

#EDIT#

found solution:

add 

GraphicsDevice.BlendState = BlendState.Opaque;
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;
after any time you call 
SpriteBatch.Begin();
SpriteBatch.DrawString(SpriteFont, outputStr, position, Color.Black);
SpriteBatch.End();

http://blogs.msdn.com/b/shawnhar/arch... 

#EDIT#

for some unknown reason, when ever I call these three lines of code I get major graphical errors

SpriteBatch.Begin();
SpriteBatch.DrawString(SpriteFont, DisplayMessage, position, Color.Black);
SpriteBatch.End();
heres the graphics issue, for some reason it just makes the game go crazy.


if anyone needs it, here is the full code for this part:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
 
namespace DoTs
{
    class WordComponent : DrawableGameComponent
    {
        private wordDictionary wordDic;
        private WLvalue wordVals;
        private string[] words;
 
        protected SpriteFont SpriteFont { get; set; }
        protected SpriteBatch SpriteBatch { get; set; }
 
        public WordComponent(Game game)
            : base(game)
        {
        }
 
        protected override void LoadContent()
        {
            wordDic = new wordDictionary();
            words = new string[3];
            wordVals = new WLvalue();
            newWords();
            SpriteBatch = new SpriteBatch(GraphicsDevice);
            SpriteFont = Game.Content.Load("SpriteFont1");
        }
 
        public void newWords()
        {
            words[0] = wordDic.getLow();
            words[1] = wordDic.getMed();
            words[2] = wordDic.getHigh();
        }
 
        ///
        /// accepts from 0-2, 0 = lowVal word, 1 = medVal word, 2 = highVal word
        ///
        ///
        /// a string to be used as a goal for the player or a "" string if the wordNum is
        /// out of bounds
        public string getWord(int wordNum)
        {
            string retVal = "";
 
            if (wordNum < 3 && wordNum >= 0)
            {
                retVal = words[wordNum];
            }
 
            return (retVal);
        }
 
        public int getWordVal(int wordNum)
        {
            int retVal = -1;
 
            if (wordNum < 3 && wordNum >= 0)
            {
                retVal = wordVals.getWordVal(words[wordNum]);
            }
 
            return (retVal);
        }
 
        public override void Draw(GameTime gameTime)
        {
             
            float left = GraphicsDevice.Viewport.TitleSafeArea.Left;
            float top = GraphicsDevice.Viewport.TitleSafeArea.Top;
            Vector2 position = new Vector2(left + 90, top);
            string DisplayMessage = "";
 
            int i;
 
            for (i = 0; i < 3; i++)
            {
                DisplayMessage += getWord(i);
                DisplayMessage += " - ";
                DisplayMessage += getWordVal(i);
                DisplayMessage += "\n";
            }
 
            SpriteBatch.Begin();
            SpriteBatch.DrawString(SpriteFont, DisplayMessage, position, Color.Black);
            SpriteBatch.End();
             
            base.Draw(gameTime);
        }
 
    }
}

it is implimented into the game like this:

  protected override void Initialize()
        {
...
            Components.Add(new WordComponent(this));
 
            base.Initialize();
        }

:( please somone help me, The assignment is due tomorow, it would suck if I would have to decide between GUI and graphics

edit:

I think that the error is some how related to the z buffer getting  stuffed with... there was an object under the word which when I placed my cammera at a sertain angle the far away object was drawing over the top of the car

 
 Page 1 of 1
Previous
 
Next
HomeHomeDigitalRune Sof...DigitalRune Sof...Game EngineGame EngineURGENT: sprite batch is making everything go crazyURGENT: sprite batch is making everything go crazy


DigitalRune is a trademark of Garstenauer Information Technology OG.

Garstenauer Information Technology OG
Weingartenstrasse 35, 4452 Ternberg
Austria (EUROPE)
office@digitalrune.com

Home Products Downloads Buy Support About Us
Game Engine Particles Windows Forms Professional Blog Services
Base Animation Docking Windows Indie Forum Contact Us
Mathematics Graphics Text Editor Control Non-Commercial License FAQ Press (News)
Geometry Game Documentation Legal Terms
Physics Game UI Imprint
Impressum
Copyright © 2006-2012 Garstenauer Information Technology OG Terms Of UsePrivacy Statement