CK_MACK
20-01-2007 04:10:36
When I attempt to compile tutorial 5, I am getting several errors, which in some ways make sense. But, I am not sure how to solve them exactly.
I get:
The name 'location' does not exist in the current context.
The name 'type' does not exist in the current context.
The name 'group' does not exist in the current context.
The name 'ticks' does not exist in the current context.
I believe the 1st 3 errors come from:
ResourceGroupManager.Singleton.AddResourceLocation(location, type, group); // so I took some guesses:
After looking at the code, I can only guess the location and type... resulting in :
ResourceGroupManager.Singleton.AddResourceLocation("C:\\OgreSDK\\bin\\release", "FileSystem", group);
But I am not sure if that is the correct information for the tutorial...
And I don't know what "group" should be, or why I am getting an error with tick.
My preference would be for it to load the mesh as seen in tutorial 4.
Any help would be appreciated.
Thanks,
Marc.
I get:
The name 'location' does not exist in the current context.
The name 'type' does not exist in the current context.
The name 'group' does not exist in the current context.
The name 'ticks' does not exist in the current context.
I believe the 1st 3 errors come from:
ResourceGroupManager.Singleton.AddResourceLocation(location, type, group); // so I took some guesses:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Mogre;
using System.Drawing;
namespace Tutorial05
{
static class Program
{
[STAThread]
static void Main()
{
OgreStartup ogre = new OgreStartup();
ogre.Go();
}
}
class OgreStartup
{
Root mRoot = null;
public void Go()
{
CreateRoot();
DefineResources();
SetupRenderSystem();
CreateRenderWindow();
InitializeResourceGroups();
CreateScene();
StartRenderLoop();
}
void CreateRoot()
{
mRoot = new Root();
ResourceGroupManager.Singleton.AddResourceLocation("C:\\OgreSDK\\bin\\release", "FileSystem", group);
}
void DefineResources()
{
ConfigFile cf = new ConfigFile();
cf.Load("resources.cfg", "\t:=", true);
ConfigFile.SectionIterator seci = cf.GetSectionIterator();
String secName, typeName, archName;
while (seci.MoveNext())
{
secName = seci.CurrentKey;
ConfigFile.SettingsMultiMap settings = seci.Current;
foreach (KeyValuePair<string, string> pair in settings)
{
typeName = pair.Key;
archName = pair.Value;
ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
}
}
}
void SetupRenderSystem()
{
if (!mRoot.ShowConfigDialog())
throw new Exception("The user canceled the configuration dialog.");
}
void CreateRenderWindow()
{
mRoot.Initialise(true, "Main Ogre Window");
}
void InitializeResourceGroups()
{
TextureManager.Singleton.DefaultNumMipmaps = 5;
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
}
private void CreateScene()
{
SceneManager mgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC);
Camera cam = mgr.CreateCamera("Camera");
mRoot.AutoCreatedWindow.AddViewport(cam);
Entity ent = mgr.CreateEntity("ninja", "ninja.mesh");
mgr.RootSceneNode.CreateChildSceneNode().AttachObject(ent);
cam.Position = new Vector3(0, 200, -400);
cam.LookAt(ent.BoundingBox.Center);
// *** throw in a timer so we can end the demo after a short delay
mRoot.FrameEnded += new FrameListener.FrameEndedHandler(FrameEnded);
ticks = Environment.TickCount;
}
bool FrameEnded(FrameEvent evt)
{
if (Environment.TickCount - ticks > 10000)
return false;
return true;
}
void StartRenderLoop()
{
mRoot.StartRendering();
}
}
}
After looking at the code, I can only guess the location and type... resulting in :
ResourceGroupManager.Singleton.AddResourceLocation("C:\\OgreSDK\\bin\\release", "FileSystem", group);
But I am not sure if that is the correct information for the tutorial...
And I don't know what "group" should be, or why I am getting an error with tick.
My preference would be for it to load the mesh as seen in tutorial 4.
Any help would be appreciated.
Thanks,
Marc.