I’ve create a new project using the Mobile game from template and made it some little changes:
1 - Added DefOS lib as a dependency to game.project
2.- Added the below lines to game.project(text) in order to setup the game’s window:
[defos]
view_width = 550
view_height = 973
view_x = 1000
view_y = 10
3. Changes to main.script:
function init(self)
msg.post(".", "acquire_input_focus")
local sW = sys.get_config_int("display.width")
local sH = sys.get_config_int("display.height")
local sW2, sH2 = window.get_size()
go.set_position( vmath.vector3(sW*0.5,sH*0.5,0) )
go.set_position( vmath.vector3(sW,sH,0), "go1" )
go.set_position( vmath.vector3(sW*0.5,sH*0.5,0), "go2" )
end
function on_input(self, action_id, action)
if action_id == hash("touch") and action.pressed then
print("Touch!")
end
end
Then I tested it in my android device using the mobile development app.
Visually the result is ok, but in the console of Defold I got some errors after a few seconds:
INFO:ENGINE: Defold Engine 1.8.0 (9141d9d)
INFO:DLIB: Initialized Remotery (ws://127.0.0.1:17815/rmt)
INFO:ENGINE: Loading data from: http://192.168.100.3:11804/build
INFO:ENGINE: Initialised sound device ‘default’
DEBUG:SCRIPT: Running in Defold simulator (editor)
DEBUG:SCRIPT: Running on a real device or release build
DEBUG:SCRIPT: Touch!
ERROR:DLIB: …/src/dlib/socket_posix.cpp( 102 ): SOCKET: Unknown result code 19
WARNING:DLIB: Failed to send announce message (-1000)
ERROR:DLIB: …/src/dlib/socket_posix.cpp( 102 ): SOCKET: Unknown result code 19
WARNING:DLIB: Failed to send announce message (-1000)