Skip to content

Collection of tools for the pixelbox 2D rendering graphics suite

License

Notifications You must be signed in to change notification settings

9551-Dev/pixelbox_modules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pixelbox modules

Hopefully soon to be growing collection of modules and tools to be loading and used with pixelbox_lite

Developing modules

Check DEV.md for explanations of arguments, return values, and callbacks.

Module index

How to load pixelbox modules?

Pixelbox provides two ways to load modules, those are

Loading on creation

You can simply use of the third argument of pixelbox.new, this argument takes in a table of modules (and load settings, more info around here)

This would look something like this

local box = require("pixelbox_lite").new(term.current(),nil,{
    require("pb_modules/module1"),
    require("pb_modules/module2"),
    require("pb_modules/module3"),

    force   = false,
    supress = false,
})

Loading on "runtime"

In case you want to split loading up or you want to load more modules later on, you can do so using the load_modules function, this function takes in just a single argument which acts identical to pixelbox.news third argument, it just takes a list of plugins and flags and loads them in order. More info can again be found here here)

Usage of this might look something like this

local box = require("pixelbox_lite").new(term.current())

box:load_modules{
    require("pb_modules/module1"),
    require("pb_modules/module2"),
    require("pb_modules/module3"),

    force   = false,
    supress = false,
}

Notes around loading modules

  • Modules are loaded in the same order they are passed in
  • Some modules may have dependencies and need to be loaded in a specific order
  • Some modules might need to be loaded on box creation rather than runtime
  • Modules can tell apart how they are being loaded and act accordingly.

Modules

Redirects the pixelbox :draw() call to CraftOS PCs graphics mode

Usecase: Testing how programs run at higher resolutions

Notes:

  • Requires graphics mode to be set to 1 for the :draw() call to be performed
  • Doesnt enable graphics mode on its own, term.setGraphicsMode call required
  • Supports monitors and any terminals with an existing drawPixels function
- id:   PB_MODULE:gfxrnd
- name: PB_GFXRender

Adds an analyze_buffer function which sanity checks buffer data

Usecase: Debugging potentially weird/internal errors thrown by pixelbox

Methods:

  • box[root]:analyze_buffer() -> [boolean]
    • Reads all the data in the canvas which is meant to be used with the current setting, checks for canvas, scanline, pixel and color value validity, throws an error if something is invalid. Returns true on all checks passed
- id:   PB_MODULE:analyzer
- name: PB_Analyzer

About

Collection of tools for the pixelbox 2D rendering graphics suite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published