From 16cbc612a5773b76121fae82eda309f06dc5e2d7 Mon Sep 17 00:00:00 2001 From: qfx Date: Wed, 19 Feb 2020 23:09:18 +0200 Subject: [PATCH] More typescript stuff --- .gitignore | 1 + core/input.d.ts | 11 +---------- core/input.lua | 2 ++ helium.d.ts => init.d.ts | 9 +++++---- init.lua | 4 +++- 5 files changed, 12 insertions(+), 15 deletions(-) create mode 100644 .gitignore rename helium.d.ts => init.d.ts (62%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a0a61f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +local_conf.lua diff --git a/core/input.d.ts b/core/input.d.ts index 2256d40..ce197d9 100644 --- a/core/input.d.ts +++ b/core/input.d.ts @@ -3,13 +3,4 @@ interface Subscription{ off():void; } -export enum inputType{ - clicked = "clicked", - keypressed = "keypressed", - hover = "hover", - mousepressed = "mousepressed", - mousereleased = "mousereleased", - dragged = "dragged" -} - -export function input(it:inputType,cb:(x?:number,y?:number)=>void,doff?:boolean,x?:number,y?:number,w?:number,h?:number): Subscription; \ No newline at end of file +export default function input(it:string,cb:(x?:number,y?:number)=>void,doff?:boolean,x?:number,y?:number,w?:number,h?:number): Subscription; \ No newline at end of file diff --git a/core/input.lua b/core/input.lua index 20aaa7d..bc246b5 100755 --- a/core/input.lua +++ b/core/input.lua @@ -506,4 +506,6 @@ function input.eventHandlers.mousemoved(x, y, dx, dy) return captured end +--Typescript +input.input = input return input \ No newline at end of file diff --git a/helium.d.ts b/init.d.ts similarity index 62% rename from helium.d.ts rename to init.d.ts index f61d9b1..96767aa 100644 --- a/helium.d.ts +++ b/init.d.ts @@ -21,12 +21,13 @@ interface HeliumElement{ view: view; state: state; parameters: parameters; - draw(x:number,y:number): null; - undraw(): null; + draw(this,x:number,y:number): null; + undraw(this): null; } +declare function HeliumLoader(filepath:string):(params:parameters, w:number, h:number)=>HeliumElement; export module helium{ - export let input: typeof import("./core/input") ; + export let input: typeof import("./helium/core/input") ; } -export function helium(chunk:(params:T,state:state,view:view)=>()=>void):(params:T, w:number, h:number)=>HeliumElement; \ No newline at end of file +export function helium(chunk:(params:T,state:state,view:view)=>()=>void):(params:T, w:number, h:number)=>HeliumElement; diff --git a/init.lua b/init.lua index 5f011db..757eadf 100755 --- a/init.lua +++ b/init.lua @@ -5,7 +5,7 @@ ----------------------------------------------------]] local path = ... local helium = require(path..".dummy") -helium.conf = require(path..".conf") +helium.conf = require(path..".local_conf") or require(path..".conf") helium.utils = require(path..".utils") helium.element = require(path..".core.element") helium.input = require(path..".core.input") @@ -124,4 +124,6 @@ if helium.conf.AUTO_RUN then end end +--Typescript +helium.helium = helium return helium \ No newline at end of file