iwmlib/lib/pixi/application.html

37 lines
928 B
HTML

<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PIXI.Application Doctest</title>
<script src="../../dist/iwmlib.3rdparty.js"></script>
<script src="../../dist/iwmlib.js"></script>
<script src="../../dist/iwmlib.pixi.js"></script>
</head>
<body>
<h1>PIXI.Application with nothing!</h1>
<script>
const app = new PIXI.Application({
width: 450,
height: 150
})
// Add the view to the DOM
document.body.appendChild(app.view)
// ex, add display objects
const sprite = PIXI.Sprite.fromImage('./assets/app-circle.png')
sprite.scale.set(.3, .3)
app.stage.addChild(sprite)
sprite.interactive = true
sprite.buttonMode = true
sprite.on('click', e => {
console.log('sprite clicked')
})
</script>
</body>