Skip to content

Commit 2ddf71b

Browse files
committed
this shi broken T_T
1 parent 6902b06 commit 2ddf71b

File tree

9 files changed

+35
-22
lines changed

9 files changed

+35
-22
lines changed

Index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<!DOCTYPE HTML>
22
<html>
3+
<meta property="og:title" content="Bones 'N Souls" />
4+
<meta property="og:description" content="A book off fairy-tales come to life." />
5+
<meta property="og:type" content="website" />
36
<title>
47
Bones 'N Souls
58
</title>

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Bones 'N Souls
22
```
3-
A fantacy world conjured up by a fairytail book
3+
A fantacy world conjured up by a fairytale book.
4+
45
```

Res/Game.wasm

5.14 KB
Binary file not shown.

Source/Environment.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ type Environment struct {
88
}
99

1010
func (E Environment) NewEnvironment() {
11-
E.DATA["CANNON"] = new(Webpage).GetGlobal("CANNON")
11+
var WEBPAGE = new(Webpage)
12+
E.DATA = make(map[string]js.Value, 2)
13+
E.DATA["CANNON"] = WEBPAGE.GetGlobal("CANNON")
1214
E.DATA["WORLD"] = E.DATA["CANNON"].Get("World").New()
1315
}
1416

Source/Input.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,22 @@ type Input struct {
77
}
88

99
func (I Input) KeyDown(this js.Value, KEY []js.Value) interface{} {
10-
I.EVENTS[KEY[0].Get("key").String()] = true
10+
if KEY[0].Length() > 0 {
11+
I.EVENTS[KEY[0].Get("key").String()] = true
12+
}
1113
return nil
1214
}
1315

1416
func (I Input) KeyUp(this js.Value, KEY []js.Value) interface{} {
15-
I.EVENTS[KEY[0].Get("key").String()] = false
17+
if KEY[0].Length() > 0 {
18+
I.EVENTS[KEY[0].Get("key").String()] = false
19+
}
1620
return nil
1721
}
1822

1923
func (I Input) RegisterKeyboard() {
20-
W := new(Webpage)
21-
D := W.GetGlobal("window")
22-
D.Call("addEventListener", "keydown", js.FuncOf(I.KeyDown))
23-
D.Call("addEventListener", "keyup", js.FuncOf(I.KeyUp))
24+
var DOCUMENT = new(Webpage).GetGlobal("window")
25+
DOCUMENT.Call("addEventListener", "keydown", js.FuncOf(I.KeyDown))
26+
DOCUMENT.Call("addEventListener", "keyup", js.FuncOf(I.KeyUp))
2427
}
2528

Source/Main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@ package main
22

33
func main() {
44
var INPUT = new(Input)
5-
var WEBPAGE = new(Webpage)
5+
var WEBPAGE = new(Webpage)
6+
var ENVIRONMENT = new(Environment)
7+
var RENDERER = new(Renderer)
68
var CONSOLE = WEBPAGE.GetGlobal("console")
79
CONSOLE.Call("log", `"Bones 'N Souls" has been loaded.`)
10+
var FOV int = 75
811
INPUT.RegisterKeyboard()
12+
ENVIRONMENT.NewEnvironment()
13+
RENDERER.NewRenderer()
14+
RENDERER.NewCamera(0, FOV)
915
go func() {
1016
for {
11-
EVENTS := INPUT.EVENTS
12-
if EVENTS["w"] {CONSOLE.Call("log", "w")}
17+
1318
}
1419
}()
1520
select {}

Source/Object.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@ import (
33
"syscall/js"
44
)
55

6-
var LIMIT int = 3200
7-
var OBJECT_STORAGE = make([]interface{}, LIMIT)
8-
96
type Object struct {
107
ID int
11-
COLLIDER js.Value
12-
STYLE js.Value
13-
DATA map[string]bool
14-
}
15-
16-
func (O Object) NewObject() *Object {
17-
return new(Object)
8+
OBJECT map[string]js.Value
9+
ROTATiON [3]float64
10+
POSITION [3]float64
11+
VELOCITY [3]float64
1812
}
19-
2013

Source/Renderer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ func (R Renderer) NewCamera(INDEX int, FOV int) {
2222
R.CAMERA[INDEX] = R.DATA["THREE"].Get("PerspectiveCamera").New(FOV, WIDTH / HEIGHT, 0.1, 1000)
2323
}
2424

25+
func (R Renderer) Init() {
26+
27+
}
2528

index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<!DOCTYPE HTML>
22
<html>
3+
<meta property="og:title" content="Bones 'N Souls" />
4+
<meta property="og:description" content="A book off fairy-tales come to life." />
5+
<meta property="og:type" content="website" />
36
<title>
47
Bones 'N Souls
58
</title>

0 commit comments

Comments
 (0)