Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SuperStrict
- Import Fry.FryGUI
- AppTitle = "GUI Example"
- Graphics 800, 600, 0, 0
- fry_SetResolution(800, 600)
- fry_SystemCursor(False)
- SetBlend alphablend
- 'load in a skin for the GUI
- fry_LoadSkin("Skin")
- 'add the fonts to the GUI. Fonts will be referenced by their names.
- fry_AddFont("Default", "trebucbd.ttf", 13)
- fry_AddFont("Large", "trebucbd.ttf", 24)
- 'create the screens
- Local screen1:fry_TScreen = fry_CreateScreen("Screen 1")
- Local panel1:fry_TPanel = fry_CreatePanel("Z", 0, 0, 600, 600)
- panel1.HexColour("505080")
- screen1.AddPanel(panel1)
- Local img:TImage = LoadImage("Brazil.png")
- If img = Null Then DebugLog "Null Image!"
- Local table:fry_TTable = fry_CreateTable("Table", 40, 45, 500, 20, True, panel1)
- '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
- table.AddColumn(150, "Item", img, 18)
- table.AddColumn(50, "Val 1", Null, 18)
- table.AddColumn(50, "Values number 2 yeah baby")
- table.AddColumn(50, "Total", Null, 18)
- 'table.SetColumnWidth(3, 0)
- table.HideColumn(3)
- 'set table colour properties
- table.HexColour("FFFFFF", 0) 'colour of each item
- table.HexColour("000000", 1) 'colour of the selected item
- table.HexColour("7070AA", 2) 'colour of the column headings
- table.HexTextColour("000000", 0) 'text colour for items
- table.HexTextColour("FFFFFF", 1) 'text colour for selected item
- table.HexTextColour("FFFFFF", 2) 'text colour for headings
- table.SetAlpha(0.5, 0) 'set items to be partially transparent
- table.SetAlpha(0.5, 1) 'set selected item to be partially transparent
- table.HexColour("FF0000", 2, 1) 'set column 1's heading colour to red
- table.SetAlpha(0.5, 2, 1)
- table.HexTextColour("000000", 2, 1)
- table.SetTextAlpha(0.5, 2, 1)
- table.HexColour("00FF00", 1, 2)
- table.HexColour("0000FF", 0, 0)
- 'add items
- For Local count:Int = 0 To 100
- Local value1:Int = count
- Local value2:Int = 101 - count
- Local product:Int = value1 * value2
- table.AddItem(["Item "+String(count), String(value1), String(value2), String(product)])
- Next
- 'title
- Local title:fry_TLabel = fry_CreateLabel("title", "", 0, 40, 780, 80, 1, 1, panel1)
- 'setting the font to "Large" will use the font loaded earlier with that name
- title.SetFont("Large")
- title.SetTextColour(255, 255, 255)
- 'Set the initial screen - failure to do this will crash the GUI
- fry_SetScreen("Screen 1")
- While Not KeyHit(KEY_ESCAPE)
- PollSystem
- Cls
- 'Refresh the GUI
- fry_Refresh()
- 'Poll all the events generated by the GUI
- While fry_PollEvent()
- 'print out the event, except when it's generated by the progress bar (which is updated every frame)
- If fry_EventID() <> fry_EVENT_MOUSEOVER And fry_EventID() Then
- If fry_EventID() <> fry_EVENT_HIDE And fry_EventID() <> fry_EVENT_SHOW Then Print fry_EventText()
- End If
- 'if the screen has changed, change the title
- If fry_EventID() = fry_EVENT_SETSCREEN Then title.SetText(fry_TScreen(fry_EventExtra()).GetName())
- Wend
- Flip 0
- GCCollect()
- Wend
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement