Referring to the HTML, and CSS Tutorials:
here:
http://developer.playcanvas.com/en/user-manual/assets/html/
and HERE:
http://developer.playcanvas.com/en/user-manual/assets/css/
I am just getting familiar with displaying HTML elements in playcanvas. I’m guessing Guessing the HTML just overlay’s in the front of the webGL stuff?
here is what I am trying:
- I create a script called game.js and attach it to the root in scene ( I plan on just having game.js as my main game manager )
game.js:
//START
pc.script.create('game', function (app) {
// Creates a new Game instance
var Game = function (entity) {
this.entity = entity;
};
//get Asset by ID CSS style.css
// no idea if i need ',", or none of these quote things for below? it is asset id of front.html which is below in next file
var assetHTML = app.assets.get('3851951');
Game.prototype = {
// Called once after all resources are loaded and before the first update
initialize: function () {
// make sure HTML asset loads
app.assets.load(assetHTML);
},
// Called every frame, dt is time in seconds since last update
update: function (dt) {
}
};
return Game;
});
//END game.js
Then the html stuff (skipping css for now):
//begin front.html
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<div id="form-main">
<div id="form-div">
<form class="form" id="form1">
<p class="name">
<input name="name" type="text" class="blah3" placeholder="Name" id="name" />
</p>
<p class="email">
<input name="email" type="text" class="blah2" id="email" placeholder="Email" />
</p>
<p class="text">
<textarea name="text" class="blah" id="comment" placeholder="Comment"></textarea>
</p>
<div class="submit">
<input type="submit" value="SEND" id="button-blue"/>
<div class="ease"></div>
</div>
</form>
</div>
</body>
</html>
//end front.html
Also how can I display needed stuff with the fontrenderer.js, I can log with it and display it now but not sure how it ties in with .css and so forth.
Thanks in advance!
-SubV