-
Notifications
You must be signed in to change notification settings - Fork 99
/
build.sh
executable file
·171 lines (134 loc) · 3.42 KB
/
build.sh
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!/bin/bash
# 1. build 'pacman.js' by concatenating files specified in js_order
# 2. update time stamp in index.html
# 3. build debug.html with individual script includes
OUTPUT="pacman.js"
PUBLIC_DIR="./public"
debug_includes="\n"
# write header
echo "
// Copyright 2012 Shaun Williams
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// ==========================================================================
// PAC-MAN
// an accurate remake of the original arcade game
// Based on original works by Namco, GCC, and Midway.
// Research by Jamey Pittman and Bart Grantham
// Developed by Shaun Williams, Mason Borda
// ==========================================================================
(function(){
" > $OUTPUT
for file in \
inherit.js \
sound.js \
random.js \
game.js \
direction.js \
Map.js \
colors.js \
mapgen.js \
atlas.js \
renderers.js \
hud.js \
galagaStars.js \
Button.js \
Menu.js \
inGameMenu.js \
sprites.js \
Actor.js \
Ghost.js \
Player.js \
actors.js \
targets.js \
ghostCommander.js \
ghostReleaser.js \
elroyTimer.js \
energizer.js \
fruit.js \
executive.js \
states.js \
input.js \
cutscenes.js \
maps.js \
vcr.js \
main.js
do
# points firebug to correct file (or so I hoped)
# if JSOPTION_ATLINE is set, this should work in firefox (but I don't know how to set it)
echo "//@line 1 \"src/$file\"" >> $OUTPUT
# concatenate file to output
cat src/$file >> $OUTPUT
# add this file to debug includes
debug_includes="$debug_includes<script src=\"src/$file\"></script>\n"
done
# end anonymous function wrapper
echo "})();" >> $OUTPUT
# update time stamp
sed -i '.bak' "s/last updated:[^<]*/last updated: $(date) -->/" index.html
# build debug.html from index.html adding debug includes
sed "s:.*$output.*:$debug_includes:" index.html > debug.html
# reset the public folder
if [ -d "$PUBLIC_DIR" ]; then rm -Rf $PUBLIC_DIR; fi
mkdir public
# copy index.html to public
cp index.html ./public/index.html
# copy pacman.js to public
cp pacman.js ./public/pacman.js
# copy fonts to public
cp -rf ./font ./public/
# copy sounds to public
cp -rf sounds ./public/
# copy icons to public
cp -rf icon ./public/
# create the pages folder
rm -rf pages
mkdir pages
touch pages/index.js
# populate index.js
echo "import React from 'react'
import Head from 'next/head'
const Index = () => (
<>
<Head>
<title>Pacman</title>
</Head>
<style jsx global>{\`
html,
body,
#__next {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
\`}</style>
<iframe
src='/index.html'
width='100%'
height='100%'
frameBorder='0'
/>
</>
)
export default Index" > pages/index.js
# setup the styles folder
rm -rf styles
mkdir styles
touch styles/globals.css
# populate the css file
echo "html,
body,
#__next {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}" > styles/global.css