Creating a template from AoS

Aug 2, 2012 at 4:01 AM
Edited Aug 2, 2012 at 4:15 AM

I am trying to create a template from AoS source code and am getting error in the OptionsMenu.cs which is 

Error 1 The type or namespace name 'Xna' could not be found (are you missing a using directive or an assembly reference?) c:\users\\documents\visual studio 2010\Projects\Shooter\Shooter\Shooter\UI\Menus\OptionsMenu.cs 44 42 Shooter

I'm not sure as to why I am getting the error as all the code for that is the same as it is in AoS and I don't get that error in the AoS project. If I add Indiefreaks. in front of it the error goes away. Anyone else have this issue?

Also I am getting an error with one of the textures from AoS in my project which is:

Error 1 Invalid texture. Face 0 is sized 72x235, but textures using DXT compressed formats must be multiples of four. C:\Users\\documents\visual studio 2010\Projects\Shooter\Shooter\ShooterContent\Textures\FX\bullet_diffuse.png Shooter


I'm going to replace the graphics later but wanna figure out why it won't work like it does in AoS.

Aug 2, 2012 at 5:52 AM
Edited Aug 2, 2012 at 6:44 AM

Also when testing it on the Windows Phone in my created project I get this exception:

Indiefreaks.Xna.Core.ContentLoadingException was unhandled  Message=Type 'Indiefreaks.AceOnSteroids.Components.InfiniteRotateComponent' not registered with the serialization type dictionary.  StackTrace:       at Indiefreaks.Xna.Core.GameState.<Load>b__2()       at Indiefreaks.Xna.Threading.ThreadPool.Update()       at Indiefreaks.Xna.Core.Application.Update(GameTime gameTime)       at Microsoft.Xna.Framework.Game.Tick()       at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)       at Microsoft.Xna.Framework.GameHost.OnIdle()       at Microsoft.Xna.Framework.MobileGameHost.RunOneFrame()       at Microsoft.Xna.Framework.MobileGameHost.gameLoopTimer_Tick(Object sender, EventArgs e)       at Microsoft.Xna.Framework.DispatcherTimerWin32.TimerElapsed(IntPtr hWnd, UInt32 uMsg, IntPtr nIDEvent, UInt32 uTime)  InnerException:        Message=Type 'Indiefreaks.AceOnSteroids.Components.InfiniteRotateComponent' not registered with the serialization type dictionary.       StackTrace:            at U.q.qy(String , String , String )            at U.P.qr(d )            at U.P.qi(O )            at SynapseGaming.LightingSystem.Serialization.SerializationHelper.LoadFromXml[T](String xml)            at SynapseGaming.LightingSystem.Rendering.Scene.jA(String )            at SynapseGaming.LightingSystem.Processors.SceneReader_Pro.Read(ContentReader input, Scene instance)            at Microsoft.Xna.Framework.Content.ContentReader.InvokeReader[T](ContentTypeReader reader, Object existingInstance)            at Microsoft.Xna.Framework.Content.ContentReader.ReadObjectInternal[T](Object existingInstance)            at Microsoft.Xna.Framework.Content.ContentReader.ReadObject[T]()            at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()            at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)            at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)            at SynapseGaming.LightingSystem.Core.ContentRepository.Load[T](String xnbassetpath)            at Indiefreaks.Xna.Rendering.SunBurnLayer.LoadContent(IContentCatalogue catalogue, ContentManager manager)            at Indiefreaks.Xna.Core.ContentCatalogue.Add(IContentHost host)            at Indiefreaks.Xna.Core.GameState.LoadAsynchronously()            at Indiefreaks.Xna.Threading.DelegateWork.DoWork()            at Indiefreaks.Xna.Threading.WorkItem.DoWork(Int32 expectedId)            at Indiefreaks.Xna.Threading.Task.DoWork()            at Indiefreaks.Xna.Threading.BackgroundWorker.WorkLoop()            at System.Threading.ThreadHelper.ThreadStartHelper(ThreadHelper t)            at System.Threading.ThreadHelper.ThreadStart_Context(Object state)            at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)            at System.Threading.ThreadHelper.ThreadStartHelper()

I have the component thats needed in the project so I am not sure why I am getting the exception as it works fine when I run it in Windows.

Also I was wondering does IGF and Synampse gaming have a portrait logo as when I had it in portrait mode they weren't full screen. If not that's okay, I guess it'll just have to do.

Aug 2, 2012 at 12:59 PM

I believe most of your issues should be solved by answering the first one.

Since you are creating your own template, I cannot help you unless you show me some of the code you have in the OptionsMenu. Just share it here and I'll see what it could be.

For the invalid texture, you need to set the Power of 2 property to true in the texture ContentProject properties as it is what is expected.

Aug 2, 2012 at 4:17 PM
Edited Aug 2, 2012 at 4:43 PM

Hi Philippe,


Will this also fix the issue with the InfiniteRotateComponent? ALso thanks with the help with the texture. I had to set the .fbx to the power of 2 and the build actions to none and it worked. Here is the code that is in the OptionsMenu:



using System;
using Indiefreaks.Xna.Core;
using Indiefreaks.Xna.Logic;
using Indiefreaks.Xna.Rendering.Gui;
using Indiefreaks.Xna.Sessions;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Media;

namespace Shooter.UI.Menus
    public class OptionsMenu : Screen, IContentHost
        private readonly Image _backgroundImage;
        private readonly Label _volumeLabel;
        private readonly Label _percentageVolumeLabel;
        private readonly Button _minusButton;
        private readonly Button _plusButton;

        public OptionsMenu():base(true, true, SessionManager.GetIdentifiedPlayer(LogicalPlayerIndex.One).Input)
            Alpha = 0f;

            _backgroundImage = new Image("Textures/UI/1pixel") { Color = Color.Black * 0.75f };

            _volumeLabel = new Label("Fonts/GuiFontBig", "VOLUME:");
            _percentageVolumeLabel = new Label("Fonts/GuiFontBig", GetCurrentVolume());

            _minusButton = new Button("Fonts/GuiFontBig", "-");
            _minusButton.Clicked += OnMinusButtonClicked;
            _plusButton = new Button("Fonts/GuiFontBig", "+");
            _plusButton.Clicked += OnPlusButtonClicked;


        public override void HandleInput(Indiefreaks.Xna.Input.PlayerInput input, GameTime gameTime)
            if (input.ThumbSticks.LeftStick.X < 0f)
                OnMinusButtonClicked(null, EventArgs.Empty);
            else if (input.ThumbSticks.LeftStick.X > 0f)
                OnPlusButtonClicked(null, EventArgs.Empty);

            base.HandleInput(input, gameTime);

        private void OnMinusButtonClicked(object sender, EventArgs e)
            if (ShooterApplication.Volume == 0)

            ShooterApplication.Volume = Math.Max(0, ShooterApplication.Volume - 10);
            MediaPlayer.Volume = ((float)ShooterApplication.Volume) / 100f;
            _percentageVolumeLabel.Text = GetCurrentVolume();

        private void OnPlusButtonClicked(object sender, EventArgs e)
            if (ShooterApplication.Volume == 100)

            ShooterApplication.Volume = Math.Min(100, ShooterApplication.Volume + 10);
            MediaPlayer.Volume = ((float)ShooterApplication.Volume) / 100f;
            _percentageVolumeLabel.Text = GetCurrentVolume();
        #region Implementation of IContentHost

        public void LoadContent(IContentCatalogue catalogue, ContentManager manager)

            _backgroundImage.Scale = new Vector2(Application.Graphics.PreferredBackBufferWidth, Application.Graphics.PreferredBackBufferHeight);

            var viewportY = Application.Graphics.PreferredBackBufferHeight/2;

            _volumeLabel.X = Application.Graphics.PreferredBackBufferWidth/2 - (_volumeLabel.Width + _minusButton.Width + _percentageVolumeLabel.Width + _plusButton.Width + 75)/2;
            _volumeLabel.Y = viewportY;

            _minusButton.X = _volumeLabel.X + _volumeLabel.Width + 25;
            _minusButton.Y = viewportY;

            _percentageVolumeLabel.X = _minusButton.X + _minusButton.Width + 25;
            _percentageVolumeLabel.Y = viewportY;

            _plusButton.X = _percentageVolumeLabel.X + _percentageVolumeLabel.Width + 25;
            _plusButton.Y = viewportY;


        #region Implementation of IContentHost

        public void UnloadContent(IContentCatalogue catalogue)


        private string GetCurrentVolume()
            return ShooterApplication.Volume.ToString() + "%";
Aug 3, 2012 at 9:19 AM

This is the line that seems to send you an exception based on your above log (line 44, column 42):

public override void HandleInput(Indiefreaks.Xna.Input.PlayerInput input, GameTime gameTime)

If that is the case, but I doubt it, it would mean that you forgot to add the Indiefreaks.Game.Framework.dll reference to the project owning this class.


As for your InfiniteRotateComponent related exception, this seems to be an issue due to the fact you're trying to load this component from the Scene file while it isn't meant to be saved/loaded (it doesn't implement any serialization/deserialization logic).

I would recommend you to have a look at your Scene file in the content project and look for the InfiniteRotateComponent in the xml content. Remove it and build it again to see if you still find the issue.
Normally, this component should be added in the game by code.