mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
doc: Add example 2048
This commit is contained in:
parent
1f28c687cf
commit
addde5ee6d
19
_docs/gen.go
19
_docs/gen.go
@ -141,10 +141,15 @@ func (e *example) Height() int {
|
|||||||
return e.ThumbHeight * 2
|
return e.ThumbHeight * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
const commentForBlocks = `// Please read examples/blocks/main.go and examples/blocks/blocks/*.go
|
|
||||||
// NOTE: If Gamepad API is available in your browswer, you can use gamepads. Try it out!`
|
|
||||||
|
|
||||||
func (e *example) Source() string {
|
func (e *example) Source() string {
|
||||||
|
const (
|
||||||
|
commentFor2048 = `// Please read examples/2048/main.go and examples/2048/2048/*.go`
|
||||||
|
commentForBlocks = `// Please read examples/blocks/main.go and examples/blocks/blocks/*.go
|
||||||
|
// NOTE: If Gamepad API is available in your browswer, you can use gamepads. Try it out!`
|
||||||
|
)
|
||||||
|
if e.Name == "2048" {
|
||||||
|
return commentFor2048
|
||||||
|
}
|
||||||
if e.Name == "blocks" {
|
if e.Name == "blocks" {
|
||||||
return commentForBlocks
|
return commentForBlocks
|
||||||
}
|
}
|
||||||
@ -181,6 +186,7 @@ var examples = []example{
|
|||||||
{"piano", 320, 240},
|
{"piano", 320, 240},
|
||||||
{"rotate", 320, 240},
|
{"rotate", 320, 240},
|
||||||
{"sprites", 320, 240},
|
{"sprites", 320, 240},
|
||||||
|
{"2048", 210, 300},
|
||||||
{"blocks", 256, 240},
|
{"blocks", 256, 240},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,12 +330,9 @@ func outputExample(e *example) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Do not call temporarily.
|
if err := clear(); err != nil {
|
||||||
// TODO: Uncomment this out after 1.4 stable is released.
|
|
||||||
// docs/examples/_resource/images/arcade.png should also be remove.
|
|
||||||
/*if err := clear(); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}*/
|
}
|
||||||
if err := outputMain(); err != nil {
|
if err := outputMain(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
29
docs/examples/2048.content.html
Normal file
29
docs/examples/2048.content.html
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
window.addEventListener('load', function() {
|
||||||
|
function isProduction() {
|
||||||
|
var l = window.top.location;
|
||||||
|
if (l.hash === '#_production') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (l.hostname === 'localhost' || l.hostname === '127.0.0.1') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var s = document.createElement('script');
|
||||||
|
var src = '2048.js';
|
||||||
|
if (isProduction()) {
|
||||||
|
src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src;
|
||||||
|
}
|
||||||
|
s.src = src;
|
||||||
|
s.onload = function() {
|
||||||
|
var notice = document.getElementById('notice');
|
||||||
|
notice.parentNode.removeChild(notice);
|
||||||
|
};
|
||||||
|
document.body.appendChild(s);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<p id="notice" style="color: white;">Now Loading...</p>
|
39
docs/examples/2048.html
Normal file
39
docs/examples/2048.html
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<script src="../scripts/force-https.js"></script>
|
||||||
|
<link rel="shortcut icon" href="../favicon.png" type="image/png" >
|
||||||
|
<link rel="icon" href="../favicon.png" type="image/png" >
|
||||||
|
<title>Ebiten example - 2048</title>
|
||||||
|
<link rel="stylesheet" href="../stylesheets/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="../stylesheets/highlight-github.css">
|
||||||
|
<link rel="stylesheet" href="../stylesheets/ebiten.css">
|
||||||
|
<script src="../scripts/googleanalytics.js"></script>
|
||||||
|
|
||||||
|
<header class="navbar"><div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<a class="navbar-brand" href="..">Ebiten</a>
|
||||||
|
</div>
|
||||||
|
<nav class="collapse navbar-collapse">
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li><a href="https://github.com/hajimehoshi/ebiten">GitHub</a></li>
|
||||||
|
<li><a href="https://godoc.org/github.com/hajimehoshi/ebiten">GoDoc</a></li>
|
||||||
|
<li><a href="https://github.com/hajimehoshi/ebiten/wiki">Wiki</a>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main><div class="container">
|
||||||
|
|
||||||
|
<h2>Ebiten example - 2048</h2>
|
||||||
|
<iframe src="2048.content.html" width="420" height="600"></iframe>
|
||||||
|
<pre><code class="language-go">// Please read examples/2048/main.go and examples/2048/2048/*.go</code></pre>
|
||||||
|
|
||||||
|
</div></main>
|
||||||
|
|
||||||
|
<footer><div class="container">
|
||||||
|
<p>© 2013 Hajime Hoshi</p>
|
||||||
|
<p>Code is licensed under <a href="https://github.com/hajimehoshi/ebiten/blob/master/LICENSE">the Apache License 2.0</a>.</p>
|
||||||
|
<p>The content of this page is licensed under <a href="https://creativecommons.org/licenses/by/4.0/">the Creative Commons Attribution 4.0 License</a>.</p>
|
||||||
|
</div></footer>
|
||||||
|
|
||||||
|
<script src="../scripts/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
@ -17,6 +17,14 @@ http://mart.kitunebi.com/music_act.html
|
|||||||
Harpie's Feather (ハルピュイアの羽) by Napi
|
Harpie's Feather (ハルピュイアの羽) by Napi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## game2.mp3
|
||||||
|
|
||||||
|
```
|
||||||
|
http://mart.kitunebi.com/music_act.html
|
||||||
|
|
||||||
|
ノアの羽舟 by Napi
|
||||||
|
```
|
||||||
|
|
||||||
## ragtime.ogg
|
## ragtime.ogg
|
||||||
|
|
||||||
```
|
```
|
||||||
|
BIN
docs/images/examples/2048.png
Normal file
BIN
docs/images/examples/2048.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -90,6 +90,8 @@
|
|||||||
<a class="thumbnail" scrolling="no" href="examples/rotate.html"><img src="images/examples/rotate.png" width="320" height="240" alt="Ebiten example: rotate" class="example"></a>
|
<a class="thumbnail" scrolling="no" href="examples/rotate.html"><img src="images/examples/rotate.png" width="320" height="240" alt="Ebiten example: rotate" class="example"></a>
|
||||||
</div><div class="col-md-3">
|
</div><div class="col-md-3">
|
||||||
<a class="thumbnail" scrolling="no" href="examples/sprites.html"><img src="images/examples/sprites.png" width="320" height="240" alt="Ebiten example: sprites" class="example"></a>
|
<a class="thumbnail" scrolling="no" href="examples/sprites.html"><img src="images/examples/sprites.png" width="320" height="240" alt="Ebiten example: sprites" class="example"></a>
|
||||||
|
</div><div class="col-md-3">
|
||||||
|
<a class="thumbnail" scrolling="no" href="examples/2048.html"><img src="images/examples/2048.png" width="210" height="300" alt="Ebiten example: 2048" class="example"></a>
|
||||||
</div><div class="col-md-3">
|
</div><div class="col-md-3">
|
||||||
<a class="thumbnail" scrolling="no" href="examples/blocks.html"><img src="images/examples/blocks.png" width="256" height="240" alt="Ebiten example: blocks" class="example"></a>
|
<a class="thumbnail" scrolling="no" href="examples/blocks.html"><img src="images/examples/blocks.png" width="256" height="240" alt="Ebiten example: blocks" class="example"></a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user