-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathguide.html
142 lines (116 loc) · 6.56 KB
/
guide.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html>
<html>
<head>
<title>Korok Engine - Quick Start</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="static/css/app.css">
</head>
<body>
<div class="container">
<div class="d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom box-shadow">
<h5 class="my-0 mr-md-auto font-weight-normal">Korok.io</h5>
<nav class="my-2 my-md-0 mr-md-3">
<a class="p-2 text-dark" href="index.html">Home</a>
<a class="p-2 text-dark" href="guide.html">Guide</a>
<a class="p-2 text-dark" href="help.html">Help!</a>
<a class="p-2 text-dark" href="https://github.com/KorokEngine/Korok">Github</a>
</nav>
</div>
<div class="row">
<div class="col-sm-2 bd-sidebar">
<nav>
<h5>Overview</h5>
<ul class="nav flex-column">
<li class="active bd-sidenav-active"><a href="guide.html">Quick Start</a></li>
<li><a href="docs/basic.html">Basics</a></li>
</ul>
<h5 style="margin-top:30px;">Tutorial</h5>
<div class="sidebar-sticky">
<ul class="nav flex-column">
<li><a href="docs/sprite.html">Sprite</a></li>
<li><a href="docs/font.html">Font</a></li>
<li><a href="docs/audio.html">Audio</a></li>
<li><a href="docs/todo.html">Input</a></li>
<li><a href="docs/anim.html">Animation</a></li>
</ul>
</div>
<h5 style="margin-top:30px;">Revision</h5>
</nav>
</div>
<div class="col-sm-1"></div>
<div class="col">
<h1 class="bd-title">Quick Start </h1>
<div class="alert alert-secondary" role="alert">
<p>This guide assumes intermediate level knowledge of Golang. If you are totally
new to golang. These are some useful links:
<ul>
<li><a href="https://tour.golang.org/">A Tour of Go</a></li>
<li><a href="https://gobyexample.com/">Go by Example</a></li>
<li><a href="http://openmymind.net/The-Little-Go-Book/">The Little Go Book</a></li>
</ul>
</p>
</div>
<h2>Installation </h2>
<p>1. Install Go:</p>
<p class="bd-lead">Install the latest version of Go from <a class="alert-link" href="https://golang.org/">here</a>. </p>
<p>Note: Korok requires at least Go version 1.8 (for best Cgo performance).</p>
<p>2. Install korok:</p>
<div class="card" style="width: 300px;">
<code class="language-go card-body">
$ go get korok.io/korok
</code>
</div>
<p style="margin-top:10px;">Note: Dependencies is installed automatically when you use <code>go get</code> command, these are: <br>
<ul>
<li><a href="https://github.com/go-gl/gl">go-gl</a></li>
<li><a href="https://github.com/go-gl/glfw">glfw</a></li>
<li><a href="https://github.com/golang/freetype">freetype</a></li>
<li><a href="https://godoc.org/golang.org/x/image">golang/x/image</a></li>
<li><a href="https://godoc.org/golang.org/x/mobile">golang/x/mobile</a></li>
</ul>
</p>
<p style="margin-top:10px;"> If you can't install it successfully, read this <a href="https://github.com/KorokEngine/Korok/wiki/installation">wiki</a>. </p>
<h2>Hello World</h2>
<p>1. Create a file: <code>main.go</code></p>
<p>2. Copy the following code:</p>
<div class="bg-light"><pre>
<code class="language-js" data-lang="js">
package main
import (
"korok.io/korok"
"korok.io/korok/game"
"korok.io/korok/gfx/dbg"
)
type MainScene struct {
}
func (m *MainScene) OnEnter(g *game.Game) {
}
func (m *MainScene) Update(dt float32) {
dbg.DrawStr(180, 160, "Hello World")
}
func (*MainScene) OnExit() {
}
func main() {
// Run game
options := &korok.Options{
Title: "Hello, Korok Engine",
Width: 480,
Height:320,
}
korok.Run(options, &MainScene{})
}
</code>
</pre></div>
<p>3. Run the code with <code>go run main.go</code>, your first Korok app works!</p>
<img src="static/img/hello.jpeg" style="width:500px;">
<p style="margin-bottom:30px; margin-top:20px"> <span style="color:red">♥</span> <strong></strong> Learn more from the <a class="alert-link" href="https://github.com/KorokEngine/beta-demo">Demo Project</a>. </p>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>