Haxe bindings for koreader
Revision | a391f3cc4c77d37c49630de200066f027e5b0d83 (tree) |
---|---|
Time | 2021-03-16 07:31:57 |
Author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fast...> |
Commiter | Jaime Marquínez Ferrándiz |
Initial commit
@@ -0,0 +1,1 @@ | ||
1 | +out/haxe_koreader_demo.lua |
@@ -0,0 +1,4 @@ | ||
1 | +haxe-koreader | |
2 | +============= | |
3 | + | |
4 | +Haxe definitions for the [Koreader LUA api](http://koreader.rocks/doc/index.html). | |
\ No newline at end of file |
@@ -0,0 +1,12 @@ | ||
1 | +import koreader.ui.UIManager; | |
2 | +import koreader.ui.widget.InfoMessage; | |
3 | +import koreader.Logger; | |
4 | + | |
5 | +class Main { | |
6 | + public static function main() { | |
7 | + trace("Haxe trace"); | |
8 | + Logger.instance.dbg("Debug information:", 1); | |
9 | + UIManager.instance.show( | |
10 | + InfoMessage.create({text: "Message from haxe"})); | |
11 | + } | |
12 | +} | |
\ No newline at end of file |
@@ -0,0 +1,9 @@ | ||
1 | +--lua out/haxe_koreader_demo.lua | |
2 | + | |
3 | +# Avoid luautf8 dependency | |
4 | +-D lua-vanilla | |
5 | + | |
6 | +--class-path src | |
7 | +--class-path demo | |
8 | + | |
9 | +--main Main | |
\ No newline at end of file |
@@ -0,0 +1,11 @@ | ||
1 | +package koreader; | |
2 | + | |
3 | +import haxe.extern.Rest; | |
4 | + | |
5 | +@:luaRequire("logger") | |
6 | +extern class Logger { | |
7 | + @:selfCall | |
8 | + public static final instance:Logger; | |
9 | + | |
10 | + public function dbg(params:Rest<Any>): Void; | |
11 | +} | |
\ No newline at end of file |
@@ -0,0 +1,14 @@ | ||
1 | +package koreader.ui; | |
2 | + | |
3 | +import koreader.ui.widget.Widget; | |
4 | + | |
5 | +@:luaRequire("ui/uimanager") | |
6 | +extern class UIManager { | |
7 | + @:selfCall | |
8 | + public static final instance:UIManager; | |
9 | + | |
10 | + @:native("new") | |
11 | + public function create() : UIManager; | |
12 | + | |
13 | + function show(widget: Widget) : Void; | |
14 | +} | |
\ No newline at end of file |
@@ -0,0 +1,10 @@ | ||
1 | +package koreader.ui.widget; | |
2 | + | |
3 | +@:luaRequire("ui/widget/eventlistener") | |
4 | +extern class EventListener { | |
5 | + @:selfCall | |
6 | + public static final instance:EventListener; | |
7 | + | |
8 | + @:native("new") | |
9 | + public function create() : EventListener; | |
10 | +} | |
\ No newline at end of file |
@@ -0,0 +1,20 @@ | ||
1 | +package koreader.ui.widget; | |
2 | + | |
3 | +@:luaRequire("ui/widget/infomessage") | |
4 | +extern class InfoMessage extends Widget { | |
5 | + @:selfCall | |
6 | + public static final instance:InfoMessage; | |
7 | + | |
8 | + @:native("new") | |
9 | + private function create(params: InfoMessageParams) : InfoMessage; | |
10 | + | |
11 | + public static inline function create(params: InfoMessageParams) : InfoMessage { | |
12 | + return InfoMessage.instance.create(params); | |
13 | + } | |
14 | + | |
15 | + public function dismiss():Void; | |
16 | +} | |
17 | + | |
18 | +typedef InfoMessageParams = { | |
19 | + var text: String; | |
20 | +} | |
\ No newline at end of file |
@@ -0,0 +1,6 @@ | ||
1 | +package koreader.ui.widget; | |
2 | + | |
3 | +@:luaRequire("ui.widget.widget") | |
4 | +extern class Widget extends EventListener { | |
5 | + | |
6 | +} | |
\ No newline at end of file |