Skip to content

Commit

Permalink
feat: revision 0.0.7 (#89)
Browse files Browse the repository at this point in the history
* change: wasmoon decoupling in core html5

* docs: add readme for npmjs @gamely/core-native-html5

* change: organize npmjs packages

* feat: add module i18n #85

* docs: craete a new doxygen filter

* feat: native_draw_text html5 #83

* feat: add GC and Images #43 #45 #84

* docs: improve doxygen

* ci: publish all examples in matrix on web

* ci: fix deploy in cloudflare when is workflow_dispatch

* fix: std.draw.font in love

* feat: i18n uses system language as default

* feat: add support to haxe language #86

* docs: improve haxe docs and move command

* fix: tool-haxe-build missing close file

* fix: print better error in tool-haxe-build

* fix: zeebo_module nil

* feat: add module hash djb2 and fingerprint

* docs: @hideparam in doxygen filter

* feat: add support to javascript

* feat: support custom engine in core-native-html5

* docs: add @renamefunc to doxygen filter

* style: module renames #32

* fix: memory leak in std.draw.poly

* feat: add subcommand tool-love-zip #37

* ci: optmize tools/cd_npm_core-native-html5.lua

* style: fixes luau linter
  • Loading branch information
RodrigoDornelles authored Oct 4, 2024
1 parent ec61d61 commit eac32ae
Show file tree
Hide file tree
Showing 54 changed files with 1,555 additions and 298 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
*.css linguist-generated
*.sh linguist-generated
*.bat linguist-generated
*.txt linguist-language=Dox
.luaurc linguist-language=Json
8 changes: 6 additions & 2 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ permissions:
id-token: write

jobs:
npm-gly-cli:
npm:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: ['gly-cli', 'gly-engine', 'core-native-html5']
steps:
-
uses: actions/checkout@master
Expand All @@ -26,7 +30,7 @@ jobs:
registry-url: 'https://registry.npmjs.org'
-
run: |
lua tools/build_npm_cli.lua
lua tools/cd_npm_${{ matrix.package }}.lua
-
working-directory: ./dist
run: |
Expand Down
27 changes: 19 additions & 8 deletions .github/workflows/DOCS.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: docs

env:
CLOUDFLARE_PROJECT_DOXYGEN: doxygen-engine
CLOUDFLARE_PROJECT_PONG: pong-engine
CLOUDFLARE_PROJECT_DOXYGEN: doxygen-gly
CLOUDFLARE_PROJECT_EXAMPLE: example-gly

on:
workflow_dispatch:
Expand All @@ -21,32 +21,43 @@ jobs:
steps:
-
uses: actions/checkout@master
-
run: |
docker run --rm -v $(pwd):/app -w /app rodrigodornelles/doxygen:lua lua tools/doxygen_plugins.lua
-
run: |
docker run --rm -v $(pwd):/app -w /app rodrigodornelles/doxygen:lua doxygen
-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'workflow_dispatch'
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ env.CLOUDFLARE_PROJECT_DOXYGEN }}
directory: html

pong:
runs-on: ubuntu-latest
example:
if: github.event_name == 'push' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
game: ['asteroids', 'dvdplayer', 'helloworld', 'launcher', 'pong']
steps:
-
uses: actions/checkout@master
-
uses: leafo/gh-actions-lua@v10
with:
luaVersion: '5.4'
-
run: |
docker run --rm -v $(pwd):/app -w /app rodrigodornelles/doxygen:lua ./cli.sh build --core html5 ./examples/pong/game.lua --dist ./html/
./cli.sh build @${{ matrix.game }} --core html5 --dist ./html/
-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'workflow_dispatch'
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ env.CLOUDFLARE_PROJECT_PONG }}
projectName: ${{ matrix.game }}-${{ env.CLOUDFLARE_PROJECT_EXAMPLE }}
directory: html
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ vendor/
dist/
html/
latex/
doxygen/
.out
2 changes: 2 additions & 0 deletions .luaurc
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
"native_draw_color",
"native_draw_flush",
"native_draw_font",
"native_draw_image",
"native_draw_line",
"native_draw_rect",
"native_draw_start",
"native_draw_text",
"native_get_system_lang",
"io"
]
}
23 changes: 14 additions & 9 deletions Doxyfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Custom Configs
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Engine"
PROJECT_NUMBER = 0.0.6
PROJECT_NAME = "Gly Game Engine"
PROJECT_NUMBER = 0.0.7
PROJECT_BRIEF = "Game engine in lua"
PROJECT_LOGO =
PROJECT_LOGO = assets/icon80x80.png
OUTPUT_DIRECTORY = .
RECURSIVE = YES
CREATE_SUBDIRS = NO
Expand All @@ -17,18 +17,19 @@ SHORT_NAMES = YES
INLINE_GROUPED_CLASSES = YES
INLINE_SIMPLE_STRUCTS = YES
TYPEDEF_HIDES_STRUCT = YES
SOURCE_BROWSER = YES
SHOW_FILES = NO
SOURCE_BROWSER = NO
VERBATIM_HEADERS = NO
REPEAT_BRIEF = NO
PREDEFINED = DOXYGEN=
PLANTUML_JAR_PATH = $(PLANTUML_JAR_PATH)
PLANTUML_CFG_FILE =
PLANTUML_INCLUDE_PATH =
OUTPUT_LANGUAGE = English
FILE_PATTERNS = *.lua
FILTER_PATTERNS = *.lua=lua2dox
FILE_PATTERNS = *.lua *.txt
FILTER_PATTERNS = *="lua tools/doxygen_filter.lua"
EXTENSION_MAPPING = .lua=C++
INPUT = README.md SUPPORT.md src examples
USE_MDFILE_AS_MAINPAGE = README.md
INPUT = docs src examples
MARKDOWN_ID_STYLE = GITHUB
ALIASES += startjson=@startuml{json}
ALIASES += endjson=@enduml
Expand All @@ -40,6 +41,10 @@ ALIASES += endsalt=@enduml
GENERATE_TREEVIEW = YES
DISABLE_INDEX = NO
FULL_SIDEBAR = NO
HTML_HEADER = doxygen/header.html
HTML_EXTRA_STYLESHEET = $(DOXYGEN_AWESOME_PATH)/doxygen-awesome.css \
$(DOXYGEN_AWESOME_PATH)/doxygen-awesome-sidebar-only.css
$(DOXYGEN_AWESOME_PATH)/doxygen-awesome-sidebar-only.css \
$(DOXYGEN_AWESOME_PATH)/doxygen-awesome-sidebar-only-darkmode-toggle.css
HTML_EXTRA_FILES = $(DOXYGEN_AWESOME_PATH)/doxygen-awesome-darkmode-toggle.js \
$(DOXYGEN_AWESOME_PATH)/doxygen-awesome-paragraph-link.js
HTML_COLORSTYLE = LIGHT
7 changes: 7 additions & 0 deletions docs/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@mainpage

@li @ref helloworld
@li @ref install
@li @ref why "Plataform Support"
@li [View the CLI/Engine source code](https://github.com/gamelly/gly-engine)
@li @ref why "Comparison between Game Engines"
60 changes: 60 additions & 0 deletions docs/install.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@page install How to Install

@li @ref cli_download "download a unique lua file using wget"
@li @ref cli_download "download a unique lua file using curl"
@li @ref npm_install "install as system command using npm"
@li @ref npm_install "install as project dependency using npm"

@anchor npm_install

## using npm

### global

```
npm install -g demoon @gamely/gly-cli
```

now you can execute as a global command!

```
gly-cli version
```

### local

```
npm install --dev @gamely/gly-cli
```

now you need use npx to run inside your project!

```
npx gly-cli version
```

---

@anchor cli_download

## unique lua file

@note @b Attention! that although it is a `.lua` file, @n it is obfuscating in a way, to browse the source code use `lua cli.lua cli-dump`

### curl

```
wget get.gamely.com.br/cli.lua -o cli.lua
```

### wget

```
wget get.gamely.com.br/cli.lua
```

now you need a lua to execute a cli!

```
lua cli.lua version
```
45 changes: 45 additions & 0 deletions docs/why.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@page why Features and Support

## Comparison between Game Engines

### In-game Resources

| Native Resource | Gly Engine | Love2D | GameMaker | Unity | Godot |
| :--------------- | :--------- | :--------- | :--------- | :--------- | :--------- |
| Http Requests | Yes | No | No | Yes | Yes |
| Json Parse | Yes | No | No | No | Yes |
| I18N API | Yes | No | No | No | No |
| Cache API | Yes | No | No | Yes | No |
| QRCode API | Yes | No | No | No | No |
| Blend modes | No | No | Yes | Yes | Yes |
| Shadders | No | Yes | Yes | Yes | Yes |
| Image Tint | No | Yes | Yes | Yes | Yes |
| Image Rotate | No | Yes | Yes | Yes | Yes |
| Polygon Rotate | Yes | No | No | No | No |
| WASM HTML5 | Yes | No | Yes | Yes | Yes |
| Non-WASM HTML5 | Yes | No | Yes | No | No |

### Development Resources

| Native Resource | Gly Engine | Love2D | GameMaker | Unity | Godot |
| :--------------- | :--------- | :--------- | :--------- | :--------- | :----------- |
| CLI toolchain | Yes | No | No | No | Yes |
| REPL script | Lua | No | No | No | No |
| Code script | Lua, Haxe or JS | Lua | GMS | C# | C#, GDScript |
| Visual script | No | No | Yes | Yes | No |
| Package manager | Yes | No | Yes | Yes | No |
| IDE Programming | Yes | No | Yes | Yes | Yes |
| Unit Test tools | Yes | No | No | Yes | Yes |


## Plataform Support

@call support

### Development environment

| Tier 1 | Linux, MacOS or BSD | main platform |
| :----- | :------------------ | :------------ |
| Tier 2 | NodeJS CLI | full support WIP
| Tier 3 | HTML5 IDE | support
| Tier 4 | Windows | support
63 changes: 44 additions & 19 deletions examples/asteroids/game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,25 @@
--! 8 -> 4: resume
--! @enduml

--! @cond
local function i18n(std, game)
return {
['pt-BR'] = {
['lifes:'] = 'vidas:',
['Continue'] = 'Continuar',
['New Game'] = 'Novo Jogo',
['Dificulty'] = 'Dificuldade',
['Invincibility'] = 'Imortabilidade',
['Object Limit'] = 'Limitador',
['Graphics'] = 'Graficos',
['fast'] = 'rapido',
['pretty'] = 'bonito',
['Language'] = 'Idioma',
['Credits'] = 'Creditos',
['Exit'] = 'Sair'
}
}
end

local function draw_logo(std, game, height, anim)
anim = anim or 0
std.draw.font('sans', 32)
Expand Down Expand Up @@ -143,7 +161,6 @@ local function asteroid_destroy(std, game, id)

return score
end
--! @endcond

local function init(std, game)
-- game
Expand Down Expand Up @@ -205,7 +222,7 @@ local function loop(std, game)
local keyv = std.key.press.down - std.key.press.up
local keyh = std.key.press.right - std.key.press.left + std.key.press.enter + std.key.press.red
if keyv ~= 0 and game.milis > game.menu_time + 250 then
game.menu = std.math.clamp(game.menu + keyv, game.player_pos_x == (game.width/2) and 2 or 1, 8)
game.menu = std.math.clamp(game.menu + keyv, game.player_pos_x == (game.width/2) and 2 or 1, 9)
game.menu_time = game.milis
end
if keyh ~= 0 and game.milis > game.menu_time + 100 then
Expand All @@ -226,8 +243,10 @@ local function loop(std, game)
game.graphics_fastest = std.math.clamp(game.graphics_fastest + keyh, 0, 1)
game.fps_max = 100
elseif game.menu == 7 then
game.state = 2
std.i18n.next_language()
elseif game.menu == 8 then
game.state = 2
elseif game.menu == 9 then
std.game.exit()
end
end
Expand Down Expand Up @@ -372,30 +391,35 @@ local function draw(std, game)
if game.state == 1 then
local s2 = 0
local h = game.height/16
local graphics = game.graphics_fastest == 1 and 'rapido' or 'bonito'
local hmenu = (h*(4+game.menu)) + 24
local language = std.i18n.get_language()
local graphics = game.graphics_fastest == 1 and 'fast' or 'pretty'
local s = draw_logo(std, game, h*2)
std.draw.font('sans', 16)
std.draw.color(std.color.white)
if game.player_pos_x ~= (game.width/2) then
std.draw.text(game.width/2 - s, h*6, 'Continuar')
std.draw.text(game.width/2 - s, h*5, 'Continue')
end
std.draw.text(game.width/2 - s, h*7, 'Novo Jogo')
std.draw.text(game.width/2 - s, h*8, 'Dificuldade')
std.draw.text(game.width/2 - s, h*9, 'Imortalidade')
std.draw.text(game.width/2 - s, h*10, 'Limitador')
std.draw.text(game.width/2 - s, h*11, 'Graficos')
std.draw.text(game.width/2 - s, h*12, 'Creditos')
std.draw.text(game.width/2 - s, h*13, 'Sair')
std.draw.line(game.width/2 - s, (h*(5+game.menu)) + 24, game.width/2 + s, (h*(5+game.menu)) + 24)
std.draw.text(game.width/2 - s, h*6, 'New Game')
std.draw.text(game.width/2 - s, h*7, 'Dificulty')
std.draw.text(game.width/2 - s, h*8, 'Invincibility')
std.draw.text(game.width/2 - s, h*9, 'Object Limit')
std.draw.text(game.width/2 - s, h*10, 'Graphics')
std.draw.text(game.width/2 - s, h*11, 'Language')
std.draw.text(game.width/2 - s, h*12, 'Credits')
std.draw.text(game.width/2 - s, h*13, 'Exit')
std.draw.line(game.width/2 - s, hmenu, game.width/2 + s, hmenu)
std.draw.color(std.color.red)
s2=std.draw.text(game.level)
std.draw.text(game.width/2 + s - s2, h*8, game.level)
std.draw.text(game.width/2 + s - s2, h*7, game.level)
s2=std.draw.text(game.imortal)
std.draw.text(game.width/2 + s - s2, h*9, game.imortal)
std.draw.text(game.width/2 + s - s2, h*8, game.imortal)
s2=std.draw.text(game.asteroids_max)
std.draw.text(game.width/2 + s - s2, h*10, game.asteroids_max)
std.draw.text(game.width/2 + s - s2, h*9, game.asteroids_max)
s2=std.draw.text(graphics)
std.draw.text(game.width/2 + s - s2, h*11, graphics)
std.draw.text(game.width/2 + s - s2, h*10, graphics)
s3=std.draw.text(language)
std.draw.text(game.width/2 + s - s3, h*11, language)
return
elseif game.state == 2 then
local height = game.height/4
Expand Down Expand Up @@ -475,11 +499,12 @@ local P = {
version='1.0.0'
},
config = {
require = 'math random',
require = 'math math.random i18n',
fps_drop = 5,
fps_time = 5
},
callbacks={
i18n=i18n,
init=init,
loop=loop,
draw=draw,
Expand Down
Loading

0 comments on commit eac32ae

Please sign in to comment.