Jump to content




[CC 1.76+] BLittle API


36 replies to this topic

#21 Selim

  • Members
  • 189 posts
  • LocationHiding in Online Storage

Posted 18 June 2016 - 01:16 AM

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.


#22 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 18 June 2016 - 01:23 AM

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.

#23 DerMistkaefer

  • New Members
  • 1 posts
  • LocationGermany

Posted 01 July 2016 - 02:58 PM

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?

#24 TheRockettek

  • Members
  • 547 posts
  • LocationRem is best girl

Posted 01 July 2016 - 05:11 PM

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)

#25 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 09 July 2016 - 07:39 PM

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

#26 Anavrins

  • Members
  • 775 posts

Posted 09 July 2016 - 08:11 PM

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.


#27 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 09 July 2016 - 09:30 PM

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.

#28 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 10 July 2016 - 02:48 AM

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.


#29 Soulgriever

  • Members
  • 7 posts

Posted 20 July 2016 - 10:26 PM

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.

#30 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 04 August 2016 - 03:42 AM

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

#31 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 04 November 2016 - 08:02 PM

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?

#32 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 05 November 2016 - 12:22 AM

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.


#33 Xella

  • Members
  • 145 posts
  • LocationOn Earth

Posted 10 November 2017 - 08:09 PM

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.


#34 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 11 November 2017 - 03:02 AM

1. Sure.

2. Depends on my mood. ;)

#35 Xella

  • Members
  • 145 posts
  • LocationOn Earth

Posted 11 November 2017 - 09:39 AM

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

#36 Xella

  • Members
  • 145 posts
  • LocationOn Earth

Posted 13 February 2018 - 02:10 PM

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?

#37 Xella

  • Members
  • 145 posts
  • LocationOn Earth

Posted 13 February 2018 - 03:54 PM

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





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users