Bedrock - The Complete GUI Framework
oeed 20 Jul 2014
What is Bedrock?
Bedrock is an extremely advanced and powerful framework for developing beautiful, easy to use ComputerCraft programs. Not only does it make for a more pleasant experience for the user, by coding programs with Bedrock removes the need for you, the developer, to wrangle with low level aspects of programs. With Bedrock file sizes are also significantly lower than previously due to huge amounts of code, that would have previously made your program huge bigger, being in one central API. A single line of code is all that is needed to download and install Bedrock, and if Bedrock was already installed by another program it will use that version, saving precious disk space.
Bedrock is designed to be similar to existing interface frameworks such as Apple’s Cocoa, the framework used to develop the majority of iOS and OS X. I’m sure that it will also be similar to others such as .NET and possible Java, but I’m not very familiar with them. If you’ve used these in the past, Bedrock should be pretty easy to pickup, if you haven’t, don’t worry. It may take some time to work it out, but once you do you’ll be able to create better programs in record time.
It's hard to explain just what Bedrock is really. Take a look at the tutorial (link at the bottom of the post) for a more detailed description and example code.
What objects does it support?
What are the benefits of Bedrock?
Bedrock is designed to be very quick and easy to use, yet very powerful. It only takes a matter of minutes to learn how to use it and will save you hours in the long run.
One of Bedrock's main goals is to reduce the amount of code you need to write. I've personally found that programs I use Bedrock are normally a third the number of lines, and that doesn't include having to write the APIs in the first place.
What are some programs made with Bedrock?
If you made a program with Bedrock let me know, I’ll add you to the list!
- OneOS - OneOS and most of it’s programs were entirely coded using Bedrock. Anything that OneOS does you can do with ease.
- Your next program?
Installation/Download
If you want to just take a look at the code you should use the GitHub repo. https://github.com/oeed/Bedrock
Installation is very easy, simply add this line to the top of your file and it will automatically download and load the API.
How to use it.
Bedrock is quite different to most other APIs/frameworks. I've made a very sizeable tutorial which I highly recommend you read. At this stage the tutorial is the only documentation.
Edited by oeed, 29 November 2014 - 10:29 AM.
Bedrock is an extremely advanced and powerful framework for developing beautiful, easy to use ComputerCraft programs. Not only does it make for a more pleasant experience for the user, by coding programs with Bedrock removes the need for you, the developer, to wrangle with low level aspects of programs. With Bedrock file sizes are also significantly lower than previously due to huge amounts of code, that would have previously made your program huge bigger, being in one central API. A single line of code is all that is needed to download and install Bedrock, and if Bedrock was already installed by another program it will use that version, saving precious disk space.
Bedrock is designed to be similar to existing interface frameworks such as Apple’s Cocoa, the framework used to develop the majority of iOS and OS X. I’m sure that it will also be similar to others such as .NET and possible Java, but I’m not very familiar with them. If you’ve used these in the past, Bedrock should be pretty easy to pickup, if you haven’t, don’t worry. It may take some time to work it out, but once you do you’ll be able to create better programs in record time.
It's hard to explain just what Bedrock is really. Take a look at the tutorial (link at the bottom of the post) for a more detailed description and example code.
What objects does it support?
- Buttons
- CollectionViews (think the icon view in OneOS's Files)
- ImageViews
- Labels
- ListViews
- Menus
- ProgressBars (including multiple values and colours, think the storage usage bar in About OneOS)
- ScrollBars (these are automatically handled by ScrollViews though)
- ScrollViews
- Separator (just single line)
- TextBox
- Windows
What are the benefits of Bedrock?
Bedrock is designed to be very quick and easy to use, yet very powerful. It only takes a matter of minutes to learn how to use it and will save you hours in the long run.
One of Bedrock's main goals is to reduce the amount of code you need to write. I've personally found that programs I use Bedrock are normally a third the number of lines, and that doesn't include having to write the APIs in the first place.
What are some programs made with Bedrock?
If you made a program with Bedrock let me know, I’ll add you to the list!
- OneOS - OneOS and most of it’s programs were entirely coded using Bedrock. Anything that OneOS does you can do with ease.
- Your next program?
Installation/Download
If you want to just take a look at the code you should use the GitHub repo. https://github.com/oeed/Bedrock
Installation is very easy, simply add this line to the top of your file and it will automatically download and load the API.
local bedrockPath='/' if OneOS then OneOS.LoadAPI('/System/API/Bedrock.lua', false)elseif fs.exists(bedrockPath..'/Bedrock')then os.loadAPI(bedrockPath..'/Bedrock')else if http then print('Downloading Bedrock...')local h=http.get('http://pastebin.com/raw.php?i=0MgKNqpN')if h then local f=fs.open(bedrockPath..'/Bedrock','w')f.write(h.readAll())f.close()h.close()os.loadAPI(bedrockPath..'/Bedrock')else error('Failed to download Bedrock. Is your internet working?') end else error('This program needs to download Bedrock to work. Please enable HTTP.') end end if Bedrock then Bedrock.BasePath = bedrockPath Bedrock.ProgramPath = shell.getRunningProgram() end
How to use it.
Bedrock is quite different to most other APIs/frameworks. I've made a very sizeable tutorial which I highly recommend you read. At this stage the tutorial is the only documentation.
Edited by oeed, 29 November 2014 - 10:29 AM.
Geforce Fan 20 Jul 2014
Huh. Looks cool. I'll look into this later... this could save me a LOT of trouble in Sapphari(and pretty much do everything for me...)
Although it seems it's not all in one file. This could bring problems if using an online version.
Edited by Geforce Fan, 20 July 2014 - 03:01 AM.
Although it seems it's not all in one file. This could bring problems if using an online version.
Edited by Geforce Fan, 20 July 2014 - 03:01 AM.
oeed 20 Jul 2014
Geforce Fan, on 20 July 2014 - 02:59 AM, said:
Huh. Looks cool. I'll look into this later... this could save me a LOT of trouble in Sapphari(and pretty much do everything for me...)
Although it seems it's not all in one file. This could bring problems if using an online version.
Although it seems it's not all in one file. This could bring problems if using an online version.
It's all in this file.
LDShadowLord 20 Jul 2014
Hmmm, I may adopt this. It will save me the hassle of trying to shoe-horn a GUI system into Colligo.
oeed 20 Jul 2014
Win7yes 20 Jul 2014
oeed 20 Jul 2014
sjkeegs 21 Jul 2014
Does this have any dependency on any version of ComputerCraft. I'm still using 1.58.
Win7yes 21 Jul 2014
oeed, on 20 July 2014 - 09:56 PM, said:
I made an Alert Box be displayed when a button is clicked, and before adding the code to close the program by pressing the button of the box, I left some code that
was supposed to close the Alert Box, And that wrecked up everything making the program only close the Alert Box, but not the program itself. It was something like this
if program:Window thenor something like that.
By the way, Is there any way to "switch" views?
oeed 21 Jul 2014
sjkeegs, on 21 July 2014 - 01:39 AM, said:
Does this have any dependency on any version of ComputerCraft. I'm still using 1.58.
Win7yes, on 21 July 2014 - 02:05 AM, said:
I made an Alert Box be displayed when a button is clicked, and before adding the code to close the program by pressing the button of the box, I left some code that
was supposed to close the Alert Box, And that wrecked up everything making the program only close the Alert Box, but not the program itself. It was something like this
By the way, Is there any way to "switch" views?
was supposed to close the Alert Box, And that wrecked up everything making the program only close the Alert Box, but not the program itself. It was something like this
if program:Window thenor something like that.
By the way, Is there any way to "switch" views?
I don't completely get what you're saying, but Alert Boxes should close themselves when you click a button (let me know if they're not).
If you want an alert box to close your program you should (haven't tested) be able to do something like this:
program:GetObject('HelloButton').OnClick = function(self, event, side, x, y) program:DisplayAlertWindow('Quit?', 'Are you sure you want to quit?', {'Quit', 'Cancel'}, function(value) if value == 'Quit' then program:Quit() end end) end
Yes, there is. I forgot to mention that in the tutorial.
Simply do this:
program:LoadView('viewname') --without the .view
Win7yes 21 Jul 2014
No but I mean I left some things that made the program:Quit() fail to close and it just closed the Alert box. And Sorry I will make help posts in the tutorial
topic in the future
topic in the future
oeed 21 Jul 2014
daawsomest 22 Jul 2014
Hello,
This framework looks awesome and will be very helpful for my current projects, but I can't get it working. I have tried multiple times on different CC computers with no luck. The error I get is "No loaded view. You need to do program:LoadView first". I have created a main view and was under the assumption that it would be loaded automatically.
Screenshots:
This framework looks awesome and will be very helpful for my current projects, but I can't get it working. I have tried multiple times on different CC computers with no luck. The error I get is "No loaded view. You need to do program:LoadView first". I have created a main view and was under the assumption that it would be loaded automatically.
Screenshots:
Spoiler
oeed 23 Jul 2014
daawsomest, on 22 July 2014 - 11:11 PM, said:
Hello,
This framework looks awesome and will be very helpful for my current projects, but I can't get it working. I have tried multiple times on different CC computers with no luck. The error I get is "No loaded view. You need to do program:LoadView first". I have created a main view and was under the assumption that it would be loaded automatically.
Screenshots:
This framework looks awesome and will be very helpful for my current projects, but I can't get it working. I have tried multiple times on different CC computers with no luck. The error I get is "No loaded view. You need to do program:LoadView first". I have created a main view and was under the assumption that it would be loaded automatically.
Screenshots:
Spoiler
That is strange, there's nothing that seems to be incorrect.
Looking at Bedrock's code I'm pretty sure that the only way this could've happened is it think the file doesn't exist.
For now, try doing this at the top of the program:Run function.
program:LoadView('main')Let me know if it works/has an error.
If possible could you upload a zip file of the computer so I can see whats wrong?
Win7yes 23 Jul 2014
It happend to me too when I started making my OneOS Log Displayer (By the way I need help to make it work on OneOS. And the scroll textbox thing). It said that I needed to load it first with program:LoadView and I added program:LoadView("main") to the code and it worked. Didn't report it because I thought it wasn't like a big thing.
oeed 24 Jul 2014
Win7yes, on 23 July 2014 - 10:52 PM, said:
It happend to me too when I started making my OneOS Log Displayer (By the way I need help to make it work on OneOS. And the scroll textbox thing). It said that I needed to load it first with program:LoadView and I added program:LoadView("main") to the code and it worked. Didn't report it because I thought it wasn't like a big thing.
Win7yes 24 Jul 2014
Is it ok if I put the files in a ZIP and upload the ZIP somewhere? (Somewhere like Google Drive. Or to be more specific, Google Drive)
Edited by Win7yes, 24 July 2014 - 01:39 AM.
Edited by Win7yes, 24 July 2014 - 01:39 AM.