Giter VIP home page Giter VIP logo

du_render_script_library's Introduction

du_render_script_library

A library to build renderscript in boards without writting it as a full string

The goal of that lib is to make RenderScript easier to write and read when written un control units and not directly in screens.

Project status

This project is currently in developpement and not finished yet.

I'm currently looking for feedbacks and ideas to improve it and fix some limitations like how to render a function or loop or condition in the render script.

Feel free to contact me on discord Jericho#1060 or on my guilded server : https://guilded.jericho.dev

How to use it

Paste all the content of the library (prefer the minified version) at the start of your script in a control unit in game and then you can use it like this:

local script = setmetatable({},RenderScript)
local MyFirstLayer = script:createLayer()
script:addBox(MyFirstLayer,0,0,100,100)

if not script:isTooLong() then
    script:sendToScreen(screen)
else
    system.print("WARNING: Script too long!! Length is actualy " .. script:len() .. " / " .. script:getMaxSize())
end

Code before

Code was all formated as a string and was hard to read, write and debug

local script = [[
    local MyFirstLayer = createLayer()
    addBox(MyFirstLayer, 0, 0, 100, 100)
]]

screen.setRenderScript(script)

Addition to the default render script

This library add some functions to the default render script:

Third Party libraries support

use(libraryName): Use a third party library in the renderscript

  • libraryName: string The name of the library to use, it will also be used as the variable name to access it in the renderScript

useAtlas(): Use the atlas library in the renderscript

useJSON(): Use the JSON (dkjson) library in the renderscript

useRSLib(): Use the RSLib library in the renderscript

RenderScript utilities functions

getMaxSize(): Get the maximum size of the render script

isTooLong(): Check if the render script is too long

sendToScreen(screen): Send the render script to a screen

Others

insertCodeLine(code): Insert a line of code in the render script

du_render_script_library's People

Contributors

jericho1060 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.