Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
d181625b
Commit
d181625b
authored
Sep 24, 2010
by
Nigel Tao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exp/spacewar: fix build.
R=rsc CC=golang-dev
https://golang.org/cl/2265042
parent
44b3b205
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
src/pkg/exp/spacewar/spacewar.go
src/pkg/exp/spacewar/spacewar.go
+13
-7
No files found.
src/pkg/exp/spacewar/spacewar.go
View file @
d181625b
...
...
@@ -47,10 +47,11 @@ func main() {
log
.
Exitf
(
"av.Init: %s"
,
err
)
}
go
quitter
(
w
.
QuitChan
())
kc
:=
make
(
chan
int
)
go
demuxEvents
(
w
,
kc
)
var
m
SpacewarPDP1
m
.
Init
(
w
)
m
.
Init
(
w
,
kc
)
m
.
PC
=
4
f
:=
bytes
.
NewBuffer
([]
byte
(
spacewarCode
))
if
err
=
m
.
Load
(
f
);
err
!=
nil
{
...
...
@@ -65,8 +66,13 @@ func main() {
log
.
Exitf
(
"step: %s"
,
err
)
}
func
quitter
(
c
<-
chan
bool
)
{
<-
c
func
demuxEvents
(
w
draw
.
Window
,
kc
chan
int
)
{
for
event
:=
range
w
.
EventChan
()
{
switch
e
:=
event
.
(
type
)
{
case
draw
.
KeyEvent
:
kc
<-
e
.
Key
}
}
os
.
Exit
(
0
)
}
...
...
@@ -78,7 +84,7 @@ type SpacewarPDP1 struct {
pdp1
.
M
nframe
int
frameTime
int64
ctxt
draw
.
Context
ctxt
draw
.
Window
dx
,
dy
int
screen
draw
.
Image
ctl
pdp1
.
Word
...
...
@@ -95,9 +101,9 @@ func min(a, b int) int {
return
b
}
func
(
m
*
SpacewarPDP1
)
Init
(
ctxt
draw
.
Contex
t
)
{
func
(
m
*
SpacewarPDP1
)
Init
(
ctxt
draw
.
Window
,
kc
chan
in
t
)
{
m
.
ctxt
=
ctxt
m
.
kc
=
ctxt
.
KeyboardChan
()
m
.
kc
=
kc
m
.
screen
=
ctxt
.
Screen
()
m
.
dx
=
m
.
screen
.
Bounds
()
.
Dx
()
m
.
dy
=
m
.
screen
.
Bounds
()
.
Dy
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment