←  APIs and Utilities

ComputerCraft | Programmable Computers for Minecraft

»

[CC 1.76+] BLittle API

Selim's Photo Selim 18 Jun 2016

I could be screwing something up weird, but I am getting a "blittle:457: attempt to concatenate nil and string" when executing blittle.createWindow(term.current(),1,1,x,y,true) where x and y is the current terminal size.

Edit: I was right, I was screwing something up weird. That was all on me. Whoops.
Edited by Selim, 18 June 2016 - 01:23 AM.
Quote

Bomb Bloke's Photo Bomb Bloke 18 Jun 2016

That error is basically me making a mess when trying to report "you called blittle.load() with a file that can't be opened". You won't see it when calling blittle.createWindow(), however.

Speaking of, you could just use blittle.createWindow() (without arguments), as you're specifying all the defaults there.
Quote

DerMistkaefer's Photo DerMistkaefer 01 Jul 2016

When I wont to test your api i get an error:

Posted Image

The same as in programm code:
if not fs.exists("package") then shell.run("pastebin get cUYTGbpb package") end
if not fs.exists("GIF") then shell.run("pastebin get 5uk9uRjC GIF") end
if not fs.exists("blittle") then shell.run("pastebin get ujchRSnU blittle") end
myWindow = blittle.createWindow()
myWindow.setVisible(true)
myWindow.setVisible(false)
myWindow.write("test")

Can you help me?
Quote

TheRockettek's Photo TheRockettek 01 Jul 2016

View PostDerMistkaefer, on 01 July 2016 - 02:58 PM, said:

When I wont to test your api i get an error:

Posted Image

The same as in programm code:
if not fs.exists("package") then shell.run("pastebin get cUYTGbpb package") end
if not fs.exists("GIF") then shell.run("pastebin get 5uk9uRjC GIF") end
if not fs.exists("blittle") then shell.run("pastebin get ujchRSnU blittle") end
myWindow = blittle.createWindow()
myWindow.setVisible(true)
myWindow.setVisible(false)
myWindow.write("test")

Can you help me?

You havent loaded the api. Do:
os.loadAPI("blittle")

and for the other ones aswell ;)

os.loadAPI lets you use functions from inside a program. So if its like just a text file you dont need to load it as an API (It will most probrably error anyway)
Quote

Admicos's Photo Admicos 09 Jul 2016

So, i am having some bugs while trying to use blittle. (Code Here)

At the very top, there is a thin blue line which seems to be a copy? of the blue line right next to it. (bottom one is the intended one)
and at the top right corner, the black box (shadow) beneath the white box (window) seems to "leak" into the window.

What should i do to fix them?


Posted Image
Quote

Anavrins's Photo Anavrins 09 Jul 2016

View PostAdmicos, on 09 July 2016 - 07:39 PM, said:

...
Simply avoid drawing too near the border, these are artifact from CC screens directly, not from BLittle.
There's also a relevant Github issue about this, https://github.com/d...Craft/issues/51
Edited by Anavrins, 09 July 2016 - 08:12 PM.
Quote

Admicos's Photo Admicos 09 Jul 2016

View PostAnavrins, on 09 July 2016 - 08:11 PM, said:

View PostAdmicos, on 09 July 2016 - 07:39 PM, said:

...
Simply avoid drawing too near the border, these are artifact from CC screens directly, not from BLittle.
There's also a relevant Github issue about this, https://github.com/d...Craft/issues/51

Oh, ok. Hopefully this will get fixed soon.
Quote

Bomb Bloke's Photo Bomb Bloke 10 Jul 2016

View PostAdmicos, on 09 July 2016 - 07:39 PM, said:

and at the top right corner, the black box (shadow) beneath the white box (window) seems to "leak" into the window.

Regarding this one, that's a result of you trying to cram too many colours into a single character space.

ComputerCraft can assign a foreground colour and a background colour to each character rendered to the screen. The teletext drawing characters BLittle uses each represent a 2x3 pixel pattern, but they're still ultimately just characters being written to the terminal - they have a foreground and a background colour, two in total.

This means that if you try to use more colours than that within a given character's 2x3 "space", BLittle has to "fudge" the results. It does this by picking the "least used" colours within that space and replacing them with the others until it gets something it can draw on-screen.

Here's your screenshot with the terminal's character spacings masked over it:

Posted Image

As you can see, every character contains no more than two colours. So to prevent oddities like up in the top right corner (where you've obviously tried to draw white/blue/black into the one character), try to line things up so that BLittle never has to approximate the image!

The map also makes clear the border Anavrins mentioned - that's filled automatically by ComputerCraft, and each segment always matches the background colour of whatever character has been drawn next to it (you can tell the background colour of a given teletext character by inspecting its lowest-right segment). In my view, that border would ideally either be removed or set to a constant black, though I can see why Dan doesn't like those solutions.
Edited by Bomb Bloke, 10 July 2016 - 02:55 AM.
Quote

Soulgriever's Photo Soulgriever 20 Jul 2016

I just wanted to say I love all of your api's quick question is there an easy way to use your blittle api and gif api to make an animated image? Im guessing I would have to flatten the image with the gif api but wasnt sure.
Quote

Bomb Bloke's Photo Bomb Bloke 04 Aug 2016

Yes, examples are in the original post. Using blittle.shrinkGIF() is the easiest way.
Quote

LDDestroier's Photo LDDestroier 04 Nov 2016

I noticed that thin line that Admicos was talking about, but the top of the screen only has two colors - red and black.
Why is that?

Posted Image

There should be a red rectangle with the logo in the center. What's with the top and left lines?
Quote

Bomb Bloke's Photo Bomb Bloke 05 Nov 2016

View PostBomb Bloke, on 10 July 2016 - 02:48 AM, said:

The map also makes clear the border Anavrins mentioned - that's filled automatically by ComputerCraft, and each segment always matches the background colour of whatever character has been drawn next to it (you can tell the background colour of a given teletext character by inspecting its lowest-right segment).

Basically, ComputerCraft scripts don't get "direct" control over the border - if you put a character next to it that uses X background colour, than the border at that location will also use X colour. Your image is placed such that the characters next to the border have to use a red background. Your best bet is to move it further away.

Read Anavrins' post for more info.
Edited by Bomb Bloke, 05 November 2016 - 12:35 AM.
Quote

Xella's Photo Xella 10 Nov 2017

Bomb Bloke, as you probably know, I have made it so my 3D renderer can use your blittle API. I've got two questions:
1. I want to put my API up for download. (In a zip file on Mediafire). Is it okay if I include your blittle API into the zip file?
2. Do you pronounce blittle as one word or as b-little?
Edited by Xelostar, 11 November 2017 - 09:39 AM.
Quote

Bomb Bloke's Photo Bomb Bloke 11 Nov 2017

1. Sure.

2. Depends on my mood. ;)
Quote

Xella's Photo Xella 11 Nov 2017

Thanks! I hope to get it out soon. :D
Quote

Xella's Photo Xella 13 Feb 2018

Again I'd like to ask permission to include this as a download for my Doom game (CC's first First Person Shooter). Since there are a lot of files, I've decided to put them on Github and use STD from LDDestroier to download everything with a pastebin installer. I've included an MIT license.
Is it okay if I put the BLittle API in there if I credit you in the readme?
Quote

Xella's Photo Xella 13 Feb 2018

Nevermind. I think I'm able to install it through pastebin =)
Quote