This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
3751_Creator's profile picture

Make a logo with tables

Started by 3751_Creator, 02 December 2012 - 11:05 PM
3751_Creator #1
Posted 03 December 2012 - 12:05 AM
Hello CC community!!

I have started a new OS and wanted a logo to pop up on startup.

I don't know if you have looked at the code of Nitrogenfingers code for his 3D printer.
He used tables to create his logo:
[attachment=732:azer.PNG]

How the world did he do that!!!


NB: I am "ok" in lua (I know basicly a bit more thant the basics)

Thanks to all; ~3751_Creator
remiX #2
Posted 03 December 2012 - 12:46 AM
I went through his program and it looks like he used this function:

His table for the logo was
local logo = {
"fcc			  3   339";
" fcc		  9333    33";
"  fcc	    933 333  33";
"   fcc	   933  33  33";
"    fcc	  933   33 33";
"	 c88	 333   93333";
"	 888	 333    9333";
"	  333 3  333	 939";
}

local function drawPictureTable(image, xinit, yinit, alpha)
    if not alpha then alpha = 1 end
    for y=1,#image do
        for x=1,#image[y] do
            term.setCursorPos(xinit + x-1, yinit + y-1)
            local col = getColourOf(string.sub(image[y], x, x))
            if not col then col = alpha end
            term.setBackgroundColour(col)
            term.write(" ")
        end
    end
end

And then to draw it:

drawPictureTable(logo, w/2 - #logo[1]/2, h/2 - #logo/2, colours.white)

Not sure how it works though, just mess around with it until you get it right
3751_Creator #3
Posted 03 December 2012 - 01:05 AM
Ok, I'll have a look.

I will tell you if I can make it work