Giter Site home page Giter Site logo

4panda / shatter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hugeblank/shatter

0.0 0.0 0.0 54 KB

Shatter your dull Overlay Glasses experience by turning it into a redirectable terminal target!

License: Do What The F*ck You Want To Public License

Lua 100.00%

shatter's Introduction

Shatter

Shatter your dull Overlay Glasses experience by turning it into a redirectable terminal target!

Shatter adds several features to the overlay glasses experience beyond a terminal. It is meant to be used in a neural interface (obviously) with an unbound wireless keyboard.

Brief Rundown

API

  • Parameters
    • table: canvas object provided by the overlay glasses
  • Returns
    • table: terminal object
    • function: cursor handler function to be put in parallel with your code

Terminal Object

Alpha Manipulation

getTextAlpha: get the alpha value for the text

  • Parameters
    • none
  • Returns
    • number: alpha value, in range 0-1

getBackgroundAlpha: get the alpha value for the background

  • Parameters
    • none
  • Returns
    • number: alpha value, in range 0-1

setTextAlpha: set the alpha value for the text

  • Parameters
    • number: alpha value within range 0-1
  • Returns
    • none

setBackgroundAlpha: set the alpha value for the background

  • Parameters
    • number: alpha value within range 0-1
  • Returns
    • none

Hex Color Manipulation

setTextHex: set the text color using any hex color code. Includes rg, and b

  • Parameters
    • number: hex code for color value
  • Returns
    • none

setBackgroundHex: set the background color using any hex color code. Includes rg, and b

  • Parameters
    • number: hex code for color value
  • Returns
    • none

getTextHex: set the text color using any hex color code. Includes rg, and b

  • Parameters
    • none
  • Returns
    • number: hex code for color value

getBackgroundHex: set the background color using any hex color code. Includes rg, and b

  • Parameters
    • none
  • Returns
    • number: hex code for color value

Scaling

setTextScale: set the text and background pixel scale

  • Parameters
    • number: scale value within range 0.5-10
  • Returns
    • none

Events

shatter_resize: fired when the shatter terminal object is resized

Getting Started

Let's set up all elements of shatter! Obviously you're here for this part so I'll make it as brief as possible.

  1. run wget https://raw.githubusercontent.com/hugeblank/Shatter/master/shatter.lua on your neural interface that has overlay glasses.
  2. Find an unbound wireless keyboard, this functions as both a keyboard & mouse, keep that in mind.

Putting it all Together

Here's an example of how you could put a startup file together, runs shell on the redirected overlay glasses:

local shatter = require("shatter") -- Load the shatter API
local mods = peripheral.wrap("back") -- get the modules list
if not mods.canvas then -- ensure glasses are present
  error("Overlay Glasses required") -- error if they aren't there
end
_G.glasses, handler = shatter(mods.canvas()) -- get the terminal object, and put it in the global scope (for alpha setting [and more!] in the shell)
parallel.waitForAll(handler, -- put the handler function in parallel
function()
  term.redirect(glasses) -- redirect to overlay
  glasses.setBackgroundAlpha(.4) -- set the alpha value of the background to .4, for visibility.
  term.clear() -- apply the alpha value change
  if multishell then -- if an advanced computer run multishell
    shell.run("/rom/programs/advanced/multishell.lua")
  else -- otherwise run the shell
    shell.run("shell")
  end
end,
function()
  while true do
    os.pullEvent("shatter_resize") -- check for when the glasses get resized
    os.queueEvent("term_resize") -- apply it to the shell terminal
  end
end)

shatter's People

Contributors

hugeblank avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.