Rem DBC Menu Challenge
Rem TDK_Man December 2007
Rem Hopefully something a little different...
 
Gosub Setup
Rem Main Program Loop
Do
  If LeftKey()=1 Then Gosub Clockwise
  If RightKey()=1 Then Gosub AntiClockwise
  If ReturnKey()=1 Then Gosub DecodeButton
  Sync
  Ink RGB(255,255,255),0: Center Text 400,580,ButtonText$(CurrentButton)
  Center Text 400,0,"TDK_Man's TR-Style 3D Menu.  Left/Right Cursor Keys To Highlight, Enter Key To Select"
Loop
End
 
Rem ******************************************************************************************
Rem ***                                    PROCEDURES                                      ***
Rem ******************************************************************************************
 
DecodeButton:
  Select CurrentButton
    Case 1
      Rem Start Game
      A$="Start Game Selected From The Menu"
    EndCase
    Case 2
      Rem Options
      A$="Options Screen Selected From The Menu"
    EndCase
    Case 3
      Rem Help
      A$="Help Screen Selected From The Menu"
    EndCase
    Case 4
      Rem HiScores
      A$="HiScores Screen Selected From The Menu"
    EndCase
    Case 5
      Rem MultiPlay
      A$="Multiplayer Screen Selected From The Menu"
    EndCase
    Case 6
      Rem Exit Game
      A$="Exit Program Selected From The Menu"
    EndCase
  EndSelect
  Set Camera View 0,0,1,1
  CLS
  Print A$
  Print
  End
Return
 
Clockwise:
  Rem Rotate Front Row Left
  Hide Object 100
  For N=1 To AngleSpacing
    For I=1 To MenuOptions
      X#(I) = WrapValue(X#(I) + 1)
      Z#(I) = WrapValue(Z#(I) + 1)
      Position Object I, NewXValue(0,X#(I),XDist#),0.0,NewZValue(0,Z#(I),ZDist#)
    Next I
    Sync
  Next N
  Show Object 100
  Dec CurrentButton: If CurrentButton < 1 Then CurrentButton = MenuOptions
  Repeat
  Until LeftKey()=0
Return
 
AntiClockwise:
  Rem Rotate Front Row Right
  Hide Object 100
  For N=1 To AngleSpacing
    For I=1 To MenuOptions
      X#(I) = WrapValue(X#(I) - 1)
      Z#(I) = WrapValue(Z#(I) - 1)
      Position Object I, NewXValue(0,X#(I),XDist#),0.0,NewZValue(0,Z#(I),ZDist#)
    Next I
    Sync
  Next N
  Show Object 100
  Inc CurrentButton: If CurrentButton > MenuOptions Then CurrentButton = 1
  Repeat
  Until RightKey()=0
Return
 
Setup:
  Set Display Mode 800,600,16
  Sync On
  Sync Rate 0
  Hide Mouse
 
  MenuOptions = 6: Rem Number of buttons on menu screen
  Dim ButtonText$(6)
  ButtonText$(1) = "Start Game"
  ButtonText$(2) = "Options"
  ButtonText$(3) = "Help"
  ButtonText$(4) = "HiScores"
  ButtonText$(5) = "MultiPlay"
  ButtonText$(6) = "Exit Game"
 
  Rem Make Menu Option Textures
  Create Bitmap 1,800,600
 
  Rem Highlight texture
  CLS 0
  Ink RGB(140,10,80),0
  Box 0,10,300,90: Box 30,0,270,100
  Get Image 101,0,0,300,101
 
  Rem Main Button texture
  CLS 0
  Ink RGB(240,240,255),0
  Box 0,10,300,90: Box 30,0,270,100
  Ink RGB(90,90,150),0
  Box 1,11,300,90: Box 31,1,270,100
  Ink RGB(120,120,255),0
  Box 1,11,298,88: Box 31,1,268,98
  Get Image 100,0,0,300,101
 
  Rem Set Font
  Set Text Font "Comic Sans MS",1
  Set Text Size 64
 
  Rem Play Game Button
  Ink RGB(0,0,10),0: Center Text 150,15,ButtonText$(1)
  Ink RGB(255,255,255),0: Center Text 149,14,ButtonText$(1)
  Get Image 1,0,0,301,101
  Rem Options Button
  Paste Image 100,0,0
  Ink RGB(0,0,10),0: Center Text 150,15,ButtonText$(2)
  Ink RGB(255,255,255),0: Center Text 149,14,ButtonText$(2)
  Get Image 2,0,0,301,101
  Rem Options Button
  Paste Image 100,0,0
  Ink RGB(0,0,10),0: Center Text 150,15,ButtonText$(3)
  Ink RGB(255,255,255),0: Center Text 149,14,ButtonText$(3)
  Get Image 3,0,0,301,101
  Rem HiScores Button
  Paste Image 100,0,0
  Ink RGB(0,0,10),0: Center Text 150,15,ButtonText$(4)
  Ink RGB(255,255,255),0: Center Text 149,14,ButtonText$(4)
  Get Image 4,0,0,301,101
  Rem HiScores Button
  Paste Image 100,0,0
  Ink RGB(0,0,10),0: Center Text 150,15,ButtonText$(5)
  Ink RGB(255,255,255),0: Center Text 149,14,ButtonText$(5)
  Get Image 5,0,0,301,101
  Rem Exit Button
  Paste Image 100,0,0
  Ink RGB(0,0,10),0: Center Text 150,15,ButtonText$(6)
  Ink RGB(255,255,255),0: Center Text 149,14,ButtonText$(6)
  Get Image 6,0,0,301,101
 
  Set Current Bitmap 0
  Delete Bitmap 1
 
  Backdrop On
  Color Backdrop 0
  AutoCam Off
 
  AngleSpacing = 360/MenuOptions
  CurrentButton = 1
  XDist#=6.0: XDistInc=0-AngleInc
  ZDist#=4.0: ZDistInc=AngleInc
  Dim ButtonPosition(MenuOptions)
  Dim X#(MenuOptions)
  Dim Z#(MenuOptions)
 
  For N=0 To MenuOptions-1
    X#(N+1) = WrapValue(N*AngleSpacing+180.0)
    Z#(N+1) = X#(N+1)
    Make Object Box N+1,3,1,1
    XRotate Object N+1,30
    Texture Object N+1,N+1
    Scale Object N+1,100,100,.1
    Set Object N+1,1,0,1
    Position Object N+1,NewXValue(0,X#(N+1),XDist#),0.0,NewZValue(0,Z#(N+1),ZDist#)
  Next N
 
  Rem Highlight Current Option
  Make Object Box 100,3,1,1
  Set Object 100,1,0,1
  XRotate Object 100,30
  Texture Object 100,101
  Scale Object 100,100,100,.1
  Ghost Object On 100
  Position Object 100,Object Position X(1),Object Position Y(1),Object Position Z(1)-0.01
 
  Rem Reset Font
  Set Text Font "Arial",1
  Set Text Size 16
 
  Position Camera 0,5,-10
  Point Camera 0,0,0
Return