This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Make Window
Started by Left, 06 April 2013 - 01:28 AMPosted 06 April 2013 - 03:28 AM
I am making a little library called Interface Library with all those functions you guys have suggested but I really dont quite know how I can make a window. Too be honest I am horrible with Lua but good with Java.
Posted 06 April 2013 - 03:42 AM
Well lets start with googling it
Posted 06 April 2013 - 03:42 AM
You can't really do a window. You have to color an area and it will look like a window !
(You also can use ascii art to draw it)
(You also can use ascii art to draw it)
Posted 06 April 2013 - 03:44 AM
You can't really do a window. You have to color an area and it will look like a window !
(You also can use ascii art to draw it)
*slow sarcastic clap* He's asked how can he make one, not what would it look like and what would it be if he could make it.
Anyways, what kind of window do you want to make?
Posted 06 April 2013 - 03:49 AM
Well a bit like LyqydOS with ANCII
art around it
art around it
Posted 06 April 2013 - 03:52 AM
Well lets start with googling it
Do you know what dude? Your name sounds like you couldn't make up anything better then something which makes you sound like a tool and you smart ASS is not needed on these forums
Posted 06 April 2013 - 04:07 AM
Do you know what dude? Your name sounds like you couldn't make up anything better then something which makes you sound like a tool and you smart ASS is not needed on these forums
Away with that attitude. Engineer is a nice guy (and he actually CAN make awesome programs), and he can be very helpful IF he doesn't read something like "hey I'm making a library but dunno how to actually do that helpme".
Seriously man. We can help if you have something we can help with. Writing a library is about writing it, experimenting with it, fixing its errors, etc. - not about asking others to write it for you.
So just start writing it, and when you get stuck, come here again (not this topic - open a new one). I know there are cases when you don't think that you can do something in Lua, but you actually can do it. You know, by what I've seen on this forum, everything that's not obviously impossible is possible in Lua. Just ask.
[offtopic] I can feel my ass being kicked by Lqyqd… [/offtopic]
Posted 06 April 2013 - 04:31 AM
I was going to help you but looks like you don't appreciate anything.
Maybe try something yourself and then tell us what it is or isn't doing and we can help you from there.
Maybe try something yourself and then tell us what it is or isn't doing and we can help you from there.
Posted 06 April 2013 - 04:34 AM
*slow sarcastic clap* He's asked how can he make one, not what would it look like and what would it be if he could make it. Anyways, what kind of window do you want to make?You can't really do a window. You have to color an area and it will look like a window ! (You also can use ascii art to draw it)
I misunderstood his question, I guess.
It sounded like "How can I represent a window ?".
I didn't want to be derisive.
Posted 06 April 2013 - 05:39 AM
Some of you guys are rude, haha.
The basic concept of a window is simply an object that stores position, size, and other properties, and has its own drawing function which displays itself in a window-like fashion to the user.
The basic base of a window is this:
And a window draw function (for your ASCII case) might look like this:
How you manage the windows and their properties is up to you, since there are many ways to do it.
The basic concept of a window is simply an object that stores position, size, and other properties, and has its own drawing function which displays itself in a window-like fashion to the user.
The basic base of a window is this:
local window = {
x = 3;
y = 2;
width = 12;
height = 7;
title = 'bleh';
}
And a window draw function (for your ASCII case) might look like this:
function window:draw()
local t = term
t.setBackgroundColor(colors.black)
-- print the top and bottom
local str = ('='):rep(self.width - 2)
t.setCursorPos(self.x + 1, self.y)
t.write(str)
t.setCursorPos(self.x + 1, self.y + self.height - 1)
t.write(str)
-- print the sides
for y=self.y, self.y + self.height - 1 do
t.setCursorPos(self.x, y)
t.write '|'
t.setCursorPos(self.x + self.width - 1, y)
t.write '|'
end
-- print the title
t.setCursorPos(self.x + 1, self.y)
t.write(self.title)
end
How you manage the windows and their properties is up to you, since there are many ways to do it.