Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
sibomots

Sample code needed (colored text, threads, graphics) / General questions

Question

Been a C/C++ software engineer over 30 years,  just not Lua.    I've browsed the Wiki and nothing seems to answer these questions.

 

 

Question -- Colored Text:

 

In OpenComputers, need sample code that prints colored text with Tier2 or Tier3 computer systems.

 

I've tried:

 

local component = require("component")

local gpu = component.gpu

local term = require("term")

-- green text

gpu.setForeground(0x00FF00)

term.write("howdy world\n")

 

In order to print colored text, do I need to use the functions in gpu or in term?

 

 

 

Question -- The Editor and adjusting resolutions.

 

When gpu.setResolution(w,h) it resets the resolution of the window interface to the computer.  Is there a way to adjust the resolution of the graphics for the monitors attached to the computer but not the interactive shell to program the computer?

 

I notice (thankfully) I can paste into the editor.  How do I copy the buffer out?

 

Any chance vi will be ported?  Pretty please!?  ;-)

 

 

A thread/task:

 

I need to fire off a thread and then wait for the thread (rendezvous).  Are there any samples that work with OpenComputers ?

 

 

Question -- Graphics primatives:

 

Lets say I want to blit a specific pixel at a certain location with a certain color.  What code samples exist to do that?

 

 

Thanks Muchly.

 

 

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Please use code tags next time when posting code.

 

Colored text:

local component = require('component')
local gpu = component.gpu

gpu.setForeground(0x00FF00)
gpu.set(1, 1, 'Hello, world!')

Share this post


Link to post
Share on other sites
  • 0

How do you change the size of the text?

 
Also did you ever figure out how to set the monitor resolution without changing the interactive shell?

Share this post


Link to post
Share on other sites
  • 0

(Sarcastic)Thanks for answering to a old thread!

you change the size of the text by decreasing the resolution(and set the gui scale in minecraft options higher)

 

And no you cant change the resolution without changing the shell size(what a noob question)

Share this post


Link to post
Share on other sites
  • 0

Sorry, guess I should look at the time stamp on old threads.  And yes I am very noob w/regards to this mod and lua in general. Maybe I should stick with starting out on ComputerCraft so I don't ask stupid noob questions lol.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.