Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SuperStrict
  2.  
  3. Import Fry.FryGUI
  4.  
  5. AppTitle = "GUI Example"
  6. Graphics 800, 600, 0, 0
  7. fry_SetResolution(800, 600)
  8. fry_SystemCursor(False)
  9. SetBlend alphablend
  10.  
  11. 'load in a skin for the GUI
  12. fry_LoadSkin("Skin")
  13.  
  14. 'add the fonts to the GUI. Fonts will be referenced by their names.
  15. fry_AddFont("Default", "trebucbd.ttf", 13)
  16. fry_AddFont("Large", "trebucbd.ttf", 24)
  17.  
  18. 'create the screens
  19. Local screen1:fry_TScreen = fry_CreateScreen("Screen 1")
  20.  
  21. Local panel1:fry_TPanel = fry_CreatePanel("Z", 0, 0, 600, 600)
  22.  
  23. panel1.HexColour("505080")
  24.  
  25. screen1.AddPanel(panel1)
  26.  
  27.  
  28. Local img:TImage = LoadImage("Brazil.png")
  29. If img = Null Then DebugLog "Null Image!"
  30. Local table:fry_TTable = fry_CreateTable("Table", 40, 45, 500, 20, True, panel1)
  31.  
  32. 'add more columns. There is a 3 pixel gap between columns that needs to be taken into account, and 20 pixels should be left for the scrollbar
  33. table.AddColumn(150, "Item", img, 18)
  34. table.AddColumn(50, "Val 1", Null, 18)
  35. table.AddColumn(50, "Values number 2 yeah baby")
  36. table.AddColumn(50, "Total", Null, 18)
  37.  
  38. 'table.SetColumnWidth(3, 0)
  39. table.HideColumn(3)
  40.  
  41. 'set table colour properties
  42. table.HexColour("FFFFFF", 0)        'colour of each item
  43. table.HexColour("000000", 1)        'colour of the selected item
  44. table.HexColour("7070AA", 2)        'colour of the column headings
  45.  
  46. table.HexTextColour("000000", 0)    'text colour for items
  47. table.HexTextColour("FFFFFF", 1)    'text colour for selected item
  48. table.HexTextColour("FFFFFF", 2)    'text colour for headings
  49.  
  50. table.SetAlpha(0.5, 0)              'set items to be partially transparent
  51. table.SetAlpha(0.5, 1)              'set selected item to be partially transparent
  52.  
  53. table.HexColour("FF0000", 2, 1)     'set column 1's heading colour to red
  54. table.SetAlpha(0.5, 2, 1)
  55. table.HexTextColour("000000", 2, 1)
  56. table.SetTextAlpha(0.5, 2, 1)
  57.  
  58. table.HexColour("00FF00", 1, 2)
  59. table.HexColour("0000FF", 0, 0)
  60.  
  61. 'add items
  62.  
  63. For Local count:Int = 0 To 100
  64.    
  65.     Local value1:Int = count
  66.     Local value2:Int = 101 - count
  67.     Local product:Int = value1 * value2
  68.    
  69.     table.AddItem(["Item "+String(count), String(value1), String(value2), String(product)])
  70.    
  71. Next
  72.  
  73.  
  74. 'title
  75. Local title:fry_TLabel = fry_CreateLabel("title", "", 0, 40, 780, 80, 1, 1, panel1)
  76.  
  77. 'setting the font to "Large" will use the font loaded earlier with that name
  78. title.SetFont("Large")
  79. title.SetTextColour(255, 255, 255)
  80.  
  81. 'Set the initial screen - failure to do this will crash the GUI
  82. fry_SetScreen("Screen 1")
  83.  
  84.  
  85. While Not KeyHit(KEY_ESCAPE)   
  86.    
  87.     PollSystem
  88.    
  89.     Cls
  90.        
  91.     'Refresh the GUI
  92.     fry_Refresh()
  93.    
  94.     'Poll all the events generated by the GUI
  95.     While fry_PollEvent()
  96.        
  97.         'print out the event, except when it's generated by the progress bar (which is updated every frame)
  98.         If fry_EventID() <> fry_EVENT_MOUSEOVER And fry_EventID() Then
  99.             If fry_EventID() <> fry_EVENT_HIDE And fry_EventID() <> fry_EVENT_SHOW Then Print fry_EventText()
  100.         End If
  101.        
  102.         'if the screen has changed, change the title
  103.         If fry_EventID() = fry_EVENT_SETSCREEN Then title.SetText(fry_TScreen(fry_EventExtra()).GetName())
  104.        
  105.     Wend
  106.    
  107.     Flip 0
  108.     GCCollect()
  109. Wend
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement