Create games and apps with typescript and jsx.
More...
|
| JSX |
| Write UI for apps with GlyEngine + TSX.
|
|
The .ts
and .tsx
support works perfectly with the gly engine, you can use it on old consoles, ginga and any other device supported by the gly ecosystem, you can also take advantage of components and libraries written in lua and typescript at the same time.
- Tutorial
To build you need an auxiliary tool available via npmjs, so I recommend you use the @gamely/gli-cli package and nodejs as the environment for gly-engine.
- Step 1
configure your tsconfig.json and package.json like this:
- tsconfig.json
{
"$schema": "https://raw.githubusercontent.com/TypeScriptToLua/TypeScriptToLua/master/tsconfig-schema.json",
"compilerOptions": {
"outDir": "build"
},
"tstl": {
"buildMode": "library",
"luaTarget": "universal",
"luaLibImport": "inline",
"noImplicitGlobalVariables": true,
"noImplicitSelf": true,
"noHeader": true
}
}
- package.json
You don't necessarily need to build for HTML because it's in Node JS, you can use other targets:
"build": "gly-cli build --cwd build src/game.lua --core love --bundler"
"build": "gly-cli build --cwd build src/game.lua --core ginga --bundler --enterprise"
{
"scripts": {
"prebuild": "tstl",
"build": "gly-cli build-html --cwd build src/game.lua --fengari --enginecdn"
},
"dependencies": {
"@gamely/gly-cli": "0.1.1",
"typescript-to-lua": "^1.31.2"
}
}
- Step 2
download npmjs packages
- Step 3
execute build script
- Template
export const title =
'Your Awesome Game'
export const author = 'IntellectualAuthor'
export const version = '1.0.0'
export const description = 'The best game in the world made in GlyEngine'
export function init(std: any, game: any) {
}
export function loop(std: any, game: any) {
}
export function draw(std: any, game: any) {
}
export function
exit(std: any, game: any) {
}
local function title(window_name)
export const meta = {
title:
'Your Awesome Game',
author: 'IntellectualAuthor',
version: '1.0.0',
description: 'The best game in the world made in GlyEngine'
}
function init(std: any, game: any) {
}
function loop(std: any, game: any) {
}
function draw(std: any, game: any) {
}
function exit(std: any, game: any) {
}
}
local function callbacks(handler)