Namespace declaration

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles Simpsons

    #1

    Namespace declaration

    Hello.
    I am trying to convert a C# to VB.NET.
    Can you please tell me what I'm doing wrong and how I can fix it?
    I am getting the error "Namespace declarations can only be used..."
    Thank you!

    This is my module:

    Imports System
    Imports System.Collecti ons.Generic
    Imports System.Text

    Module Module1

    Namespace Mogre.Demo.BSP
    Class Program
    Private Shared Sub Main(ByVal args As String())
    Try
    Dim app As New BspApplication( )
    app.Go()
    Catch generatedExcept ionName As
    System.Runtime. InteropServices .SEHException
    ' Check if it's an Ogre Exception
    If OgreException.I sThrown Then
    ExampleApplicat ion.Example.Sho wOgreException( )
    Else
    Throw
    End If
    End Try
    End Sub
    End Class

    Class BspApplication
    Inherits Mogre.Demo.Exam pleApplication. Example
    Private quakePk3 As String
    Private quakeLevel As String

    Private loadingBar As New
    Mogre.Demo.Exam pleApplication. LoadingBar()

    Public Overloads Overrides Sub LoadResources()
    loadingBar.Star t(window, 1, 1, 0.75F)

    ' Turn off rendering of everything except overlays
    sceneMgr.ClearS pecialCaseRende rQueues()

    sceneMgr.AddSpe cialCaseRenderQ ueue(CByte(Rend erQueueGroupID. RENDER_QUEUE_OV ERLAY))
    'fix: RenderQueueGrou pID.RENDER_QUEU E_OVERLAY

    sceneMgr.SetSpe cialCaseRenderQ ueueMode(SceneM anager.SpecialC aseRenderQueueM ode.SCRQM_INCLU DE)

    ' Set up the world geometry link

    ResourceGroupMa nager.Singleton .LinkWorldGeome tryToResourceGr oup(ResourceGro upManager.Singl eton.WorldResou rceGroupName,
    quakeLevel, sceneMgr)

    ' Initialise the rest of the resource groups, parse
    scripts etc

    ResourceGroupMa nager.Singleton .InitialiseAllR esourceGroups()

    ResourceGroupMa nager.Singleton .LoadResourceGr oup(ResourceGro upManager.Singl eton.WorldResou rceGroupName,
    False, True)

    ' Back to full rendering
    sceneMgr.ClearS pecialCaseRende rQueues()

    sceneMgr.SetSpe cialCaseRenderQ ueueMode(SceneM anager.SpecialC aseRenderQueueM ode.SCRQM_EXCLU DE)

    loadingBar.Fini sh()
    End Sub

    ' Override resource sources (include Quake3 archives)
    Public Overloads Overrides Sub SetupResources( )
    Dim cf As New ConfigFile()
    cf.Load("quake3 settings.cfg", "" & Chr(9) & ":=", True)
    quakePk3 = cf.GetSetting(" Pak0Location")
    quakeLevel = cf.GetSetting(" Map")

    MyBase.SetupRes ources()

    ResourceGroupMa nager.Singleton .AddResourceLoc ation(quakePk3, "Zip",
    ResourceGroupMa nager.Singleton .WorldResourceG roupName, True)
    End Sub

    ' Override scene manager (use indoor instead of generic)
    Public Overloads Overrides Sub ChooseSceneMana ger()
    sceneMgr =
    Root.Singleton. CreateSceneMana ger("BspSceneMa nager")
    End Sub

    ' Scene creation
    Public Overloads Overrides Sub CreateScene()
    camera.NearClip Distance = 4.0F
    camera.FarClipD istance = 4000.0F

    Dim vp As ViewPoint = sceneMgr.GetSug gestedViewpoint (True)

    camera.Position = vp.Position
    camera.Pitch(Ne w Degree(90.0F))
    camera.Rotate(v p.Orientation)
    camera.SetFixed YawAxis(True, Vector3.UNIT_Z)
    End Sub
    End Class
    End Namespace


    End Module
  • Armin Zingler

    #2
    Re: Namespace declaration

    "Charles Simpsons" <c.simpson@gmai l.comschrieb
    Hello.
    I am trying to convert a C# to VB.NET.
    Can you please tell me what I'm doing wrong and how I can fix it? I
    am getting the error "Namespace declarations can only be used..."
    Thank you!
    >
    This is my module:
    >
    Imports System
    Imports System.Collecti ons.Generic
    Imports System.Text
    >
    Module Module1
    >
    Namespace Mogre.Demo.BSP
    Namespace Mogre.Demo.BSP

    Module Module1
    ...
    End Module

    End Namespace

    You can not put Namespaces in Modules or Classes, only the other way round.


    Armin



    Comment

    Working...