-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/support pause #44
Changes from all commits
975313b
f9a8561
f2a5c44
d07861f
3acd063
5434c03
85510c0
6389294
cc4c885
6a868f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,16 @@ | |
text-align: center; | ||
font-family: "Monaco", "Andale Mono", "Lucida Console", "FreeMono", monospace; | ||
} | ||
.badge { | ||
color: #fff; | ||
background-color: #000; | ||
display: inline-block; | ||
padding: .25em .3em; | ||
line-height: 1; | ||
border-radius: .25rem; | ||
font-weight: 700; | ||
text-decoration: none; | ||
} | ||
#gotherworld { | ||
width: 960px; | ||
height: 600px; | ||
|
@@ -32,6 +42,29 @@ | |
<h1> | ||
<img src="logo.png" alt="Gother World"> | ||
</h1> | ||
<p> | ||
<a class="badge" href="#" onclick="shutdown()">STOP</a> | ||
<a class="badge" href="#" onclick="handleKeyEvent('l', 76, 'keydown'); setTimeout(() => handleKeyEvent('l', 76, 'keyup'), 50);">LOAD</a> | ||
<a class="badge" href="#" onclick="handleKeyEvent('s', 83, 'keydown'); setTimeout(() => handleKeyEvent('s', 83, 'keyup'), 50);">SAVE</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor magic numbers used for the timeout There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah should be fixed with #45 as well |
||
|
||
// Game Part | ||
<a class="badge" href="?gamePart=0">0</a> | ||
<a class="badge" href="?gamePart=1">1</a> | ||
<a class="badge" href="?gamePart=2">2</a> | ||
<a class="badge" href="?gamePart=3">3</a> | ||
<a class="badge" href="?gamePart=4">4</a> | ||
<a class="badge" href="?gamePart=5">5</a> | ||
<a class="badge" href="?gamePart=6">6</a> | ||
<a class="badge" href="?gamePart=7">7</a> | ||
|
||
// LOG | ||
<a class="badge" href="#" onclick="setLogLevel(0)">DEBUG</a> | ||
<a class="badge" href="#" onclick="setLogLevel(1)">INFO</a> | ||
<a class="badge" href="#" onclick="setLogLevel(2)">WARN</a> | ||
<a class="badge" href="#" onclick="setLogLevel(3)">ERROR</a> | ||
<a class="badge" href="#" onclick="setLogLevel(4)">FATAL</a> | ||
|
||
</p> | ||
<p> | ||
<canvas id="gotherworld" width="320" height="200"/> | ||
</p> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"syscall/js" | ||
|
||
"github.com/neophob/ganother-world/anotherworld" | ||
|
@@ -20,26 +19,10 @@ func GetCanvas(domElementId string) Canvas { | |
} | ||
} | ||
|
||
func (c Canvas) SetColor(color anotherworld.Color) { | ||
c.context2d.Set("fillStyle", fmt.Sprintf("rgb(%d, %d, %d)", color.R, color.G, color.B)) | ||
} | ||
|
||
func (c Canvas) DrawPoint(x, y int) { | ||
c.context2d.Call("fillRect", x, y, 1, 1) | ||
} | ||
|
||
func (c Canvas) fillStyle(style string) { | ||
c.context2d.Set("fillStyle", style) | ||
} | ||
|
||
func (c Canvas) fillRect(x, y, width, height int) { | ||
c.context2d.Call("fillRect", x, y, width, height) | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. red diff is a good diff! |
||
func (c Canvas) blitIt(buffer [anotherworld.WIDTH * anotherworld.HEIGHT]int) { | ||
var interfaceSlice []interface{} = make([]interface{}, len(buffer)) | ||
for i, d := range buffer { | ||
interfaceSlice[i] = d | ||
for index, pixelData := range buffer { | ||
interfaceSlice[index] = pixelData | ||
} | ||
c.context2d.Call("blit", interfaceSlice) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
less spam