Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Getting started with HTML5
Started by Rob Miracle Mar 20 2018 08:08 AM

- - - - -
170 replies to this topic
[TOPIC CONTROLS]
Page 2 of 7 1 2 3 4 »
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

gianmichele

[GLOBAL: userInfoPane.html]
gianmichele
  • Enthusiast

  • 43 posts
  • Corona SDK

@roaminggamer: all your stuff works really well, even on mobile. Great job guys!!!

 

My game of course doesn't work, there are too many plugins that I need to strip first.



[TOPIC: post.html]
#27

gianmichele

[GLOBAL: userInfoPane.html]
gianmichele
  • Enthusiast

  • 43 posts
  • Corona SDK

Is there any documentation for html5 specific apis or things that are known issues or not implemented yet?



[TOPIC: post.html]
#28

vitaly1

[GLOBAL: userInfoPane.html]
vitaly1
  • Contributor

  • 212 posts
  • Corona SDK

I would appreciate if someone or Corona Team can give us example on the following. Thanks in advance.   :)

To debug an web app which uses network.request() one can to use a CORS plugin, it allows cross-domain requests. But it's not secure and should be used only on localhost. For example, I use local web server and browser with CORS plugin to debug web apps.



[TOPIC: post.html]
#29

vitaly1

[GLOBAL: userInfoPane.html]
vitaly1
  • Contributor

  • 212 posts
  • Corona SDK

Is there any documentation for html5 specific apis or things that are known issues or not implemented yet?

No such doc for now.

By now implemented: all complete core functionalities and the following plugins and features: audio, sqlite3, file system, physics, json, network, sockets, all native display objects



[TOPIC: post.html]
#30

Falcon777

[GLOBAL: userInfoPane.html]
Falcon777
  • Contributor

  • 440 posts
  • Corona SDK

No such doc for now.
By now implemented: all complete core functionalities and the following plugins and features: audio, sqlite3, file system, physics, json, network, sockets, all native display objects


Do you mean network.request is currently supported?

[TOPIC: post.html]
#31

vitaly1

[GLOBAL: userInfoPane.html]
vitaly1
  • Contributor

  • 212 posts
  • Corona SDK

yes, network.request is supported


  • Falcon777 likes this

[TOPIC: post.html]
#32

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,683 posts
  • Enterprise

Lets say you host your game/app at You can only make network.request() calls to http://acme.com. But if your needing an API from https://superhighscores.com/api/sethighscore&score=100 as an HTTP GET call, you would need to write a script at http://acme.com and name it something that makes sense, perhaps sethighscore.php and drop that in the folder with your game (Not required, you can put it anywhere on acme.com).

 

In the PHP script you can use the $_GET[] array to access the parameters passed (score) and reform the URL to superhighscores.com in the PHP script adding the various GET or POST parameters. You can then use something like PHP's curl or other technologies to call superhighscores.com. You would get JSON (or XML) data back, and then simply echo it out of the PHP script to return it to network.request.  You can see some examples of making REST calls with PHP here:

 

https://stackoverflow.com/questions/9802788/call-a-rest-api-in-php

 

Rob


  • Falcon777 likes this

[TOPIC: post.html]
#33

GrahamRanson

[GLOBAL: userInfoPane.html]
GrahamRanson
  • Contributor

  • 131 posts
  • Corona SDK

A small game I made last weekend and with only a couple of tiny changes it works pretty well in HTML5, if anyone is able to give it a play and tell me if it runs for you too that'd be great - http://glitchgames.co.uk/labs/gravitee/live/

 

One small issue currently is it starts slightly too big for the window, if you resize your browser even by a pixel it will fix itself. 


  • ojnab and Develephant like this

[TOPIC: post.html]
#34

cyberparkstudios

[GLOBAL: userInfoPane.html]
cyberparkstudios
  • Contributor

  • 588 posts
  • Corona SDK

Graham,

 

Fun game...  It does the same thing on my Mac, OS Sierra, safari 11.0.3

It starts oversized, then it settles in to correct size if I just stretch the window a hair.  But it does play in my browser.



[TOPIC: post.html]
#35

vitaly1

[GLOBAL: userInfoPane.html]
vitaly1
  • Contributor

  • 212 posts
  • Corona SDK

Normal => select Level #2 => Menu => Select level #2 .. freezes



[TOPIC: post.html]
#36

GrahamRanson

[GLOBAL: userInfoPane.html]
GrahamRanson
  • Contributor

  • 131 posts
  • Corona SDK

Graham,

 

Fun game...  It does the same thing on my Mac, OS Sierra, safari 11.0.3

It starts oversized, then it settles in to correct size if I just stretch the window a hair.  But it does play in my browser.

Thanks for giving it a play! I'm pretty happy with the current state of HTML builds and amazed at how well it runs. It's a little sluggish at times, and not sure if that's down to my game or HTML5 in general.

 

Normal => select Level #2 => Menu => Select level #2 .. freezes

Oops, thanks. Should be fixed now.



[TOPIC: post.html]
#37

kbradford

[GLOBAL: userInfoPane.html]
kbradford
  • Contributor

  • 279 posts
  • Corona SDK

Is there a way to pass variables into the HTML5 build, or for it to read cookies?  For example if we have a user logged into our website, I'd like for our HTML5 Corona app to be able to read the username/id somehow.



[TOPIC: post.html]
#38

vitaly1

[GLOBAL: userInfoPane.html]
vitaly1
  • Contributor

  • 212 posts
  • Corona SDK

Is there a way to pass variables into the HTML5 build, or for it to read cookies?  For example if we have a user logged into our website, I'd like for our HTML5 Corona app to be able to read the username/id somehow.

yes, there are 2 ways:

- using system.getPreferences/setPreferences

- using a simple JS plugin which will get/set cookies; no ready solution for now



[TOPIC: post.html]
#39

kbradford

[GLOBAL: userInfoPane.html]
kbradford
  • Contributor

  • 279 posts
  • Corona SDK

Thanks vitaly, do you have an example of how we can set a preference in HTML or JavaScript that Corona could then read?



[TOPIC: post.html]
#40

vitaly1

[GLOBAL: userInfoPane.html]
vitaly1
  • Contributor

  • 212 posts
  • Corona SDK

Thanks vitaly, do you have an example of how we can set a preference in HTML or JavaScript that Corona could then read?

sure, here many examples in Lua

https://docs.coronalabs.com/api/library/system/setPreferences.html

https://docs.coronalabs.com/api/library/system/getPreference.html

 

soon the HTML5 JavaScript plugin tutorial will be ready



[TOPIC: post.html]
#41

kbradford

[GLOBAL: userInfoPane.html]
kbradford
  • Contributor

  • 279 posts
  • Corona SDK

Sorry, perhaps I'm not being clear.  I understand that's how the Corona app would read the preference, but how is it set before the app opens?  The app needs to know a username, which would need to be set in the HTML or Javascript before Corona is even started.



[TOPIC: post.html]
#42

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,473 posts
  • Corona SDK

Hi,

 

Where should I post possible bugs/issues at for HTML5?

 

-dev



[TOPIC: post.html]
#43

akao

[GLOBAL: userInfoPane.html]
akao
  • Contributor

  • 396 posts
  • Corona SDK

This is super exciting! We are also very interested in the potential application of this to the new instant game platform.



[TOPIC: post.html]
#44

vitaly1

[GLOBAL: userInfoPane.html]
vitaly1
  • Contributor

  • 212 posts
  • Corona SDK

sure, here many examples in Lua

https://docs.coronalabs.com/api/library/system/setPreferences.html

https://docs.coronalabs.com/api/library/system/getPreference.html

 

soon the HTML5 JavaScript plugin tutorial will be ready

 


The only way to achieve this is JS plugin, attached sample of web app with JS native plugin.



[TOPIC: post.html]
#45

vitaly1

[GLOBAL: userInfoPane.html]
vitaly1
  • Contributor

  • 212 posts
  • Corona SDK

Sorry, perhaps I'm not being clear.  I understand that's how the Corona app would read the preference, but how is it set before the app opens?  The app needs to know a username, which would need to be set in the HTML or Javascript before Corona is even started.

attached sample of JS plugin for CoronaAttached File  js_plugin.zip   6.98KB   35 downloads


  • Develephant likes this

[TOPIC: post.html]
#46

kbradford

[GLOBAL: userInfoPane.html]
kbradford
  • Contributor

  • 279 posts
  • Corona SDK

Perfect, thank you vitaly!



[TOPIC: post.html]
#47

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,683 posts
  • Enterprise

@develephant, please post questions and issues in this forum. Perhaps not to this thread :-)

 

Rob



[TOPIC: post.html]
#48

Sayhong's CTO

[GLOBAL: userInfoPane.html]
Sayhong's CTO
  • Observer

  • 29 posts
  • Corona SDK

Will HTML5 support socket?

 

PS: my little game:

http://www.sayhong.net/pinball/


  • roaminggamer likes this

[TOPIC: post.html]
#49

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,683 posts
  • Enterprise

socket.* is supported.


  • roaminggamer likes this

[TOPIC: post.html]
#50

Falcon777

[GLOBAL: userInfoPane.html]
Falcon777
  • Contributor

  • 440 posts
  • Corona SDK

Lets say you host your game/app at You can only make network.request() calls to http://acme.com. But if your needing an API from https://superhighscores.com/api/sethighscore&score=100 as an HTTP GET call, you would need to write a script at http://acme.com and name it something that makes sense, perhaps sethighscore.php and drop that in the folder with your game (Not required, you can put it anywhere on acme.com).

 

In the PHP script you can use the $_GET[] array to access the parameters passed (score) and reform the URL to superhighscores.com in the PHP script adding the various GET or POST parameters. You can then use something like PHP's curl or other technologies to call superhighscores.com. You would get JSON (or XML) data back, and then simply echo it out of the PHP script to return it to network.request.  You can see some examples of making REST calls with PHP here:

 

https://stackoverflow.com/questions/9802788/call-a-rest-api-in-php

 

Rob

 

Thank you for the detailed explanation!




[topic_controls]
Page 2 of 7 1 2 3 4 »
 
[/topic_controls]