
-----------------------------------
kohul555
Wed May 09, 2018 7:02 pm

GUI Interface
-----------------------------------
So I have this assignment where I need to present a compsci-related career using a GUI interface. I am trying to get the words Game Designer to appear once the program is run. Then, there should be 4 buttons that say Salary, Duties, Education, Employer Type. When each button is clicked, it shud go to a page where I have my research on each topic. There shud be a back button on each page also. I will put my code so far under. I know I'm missing a lot of stuff. This is due in a week, so any helpful advice/ideas will be appreciated!

P.S. I am a Turing newbie, so please bear with me. 

CODE:

import GUI

forward proc introscreen()
forward proc Education()
forward proc Duties()
forward proc Salary()
forward proc Employer_Type()







body procedure introscreen
  var start_button : int
  var duties_button : int
  var money_button : int
  var job_button : int
  
  GUI.SetBackgroundColor(93)
  
  var picID : int
  var font1 : int
  
   font1 := Font.New ("impact:80")
    assert font1 > 0
    Font.Draw ("G", 100, 500, font1, 56)
    delay (100)
    Font.Draw ("A", 200, 500, font1, 55)
    delay (100)
    Font.Draw ("M", 275, 500, font1, 54)
    delay (100)
    Font.Draw ("E", 350, 500, font1, 53)
    delay (100)
    Font.Draw (" ", 425, 500, font1, 52)
    delay (100)
    Font.Draw ("D", 500, 500, font1, 51)
    delay (100)
    Font.Draw ("E", 575, 500, font1, 50)
    delay (100)
    Font.Draw ("V", 650, 500, font1, 49)
    delay (100)
    Font.Draw ("E", 750, 500, font1, 1)
    delay (100)
    Font.Draw ("L", 850, 500, font1, 1)
    delay (100)
    Font.Draw ("0", 125, 300, font1, 56)
    delay (100)
    Font.Draw ("P", 200, 300, font1, 55)
    delay (100)
    Font.Draw ("E", 275, 300, font1, 54)
    delay (100)
    Font.Draw ("R", 350, 300, font1, 53)
    delay (100)
    
    GUI.Refresh ()
    start_button := GUI.CreateButton (475, 200, 0, "Education", Education)
    duties_button := GUI.CreateButton (475, 150, 0, "Duties", Duties)
    money_button := GUI.CreateButton (475, 100, 0, "Salary", Salary)
    job_button := GUI.CreateButton (475, 50, 0, "Employer Type", Employer_Type)

    loop
        exit when GUI.ProcessEvent
    end loop

    body proc Education
    put "Atleast a bachelor's degree in computer software programming is required."
    end Education
    
    body proc Duties
    put "Game developers program the games, make note of progress, design storylines, and characters."
    end Duties
    
    body proc Salary
    put "Game developers earn between $50,000 to $102,000 annually. Of course, this depends on the success of the game and if the employee is senior or junior."
    end Salary
    
    body proc Employer_Type
    put "Game designers have all kinds of employers."
    end Employer_Type

Thanks

-----------------------------------
Srlancelot39
Thu May 10, 2018 10:51 am

RE:GUI Interface
-----------------------------------
I don't have any experience with built-in GUI, but as far as the program architecture goes, I would run each page as its own function and give each page function a condition statement that checks to see if a Back button is being pressed.  If it is, it should exit the function and return to your main program (main page).

Where you have [code]loop 
exit when GUI.ProcessEvent 
end loop [/code]
you could change the exit to a function call instead.  The function to be called would depend on what button was pressed, of course.
