Rem DBC Menu Challenge
Rem TDK_Man December 2007
Rem Hopefully something a little different Number 2...
 
Gosub Setup
Rem Main Program Loop
Do
  If UpKey()=1 Then Gosub Clockwise
  If DownKey()=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 3D Rotating Menu V2.  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
      Y#(I) = WrapValue(Y#(I) + 1)
      Z#(I) = WrapValue(Z#(I) + 1)
      rem Position Object I, NewXValue(0,Y#(I),XDist#),0.0,NewZValue(0,Z#(I),ZDist#)
      Position Object I,0.0,NewYValue(0,Y#(I),YDist#),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
      Y#(I) = WrapValue(Y#(I) - 1)
      Z#(I) = WrapValue(Z#(I) - 1)
      rem Position Object I, NewXValue(0,Y#(I),XDist#),0.0,NewZValue(0,Z#(I),ZDist#)
      Position Object I,0.0,NewYValue(0,Y#(I),YDist#),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 = 9: Rem Number of buttons on menu screen
  Dim ButtonText$(MenuOptions)
  Rem Make sure there are the same number of text labels below as there are MenuOptions
  ButtonText$(1) = "Start Game"
  ButtonText$(2) = "Options"
  ButtonText$(3) = "Help"
  ButtonText$(4) = "HiScores"
  ButtonText$(5) = "MultiPlay"
  ButtonText$(6) = "Exit Game"
  ButtonText$(7) = "Unused"
  ButtonText$(8) = "Unused"
  ButtonText$(9) = "Unused"
 
  Rem Make Menu Option Textures
  Create Bitmap 1,800,600
 
  Rem Highlight texture
  CLS 0
  Ink RGB(0,255,255),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 Buttons
  For N=1 To MenuOptions
    Paste Image 100,0,0
    Ink RGB(0,0,10),0: Center Text 150,15,ButtonText$(N)
    Ink RGB(255,255,255),0: Center Text 149,14,ButtonText$(N)
    Get Image N,0,0,301,101
  Next N
 
  Set Current Bitmap 0
  Delete Bitmap 1
 
  Backdrop On
  Color Backdrop 0
  AutoCam Off
 
  AngleSpacing = 360/MenuOptions
  CurrentButton = 1: YDist#=2.0: ZDist#=2.0
  Dim ButtonPosition(MenuOptions)
  Dim Y#(MenuOptions)
  Dim Z#(MenuOptions)
 
  For N=0 To MenuOptions-1
    Y#(N+1) = WrapValue(N*AngleSpacing+180.0)
    Z#(N+1) = Y#(N+1)
    Make Object Box N+1,3,1,1
    Texture Object N+1,N+1
    Scale Object N+1,100,100,.1
    Set Object N+1,1,0,1
    Position Object N+1,0.0,NewYValue(0,Y#(N+1),YDist#),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
  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 Fading Fog
  Fog On
  Fog Color 0
  Fog Distance 11
 
  Rem Reset Font
  Set Text Font "Arial",1
  Set Text Size 16
 
  Position Camera 0,0,-8
  Point Camera 0,0,0
Return