Skip to content

Commit

Permalink
Rebuilds dist
Browse files Browse the repository at this point in the history
  • Loading branch information
Marak committed Mar 7, 2024
1 parent c150d5e commit 8c8cc2f
Show file tree
Hide file tree
Showing 26 changed files with 1,026 additions and 205 deletions.
53 changes: 53 additions & 0 deletions mantra-client/public/examples/containers/fixed-position.html
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 mantra-client/public/examples/containers/fixed-position.js
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 mantra-client/public/examples/entity/absolute-position.html
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>

39 changes: 39 additions & 0 deletions mantra-client/public/examples/entity/absolute-position.js
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();

});

53 changes: 53 additions & 0 deletions mantra-client/public/examples/entity/fixed-position.html
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>

39 changes: 39 additions & 0 deletions mantra-client/public/examples/entity/fixed-position.js
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();

});

Loading

0 comments on commit 8c8cc2f

Please sign in to comment.