Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add core html5_tizen #46

Merged
merged 3 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/cli/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ local core_list = {
'assets/icon80x80.png'
}
},
html5_tizen={
src='src/engine/core/html5/main.lua',
pipeline={
zeebo_meta.late(game):file(dist..'index.html'):file(dist..'config.xml'):pipe(),
function() os.execute('cd '..dist..';~/tizen-studio/tools/ide/bin/tizen.sh package -t wgt;true') end
},
extras={
'src/engine/meta/html5_tizen/config.xml',
'src/engine/meta/html5_tizen/.tproject',
'src/engine/core/html5/index.html',
'src/engine/core/html5/index.html',
'src/engine/core/html5/engine.js',
'assets/icon80x80.png'
}
},
html5_ginga={
src='src/engine/core/html5/main.lua',
post_exe='ginga dist/main.ncl -s '..screen,
Expand Down
46 changes: 23 additions & 23 deletions src/engine/core/repl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@
--! digit = { ? 0 - 9 ? }- ;
--! exit = "?" ;
--! @endebnf
local math = require('math')
local std = require('src/lib/object/std')
local game = require('src/lib/object/game')
local zeebo_module = require('src/lib/engine/module')
local engine_game = require('src/lib/engine/game')
local engine_math = require('src/lib/engine/math')
local engine_color = require('src/lib/object/color')
local engine_math = require('src/lib/engine/math')
local engine_http = require('src/lib/engine/http')
local engine_csv = require('src/lib/engine/csv')
local application_default = require('src/lib/object/application')
local zeebo_math = require('src/lib/engine/math')
local color = require('src/lib/object/color')
local game = require('src/lib/object/game')
local std = require('src/lib/object/std')

local function line_skip_frames(line_src)
local frames, line = line_src:match('(%d+)!(.*)')
Expand Down Expand Up @@ -61,36 +67,30 @@ local function evaluate(var, assign, std, game, application)
end

local function main()
local line = nil
local frames = 0
local variable = ''
local assignment = ''
local file_name = arg[1]
local started = false
local application = application_default

if file_name then
local file_src = io.open(file_name, "r")
local apploader = file_src and load(file_src:read('*all'))
if not file_src then
error('game not found!'..file_name)
end
if not apploader then
error('game error!')
end
application = apploader()
end
local application = zeebo_module.loadgame(arg[1]) or application_default

-- init the game
std.math = zeebo_math
std.math.random = math.random
zeebo_module.require(std, game, application)
:package('@game', engine_game)
:package('@math', engine_math)
:package('@color', engine_color)
:package('@load', zeebo_module.load)
:package('@math', engine_math.clib)
:package('@random', engine_math.clib_random)
:package('@csv', engine_csv)
:run()

application.callbacks.init(std, game)

while true do
local index = 1
line = io.read()
local ok, line = pcall(io.read)

if line == nil or line == '?' then
if not ok or line == nil or line == '?' then
break
end

Expand Down
8 changes: 8 additions & 0 deletions src/engine/meta/html5_tizen/.tproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<tproject xmlns="http://www.tizen.org/tproject">
<platforms>
<platform>
<name>tizen-8.0</name>
</platform>
</platforms>
</tproject>
13 changes: 13 additions & 0 deletions src/engine/meta/html5_tizen/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- TODO: improve ID and PACKAGE -->
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" version="1.0.0" viewmodes="maximized">
<tizen:application id="br.com.zebbo" package="6BIC3y92L2" required_version="8.0"/>
<feature name="http://tizen.org/feature/screen.size.all"/>
<icon src="icon80x80.png"/>
<content src="index.html"/>
<name>{{title}}</name>
<author>{{author}}</author>
<version>{{version}}</version>
<description>{{description}}</description>
<tizen:profile name="tizen"/>
</widget>
4 changes: 2 additions & 2 deletions src/lib/protocol/http_curl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ local http_util = require('src/lib/util/http')

local function http_handler(self)
local index = 1
local cmd = 'curl -L --silent --insecure -w "\n%{http_code}" '
local protocol = self.method == 'HEAD' and '--HEAD' or '-X '..self.method
local cmd = 'curl -L \x2D\x2Dsilent \x2D\x2Dinsecure -w "\n%{http_code}" '
local protocol = self.method == 'HEAD' and '\x2D\x2DHEAD' or '-X '..self.method
local params = http_util.url_search_param(self.param_list, self.param_dict)

local headers, index = ' ', 1
Expand Down
Loading