This commit is contained in:
Gvidas Juknevičius 2024-08-23 01:55:15 +03:00
parent 2f4aec6544
commit 652e0d27a0
Signed by: MCorange
GPG Key ID: 12B1346D720B7FBB
5 changed files with 3258 additions and 1 deletions

1
build.sh Normal file
View File

@ -0,0 +1 @@

229
libs/basalt/basalt.d.ts vendored Normal file
View File

@ -0,0 +1,229 @@
declare module basalt {
interface Theme {
BaseFrameBG: number,
BaseFrameText: number,
FrameBG: number,
FrameText: number,
ButtonBG: number,
ButtonText: number,
CheckboxBG: number,
CheckboxText: number,
InputBG: number,
InputText: number,
TextfieldBG: number,
TextfieldText: number,
ListBG: number,
ListText: number,
MenubarBG: number,
MenubarText: number,
DropdownBG: number,
DropdownText: number,
RadioBG: number,
RadioText: number,
SelectionBG: number,
SelectionText: number,
GraphicBG: number,
ImageBG: number,
PaneBG: number,
ProgramBG: number,
ProgressbarBG: number,
ProgressbarText: number,
ProgressbarActiveBG: number,
ScrollbarBG: number,
ScrollbarText: number,
ScrollbarSymbolColor: number,
SliderBG: boolean,
SliderText: number,
SliderSymbolColor: number,
SwitchBG: number,
SwitchText: number,
LabelBG: boolean,
LabelText: number,
GraphBG: number,
GraphText: number,
}
function debug(...txt: string[]): void;
function autoUpdate(enabled: boolean): void;
function stop(): void;
function stopUpdate(): void;
function createFrame<T extends BaseFrame>(id?: string): T;
function setActiveFrame<T extends BaseFrame>(f: T): void;
function getFrame<T extends BaseFrame>(id: string): T;
function getActiveFrame<T extends BaseFrame>(): T;
function removeFrame(id: string): void;
function setTheme(theme: Theme): void;
function getTheme(s: string): number;
function setVariable<T>(k: string, v: T): void;
function getVariable<T>(k: string): T;
function getVersion(): string;
function isKeyDown(key: number): boolean;
function log(msg: string, prefix: "ERROR" | "WARN" | "INFO" | "DEBUG" | string): void;
function memory(): number;
function onEvent(fn: (event: string) => boolean): void;
function schedule(fn: <T>(v: T) => void): void;
function setMouseDragThrottle(throttle: number): void;
function setMouseMoveThrottle(throttle: number): void;
function setRenderingThrottle(throttle: number): void;
class Object {
enable(): void;
disable(): void;
getType(): string;
isType(t: string): boolean;
getName(): string;
getParent<T extends Object>(): T | null;
setParent<T extends Object, O extends Object>(p: T): O;
getZIndex(): number;
}
class VisualObject extends Object {
show<T extends VisualObject>(): T;
hide<T extends VisualObject>(): T;
setVisible(vis: boolean): boolean;
isVisible(): boolean;
setPosition<T extends VisualObject>(x: number|string, y: number|string, add?: boolean): T;
getPosition(): [number, number];
getX(): number;
getY(): number;
setSize<T extends VisualObject>(w: number|string, h: number|string): T;
getSize(): [number, number];
getWidth(): number;
getHeight(): number;
setBackground<T extends VisualObject>(color: number|false, symbol?: string, symbol_color?: number): T;
getBackground(): number|false;
setForeground<T extends VisualObject>(color: number|false): T;
getForeground(): number|false;
setTransparency<T extends VisualObject>(v: boolean): T;
setZIndex<T extends VisualObject>(i: number): T;
getAbsolutePosition(x?: number, y?: number): [number, number];
ignoreOffset<T extends VisualObject>(v: boolean): T;
isFocused(): boolean;
setShadow<T extends VisualObject>(v: number): T;
getShadow(): number|false;
setBorder<T extends VisualObject>(c: number, ...sides: string[]): T;
animatePosition<T extends VisualObject>(x: number, y: number, dur: number, offset?: number, mode?: string, fn?: () => void): T;
animateSize<T extends VisualObject>(w: number, h: number, dur: number, offset?: number, mode?: string, fn?: () => void): T;
animateOffset<T extends VisualObject>(x: number, y: number, dur: number, offset?: number, mode?: string, fn?: () => void): T;
addTexture<T extends VisualObject>(path: string, isAnimated: boolean): T;
setTextureMode<T extends VisualObject>(mode: string): T;
setInfiniteMode<T extends VisualObject>(v: boolean): T;
addDraw<T extends VisualObject>(id: string, fn: () => void, pos: number, where: number, imm: boolean): T;
addPreDraw<T extends VisualObject>(id: string, fn: () => void, pos: number, imm: boolean): T;
addPostDraw<T extends VisualObject>(id: string, fn: () => void, pos: number, imm: boolean): T;
setDrawState<T extends VisualObject>(id: string, state: boolean): T;
getDrawId(id: string): number;
addText<T extends VisualObject>(x: number, y: number, s: string): T;
addBg<T extends VisualObject>(x: number, y: number, c: string): T;
addFg<T extends VisualObject>(x: number, y: number, c: string): T;
addBlit<T extends VisualObject>(x: number, y: number, s: string, fg: string, bg: string): T;
addBox<T extends VisualObject>(x: number, y: number, w: number, h: number, s: string): T;
addBackgroundBox<T extends VisualObject>(x: number, y: number, w: number, h: number, c: number): T;
addForegroundBox<T extends VisualObject>(x: number, y: number, w: number, h: number, c: number): T;
}
class ChangeableObject extends VisualObject {
setValue<T extends VisualObject>(v: any): T;
getValue<T>(): T;
}
class Container extends VisualObject {
addChild<T>(c: T): T;
getChild<T extends Container>(id: string): T;
getDeepChild<T extends Container>(id: string): T;
removeChild(id: string): boolean;
removeChildren<T extends Container>(): T;
updateZIndex<T extends Container, O extends Container>(which: O, idx: number): T;
setImportant<T extends Container>(id: string): T;
clearFocusedChild<T extends Container>(): T;
setFocusedObject<T extends Container, O extends Container>(o: O): T;
}
class BaseFrame extends Container {
getOffset(): [number, number];
setOffset<T extends BaseFrame>(x: number, y: number): T;
}
class MonitorFrame extends BaseFrame {
setMonitor<T extends MonitorFrame>(mon: string|Monitor): T;
setMonitorGroup<T extends MonitorFrame>(mon: (string|Monitor)[][]): T;
}
class Frame extends Container {
getOffset(): [number, number];
setOffset<T extends Frame>(x: number, y: number): T;
}
class ScrollableFrame extends Frame {
setDirection<T extends ScrollableFrame>(d: string): T;
}
type Justify = "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
type Direction = "row" | "column";
class Flexbox extends ScrollableFrame {
setSpacing<T extends Flexbox>(s?: number): T;
getSpacing(): number;
setDirection<T extends Flexbox | ScrollableFrame>(d: Direction): T;
getDirection(): Direction;
setJustifyContent<T extends Flexbox>(s?: Justify): T;
getJustifyContent(): Justify;
setWrap<T extends Flexbox>(w: "wrap" | "nowrap"): T;
getWrap(): "wrap" | "nowrap";
updateLayout<T extends Flexbox>(): T;
addBreak<T extends Flexbox>(): T;
getFlexGrow(): number;
setFlexGrow<T extends Flexbox>(g: number): T;
getFlexShrink(): number;
setFlexShrink<T extends Flexbox>(g: number): T;
getFlexBasis(): number;
setFlexBasis<T extends Flexbox>(g: number): T;
}
type DraggingMap = [number, number, number, number];
class MovableFrame extends Frame {
setDraggingMap<T extends MovableFrame>(m: DraggingMap): T;
getDraggingMap(): DraggingMap;
}
class Button extends VisualObject {
setText<T extends VisualObject>(t: string): T;
setHorizontalAlign<T extends VisualObject>(a: "left" | "center" | "right"): T;
setVerticalAlign<T extends VisualObject>(a: "top" | "center" | "bottom"): T;
}
class Checkbox extends ChangeableObject {
setSymbol<T extends Checkbox>(s: string): T;
}
class Graph extends ChangeableObject {
setGraphColor<T extends Graph>(c: number): T;
setGraphSymbol<T extends Graph>(s: string): T;
getGraphSymbol(): string;
addDataPoint<T extends Graph>(v: number): T;
setMaxValue<T extends Graph>(v: number): T;
getMaxValue(): number;
setMinValue<T extends Graph>(v: number): T;
getMinValue(): number;
setGraphType<T extends Graph>(t: "scatter" | "line" | "bar"): T;
setMaxEntries<T extends Graph>(v: number): T;
getMaxEntries(): number;
}
class Image extends VisualObject {
loadImage<T extends Image>(p: string): T;
setImage(img: any, fmt: "nfp" | "bimg"): void;
usePalette<T extends Image>(change: boolean): T;
play<T extends Image>(p: boolean): T;
selectFrame<T extends Image>(idx: number): T;
loadImage<T extends Image>(p: string): T;
getMetadata(k: string): unknown;
setImageSize<T extends Image>(w: number, h: number): T;
getImageSize(): [number, number];
}
}

2988
libs/basalt/basalt.lua Normal file

File diff suppressed because one or more lines are too long

34
rOSs.lua Normal file
View File

@ -0,0 +1,34 @@
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
local ____modules = {}
local ____moduleCache = {}
local ____originalRequire = require
local function require(file, ...)
if ____moduleCache[file] then
return ____moduleCache[file].value
end
if ____modules[file] then
local module = ____modules[file]
local value = nil
if (select("#", ...) > 0) then value = module(...) else value = module(file) end
____moduleCache[file] = { value = value }
return value
else
if ____originalRequire then
return ____originalRequire(file)
else
error("module '" .. file .. "' not found")
end
end
end
____modules = {
["src.index"] = function(...)
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
local ____exports = {}
local function main(self)
end
main(nil)
return ____exports
end,
}
return require("src.index", ...)

View File

@ -8,9 +8,14 @@
"types": [],
"strict": true
},
"include": [
"src/**/*",
"libs/**/*",
],
"tstl": {
"luaTarget": "universal",
"luaBundleEntry": "src/index.ts",
"luaBundle": "rOSs.lua"
"luaBundle": "rOSs.lua",
"luaLibImport": "inline",
}
}