-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,026 additions
and
205 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
mantra-client/public/examples/containers/fixed-position.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
<html> | ||
<link href="../prism.css" rel="stylesheet" /> | ||
<script src="../code-editor.js"></script> | ||
<style> | ||
body { | ||
overflow: auto; | ||
} | ||
/* This will force the scrollbar to be always visible */ | ||
::-webkit-scrollbar { | ||
-webkit-appearance: none; | ||
width: 7px; | ||
} | ||
|
||
::-webkit-scrollbar-thumb { | ||
border-radius: 4px; | ||
background-color: rgba(0,0,0,.5); | ||
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5); | ||
} | ||
|
||
iframe { | ||
min-height: 600px; | ||
min-width: 800px; | ||
width: 100%; | ||
height: 50%; | ||
border: 1px solid #000; | ||
margin-top: 20px; | ||
} | ||
</style> | ||
<script> | ||
document.addEventListener('DOMContentLoaded', () => { | ||
// rebroadcast the message to the parent window | ||
window.addEventListener('message', event => { | ||
// log the data | ||
//let context = event.data.context; | ||
//window.parent.postMessage({ type: 'pointerDown', context: context }, '*'); | ||
}); | ||
|
||
// on click | ||
window.addEventListener('click', event => { | ||
// log the data | ||
//console.log(event); | ||
//let context = { x: event.clientX, y: event.clientY }; | ||
//window.parent.postMessage({ type: 'pointerDown', context: context }, '*'); | ||
}); | ||
|
||
loadEditor('./fixed-position.js'); | ||
}); | ||
</script> | ||
<iframe src="../demo.html?source=containers/fixed-position"></iframe> | ||
<script src="../prism.min.js"></script> | ||
</html> | ||
|
30 changes: 30 additions & 0 deletions
30
mantra-client/public/examples/containers/fixed-position.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
let game = new MANTRA.Game({ | ||
graphics: ['css'], // array enum, 'babylon', 'phaser', 'css', 'three', | ||
}); | ||
game.start(); | ||
|
||
|
||
|
||
game.make().Button().text('Mantra').position(0, 40).style({ | ||
position: 'absolute' | ||
}) | ||
.pointerdown(function(){ | ||
alert('hi') | ||
window.location.href = 'https://yantra.gg/mantra'; | ||
}) | ||
.createEntity(); | ||
|
||
game.make().Button().text('Entities').position(130, 40).style({ | ||
position: 'absolute' | ||
}).createEntity(); | ||
|
||
|
||
game.make().Button().text('Rules').position(260, 40).style({ | ||
position: 'absolute' | ||
}).createEntity(); | ||
|
||
|
||
game.make().Button().text('Events').position(390, 40).style({ | ||
position: 'absolute' | ||
}).createEntity(); |
53 changes: 53 additions & 0 deletions
53
mantra-client/public/examples/entity/absolute-position.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
<html> | ||
<link href="../prism.css" rel="stylesheet" /> | ||
<script src="../code-editor.js"></script> | ||
<style> | ||
body { | ||
overflow: auto; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
/* This will force the scrollbar to be always visible */ | ||
::-webkit-scrollbar { | ||
-webkit-appearance: none; | ||
width: 7px; | ||
} | ||
|
||
::-webkit-scrollbar-thumb { | ||
border-radius: 4px; | ||
background-color: rgba(0,0,0,.5); | ||
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5); | ||
} | ||
|
||
iframe { | ||
width: 100%; | ||
height: 50%; | ||
border: 1px solid #000; | ||
margin-top: 20px; | ||
} | ||
</style> | ||
<script> | ||
document.addEventListener('DOMContentLoaded', () => { | ||
// rebroadcast the message to the parent window | ||
window.addEventListener('message', event => { | ||
// log the data | ||
//let context = event.data.context; | ||
//window.parent.postMessage({ type: 'pointerDown', context: context }, '*'); | ||
}); | ||
|
||
// on click | ||
window.addEventListener('click', event => { | ||
// log the data | ||
//console.log(event); | ||
//let context = { x: event.clientX, y: event.clientY }; | ||
//window.parent.postMessage({ type: 'pointerDown', context: context }, '*'); | ||
}); | ||
|
||
loadEditor('./absolute-position.js'); | ||
}); | ||
</script> | ||
<iframe src="../demo.html?source=entity/absolute-position"></iframe> | ||
<script src="../prism.min.js"></script> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
let game = new MANTRA.Game({ | ||
graphics: ['css'], // array enum, 'babylon', 'css', 'three', | ||
plugins: [ | ||
'Button', | ||
'Player', | ||
'Hexapod', | ||
'Block' | ||
], | ||
camera: 'follow' | ||
}); | ||
game.start(function(){ | ||
|
||
game.make().Player().createEntity(); | ||
game.make().Hexapod().repeat(11).x(-200).createEntity(); | ||
|
||
game.make().Block().size(16).offset(-32, 32).repeat(10).createEntity(); | ||
|
||
game.make().Button().text('Coordindates').position(0, 0).offset(0, 0).origin('bottom-right').style({ | ||
position: 'absolute' | ||
}) | ||
.createEntity(); | ||
|
||
game.make().Button().text('Screen').position(0, 0).offset(-150).origin('bottom-left').style({ | ||
position: 'absolute' | ||
}).createEntity(); | ||
|
||
|
||
game.make().Button().text('Position').position(0, 0).offset(0, -150).origin('bottom-right').style({ | ||
position: 'absolute' | ||
}).createEntity(); | ||
|
||
|
||
game.make().Button().text('Absolute').position(0, 0).offset(-150, -150).origin('bottom-left').style({ | ||
position: 'absolute' | ||
}).createEntity(); | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
<html> | ||
<link href="../prism.css" rel="stylesheet" /> | ||
<script src="../code-editor.js"></script> | ||
<style> | ||
body { | ||
overflow: auto; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
/* This will force the scrollbar to be always visible */ | ||
::-webkit-scrollbar { | ||
-webkit-appearance: none; | ||
width: 7px; | ||
} | ||
|
||
::-webkit-scrollbar-thumb { | ||
border-radius: 4px; | ||
background-color: rgba(0,0,0,.5); | ||
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5); | ||
} | ||
|
||
iframe { | ||
width: 100%; | ||
height: 50%; | ||
border: 1px solid #000; | ||
margin-top: 20px; | ||
} | ||
</style> | ||
<script> | ||
document.addEventListener('DOMContentLoaded', () => { | ||
// rebroadcast the message to the parent window | ||
window.addEventListener('message', event => { | ||
// log the data | ||
//let context = event.data.context; | ||
//window.parent.postMessage({ type: 'pointerDown', context: context }, '*'); | ||
}); | ||
|
||
// on click | ||
window.addEventListener('click', event => { | ||
// log the data | ||
//console.log(event); | ||
//let context = { x: event.clientX, y: event.clientY }; | ||
//window.parent.postMessage({ type: 'pointerDown', context: context }, '*'); | ||
}); | ||
|
||
loadEditor('./fixed-position.js'); | ||
}); | ||
</script> | ||
<iframe src="../demo.html?source=entity/fixed-position"></iframe> | ||
<script src="../prism.min.js"></script> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
let game = new MANTRA.Game({ | ||
graphics: ['css'], // array enum, 'babylon', 'phaser', 'css', 'three', | ||
plugins: [ | ||
'Button', | ||
'Player' | ||
], | ||
camera: 'follow', | ||
gameRoot: 'http://192.168.1.80:7777' | ||
}); | ||
game.start(function(){ | ||
|
||
game.make().Player().createEntity(); | ||
|
||
game.make().Button().text('Mantra').position(0, 40).style({ | ||
position: 'absolute' | ||
}) | ||
.pointerdown(function(){ | ||
alert('hi') | ||
window.location.href = 'https://yantra.gg/mantra'; | ||
}) | ||
.createEntity(); | ||
|
||
game.make().Button().text('Entities').position(130, 40).style({ | ||
position: 'absolute' | ||
}).createEntity(); | ||
|
||
|
||
game.make().Button().text('Rules').position(260, 40).style({ | ||
position: 'absolute' | ||
}).createEntity(); | ||
|
||
|
||
game.make().Button().text('Events').position(390, 40).style({ | ||
position: 'absolute' | ||
}).createEntity(); | ||
|
||
}); | ||
|
Oops, something went wrong.