sirdabalot 2 Posted January 3, 2015 Share Posted January 3, 2015 https://github.com/sirdabalot/OCGUIFramework Hello everyone! This is my first API post so go easy on me. =P This is an OpenComputers GUI framework, its currrent features are: Movable Windows Buttons Textboxes Text inputs This is my new GUI framework API, designed to be simple as possible. Simply require the lua file into your program and start using the functions. Method information can be found on the readme on the github page. By the way windows can be moved by clicking the # in the top left corner, also note that after you've entered text into a textInput you must press enter. Example code: This code was to be used with the mekanism teleporters. require( "SOCGUIF" ) term = require( "term" ) components = require( "component" ) tele = components.teleporter gpu = components.gpu function setTeleCus( ) code = codeIn.text for i = 0, 3 do tele.set( i, tonumber( string.sub( code, i+1, i+1 ) ) ) end end function setTeleP1( ) code = "0001" for i = 0, 3 do tele.set( i, tonumber( string.sub( code, i+1, i+1 ) ) ) end end function setTeleP2( ) code = "0002" for i = 0, 3 do tele.set( i, tonumber( string.sub( code, i+1, i+1 ) ) ) end end function exitProg( ) gpu.setBackground( 0x000000 ) gpu.setForeground( 0xFFFFFF ) term.clear( ) os.exit( ) end controlPanelWindow = window( point( 120, 3 ), 18, 6, "Control panel", 0xFFFFFF, 0x00FF00 ) exitButton = button( controlPanelWindow, point( 2, 2 ), 15, 3, "Exit", 0xFFFFFF, 0xFF0000, exitProg ) customTeleWindow = window( point( 3, 3 ), 22, 9, "Custom teleport", 0xFFFFFF, 0x00FF00 ) codeInTB = textBox( customTeleWindow, point( 2, 2 ), #"Custom code:", 1, "Custom code:", 0xFFFFFF, 0xFF0000 ) codeIn = textInput( customTeleWindow, point( 1, 3 ), 19, 0xFFFFFF, 0xFF0000 ) customTeleButton = button( customTeleWindow, point( 2, 5 ), 19, 3, "Set", 0xFFFFFF, 0xFF0000, setTeleCus ) presetTeleWindow = window( point( 3, 17 ), 22, 10, "Preset teleport", 0xFFFFFF, 0x00FF00 ) customTeleButton1 = button( presetTeleWindow, point( 2, 2 ), 19, 3, "To portal 1", 0xFFFFFF, 0xFF0000, setTeleP1 ) customTeleButton2 = button( presetTeleWindow, point( 2, 6 ), 19, 3, "To portal 2", 0xFFFFFF, 0xFF0000, setTeleP2 ) table.insert( windowTable, customTeleWindow ) table.insert( windowTable, controlPanelWindow ) table.insert( windowTable, presetTeleWindow ) GUILoop( 0x0000FF ) Result in attached file... Quote Link to post Share on other sites
Lizzian 46 Posted January 4, 2015 Share Posted January 4, 2015 looks promising, keep up the good work will test this when I can Quote Link to post Share on other sites
sirdabalot 2 Posted January 4, 2015 Author Share Posted January 4, 2015 Much appreciated! =D I will do xD Quote Link to post Share on other sites
Alissa 1 Posted July 22, 2015 Share Posted July 22, 2015 Suggestion -- set text to black when you're displaying brighter colors to improve readability? Quote Link to post Share on other sites