-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
468 additions
and
450 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
local_conf.lua | ||
local_conf.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
 | ||
# Helium | ||
## Major features: | ||
### Custom elements | ||
Write your own elements, and interface with them however you want to, | ||
Whether you need a generalized button that can have many themes and options or something super specific, it can be done | ||
### Efficient rendering & updating | ||
The elements only update&re-render when state changes | ||
### Code hotswap | ||
Change and save a file loaded through the helium.loader, and see changes immediately | ||
|
||
## Basic overview: | ||
Helium is practically more like a UI framework than a fully fledged UI library. | ||
The idea is to build custom, build simple and build fast, encapsulate. | ||
|
||
## Demo's / Practical examples | ||
[There's a repository of examples here](https://github.com/qfluxstudio/helium_demos) | ||
|
||
## Getting started: | ||
Load helium with `local helium = require 'helium'` | ||
|
||
The basic structure for an element is: | ||
|
||
```lua | ||
return function(param,state,view) | ||
--Setup zone | ||
return function() | ||
--Rendering zone | ||
end | ||
end | ||
``` | ||
|
||
 | ||
# Helium | ||
## Major features: | ||
### Custom elements | ||
Write your own elements, and interface with them however you want to, | ||
Whether you need a generalized button that can have many themes and options or something super specific, it can be done | ||
### Efficient rendering & updating | ||
The elements only update&re-render when state changes | ||
### Code hotswap | ||
Change and save a file loaded through the helium.loader, and see changes immediately | ||
|
||
## Basic overview: | ||
Helium is practically more like a UI framework than a fully fledged UI library. | ||
The idea is to build custom, build simple and build fast, encapsulate. | ||
|
||
## Demo's / Practical examples | ||
[There's a repository of examples here](https://github.com/qfluxstudio/helium_demos) | ||
|
||
## Getting started: | ||
Load helium with `local helium = require 'helium'` | ||
|
||
The basic structure for an element is: | ||
|
||
```lua | ||
return function(param,state,view) | ||
--Setup zone | ||
return function() | ||
--Rendering zone | ||
end | ||
end | ||
``` | ||
|
||
[The documentation outgrew this readme, see the github wiki](https://github.com/qfluxstudio/helium/wiki/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
return { | ||
HOTSWAP = true, --Turns on hotswap, disable this once you're deploying a project | ||
AUTO_RUN = true, --Replaces the default love.run | ||
DEBUG = true, --Reserved for later | ||
PURE_G = true, --whether to keep _G pure | ||
HARD_ERROR = true, --Whether to display element errors inside or hard cras | ||
return { | ||
HOTSWAP = true, --Turns on hotswap, disable this once you're deploying a project | ||
AUTO_RUN = true, --Replaces the default love.run | ||
DEBUG = true, --Reserved for later | ||
PURE_G = true, --whether to keep _G pure | ||
HARD_ERROR = true, --Whether to display element errors inside or hard cras | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,61 @@ | ||
local path = string.sub(..., 1, string.len(...) - string.len(".core.layout")) | ||
|
||
local layout = {} | ||
layout.__index = layout | ||
local element = require(path..'core.element') | ||
|
||
local function layout_new(type, x, y, w, h) | ||
local ctx = element.getContext() | ||
|
||
--The output will be in pixel numbers regardless of inputs | ||
if x <= 1 or not x then | ||
x = ctx.view.x * (x or 0) | ||
end | ||
|
||
if y <= 1 then | ||
y = ctx.view.y * (y or 0) | ||
end | ||
|
||
if w <= 1 then | ||
w = ctx.view.w * (w or 1) | ||
end | ||
|
||
if h <= 1 then | ||
h = ctx.view.h * (h or 1) | ||
end | ||
|
||
return setmetatable({ | ||
x = x, | ||
y = y, | ||
w = w, | ||
h = h | ||
}, layout) | ||
end | ||
|
||
|
||
--Sets mode for the proceding operations | ||
function layout.mode() | ||
|
||
end | ||
|
||
--Sets padding for the next operations | ||
function layout.pad() | ||
|
||
end | ||
|
||
--Sets margins for the proceding operations | ||
function layout.margin() | ||
|
||
end | ||
|
||
function layout.offset() | ||
|
||
end | ||
|
||
function layout:draw() | ||
|
||
end | ||
|
||
layout(0,0,1,1) | ||
|
||
return layout | ||
local path = string.sub(..., 1, string.len(...) - string.len(".core.layout")) | ||
|
||
local layout = {} | ||
layout.__index = layout | ||
local element = require(path..'core.element') | ||
|
||
local function layout_new(type, x, y, w, h) | ||
local ctx = element.getContext() | ||
|
||
--The output will be in pixel numbers regardless of inputs | ||
if x <= 1 or not x then | ||
x = ctx.view.x * (x or 0) | ||
end | ||
|
||
if y <= 1 then | ||
y = ctx.view.y * (y or 0) | ||
end | ||
|
||
if w <= 1 then | ||
w = ctx.view.w * (w or 1) | ||
end | ||
|
||
if h <= 1 then | ||
h = ctx.view.h * (h or 1) | ||
end | ||
|
||
return setmetatable({ | ||
x = x, | ||
y = y, | ||
w = w, | ||
h = h | ||
}, layout) | ||
end | ||
|
||
|
||
--Sets mode for the proceding operations | ||
function layout.mode() | ||
|
||
end | ||
|
||
--Sets padding for the next operations | ||
function layout.pad() | ||
|
||
end | ||
|
||
--Sets margins for the proceding operations | ||
function layout.margin() | ||
|
||
end | ||
|
||
function layout.offset() | ||
|
||
end | ||
|
||
function layout:draw() | ||
|
||
end | ||
|
||
layout(0,0,1,1) | ||
|
||
return layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
local path = string.sub(..., 1, string.len(...) - string.len(".control.size")) | ||
local stack = require(path..'.core.stack') | ||
|
||
--Sets the computed/minimum size of an element to be used with layout calculations and rendering | ||
return function(w, h) | ||
|
||
local path = string.sub(..., 1, string.len(...) - string.len(".control.size")) | ||
local stack = require(path..'.core.stack') | ||
|
||
--Sets the computed/minimum size of an element to be used with layout calculations and rendering | ||
return function(w, h) | ||
local currentStack = stack.getContext() | ||
currentStack.element:setCalculatedSize(w, h) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
local path = string.sub(..., 1, string.len(...) - string.len(".control.state")) | ||
local context = require(path.. ".core.context") | ||
|
||
return function (base) | ||
local base = base or {} | ||
local fakeBase = {} | ||
local activeContext = context.getContext() | ||
return setmetatable({},{ | ||
__index = function(t, index) | ||
return fakeBase[index] or base[index] | ||
end, | ||
__newindex = function(t, index, val) | ||
if fakeBase[index] ~= val then | ||
fakeBase[index] = val | ||
activeContext:bubbleUpdate() | ||
end | ||
end | ||
}) | ||
local path = string.sub(..., 1, string.len(...) - string.len(".control.state")) | ||
local context = require(path.. ".core.stack") | ||
|
||
return function (base) | ||
base = base or {} | ||
local fakeBase = {} | ||
local activeContext = context.getContext() | ||
return setmetatable({},{ | ||
__index = function(t, index) | ||
return fakeBase[index] or base[index] | ||
end, | ||
__newindex = function(t, index, val) | ||
if fakeBase[index] ~= val then | ||
fakeBase[index] = val | ||
activeContext:bubbleUpdate() | ||
end | ||
end | ||
}) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
interface Subscription{ | ||
on():void; | ||
off():void; | ||
} | ||
|
||
interface Subscription{ | ||
on():void; | ||
off():void; | ||
} | ||
|
||
export default function input(it:string,cb:(x?:number,y?:number)=>void,doff?:boolean,x?:number,y?:number,w?:number,h?:number): Subscription; |
Oops, something went wrong.