Hi,
Yesterday, I took a look at PhoneGap to port a HTML5 game on Android and Windows Phone.
Shortly after, I wondered if Purebasic can build a game coded in HTML5 & Javascript.
So I'm developping a wrapper for MelonJS framework.
I chose MelonJS engine because :
- it supports a cross-platform Tile Editor
- it supports tween FX, collision, parallax scrolling
- it supports MP3 & OGG
- free & open source
I encountered some difficulties:
- create a local web server coded in PB (lack of examples but for the moment I use EasyPHP as web server)
- using a web debugger (CHROME debugger for my test)
- There's no cross-platform audio format (the launcher will need to convert audio files into MP3 and OGG)
How it works:
1- PB compile and run a web launcher
2- The launcher generate the HTML/JS code based MelonJS code template
3- PB start a local web server
4- PB open the HTML page in localhost mode
Below the first test code:
Purebasic - HTML5 game engine
Purebasic - HTML5 game engine
Last edited by eddy on Sun Feb 17, 2013 8:56 pm, edited 5 times in total.

Re: Purebasic - HTML5 game engine
Code: Select all
; ***********************
; HTML5 GAME TEMPLATE
; ***********************
XIncludeFile "MelonJS.pbi"
DisableExplicit
If InitWebApplication()
LevelBackground0=PreloadWebResource(#PB_Any,"area01_parallax/area01_bkg0.png","area01_bkg0")
LevelBackground1=PreloadWebResource(#PB_Any,"area01_parallax/area01_bkg1.png","area01_bkg1")
LevelTiles=PreloadWebResource(#PB_Any,"area01_tileset/area01_level_tiles.png","area01_level_tiles")
LevelMap=PreloadWebResource(#PB_Any,"area01.tmx","area01")
If OpenWebPage("Purebasic Game - HTML5 & MelonJS",RGB(169, 195, 249))
If OpenWebScreen(640,480)
BuildWebApplication()
EndIf
EndIf
EndIf


Re: Purebasic - HTML5 game engine
Sounds interesting! Looking forward to further informations. 
Greetings ... Kiffi

Greetings ... Kiffi
Hygge
Re: Purebasic - HTML5 game engine
I'll share the include file in Trick'n tips later. (or github)
It's interesting challenge
but it's really big.
It's interesting challenge


- zxtunes.com
- Enthusiast
- Posts: 375
- Joined: Wed Apr 23, 2008 7:51 am
- Location: Saint-Petersburg, Russia
- Contact:
Re: Purebasic - HTML5 game engine
html5 slows and eats your battery!
Perhaps the situation will improve when it is implemented in hardware acceleration Canvas.

Perhaps the situation will improve when it is implemented in hardware acceleration Canvas.
Re: Purebasic - HTML5 game engine
It's true.
Only recent browsers support GPU acceleration.
Only recent browsers support GPU acceleration.

-
- 666
- Posts: 1033
- Joined: Mon Sep 01, 2003 2:33 pm
Re: Purebasic - HTML5 game engine
must admit, this is looking interesting Eddy 
