Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Frames/Menu
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Fashoomp




PostPosted: Tue Mar 27, 2007 8:10 pm   Post subject: Frames/Menu

Ok, this i cant figure out. How can i make a menu. I am also familiar with flash, and understand that uses frames. However, turing does not, and i cannot think of any way for the code to go backwards. If i want it to go back and forth between menu screens, how can i do this, without having infinite code.
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Tue Mar 27, 2007 8:31 pm   Post subject: RE:Frames/Menu

Basically, I'm assuming that you are going to have each different "menu" running in a different procedure. If not, start there. From there, you can use a concept called mutual recursion. This means that one procedure calls another, and that procedure calls the procedure calls the one that called it. This is difficult to do in Turing, because a procedure declared below the currently running one (by line number) doesn't exist within the currently running procedure's scope. In order to fix this, we have to forward the procedure that we want to mutually recurse with another one. This will allow the procedure below the one that we want to recurse with to be within the higher up procedure's scope. Here is some sample code to help:

Turing:

forward procedure foo (para1 : int, para2 : string)

procedure bar (val1 : int)
    if whatever then
        foo (val1, 5)
    end if
end bar

body proc foo (para1 : int, para2 : string)
    if something then
        bar (para1)
    elsif other_stuff then
        bar (strint (para2))
    end if
end foo


Just be sure to precede the procedure that you are forwarding with the keyword body. This just ensures that the compiler knows that this is indeed the procedure that we are trying to forward for the use of the other procedure.

If you have any other questions, be sure to check out the Turing Walkthrough for some help Very Happy

EDIT: This code is untested, as I'm on Linux, so if it doesn't work the first time, fiddle around with it and see if it will work Wink
Drakain Zeil




PostPosted: Thu Mar 29, 2007 6:01 pm   Post subject: RE:Frames/Menu

you could grab screens of each menu screen, and then load them using procedures depending on where the user wants to go.

render on first load, draw pic on all future loads.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: