-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·76 lines (71 loc) · 2.76 KB
/
run.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
#!/bin/sh
# -- change to the platform you are running on (iphone, desktop or web) --
platform="iphone"
# ------------------------------------------------------------------------
IFS="$(echo -e "\n\r")"
projectPath=`dirname $0`
codePath=$projectPath/Resources/main
codeFile=$codePath/main.pde
dataPath=$codePath/data
code=""
code=`cat $codeFile`
cd $codePath
echo "<html>" > main.html
echo "<head>" >> main.html
echo "<meta name=\"viewport\" content=\"width=320; user-scalable=no\" />" >> main.html
echo "<meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\">" >> main.html
echo "<script type=\"text/javascript\" src=\"libraries/Processing/init.js\"></script>" >> main.html
echo "<script type=\"text/javascript\" src=\"libraries/Processing/iprocessing.js\"></script>" >> main.html
echo "</head>" >> main.html
echo "<body style=\"margin:0px;padding:0px;background-color:#000000;-webkit-user-select:none;\">" >> main.html
if [ $platform = "iphone" ] ; then
echo "<div id=\"default\" style=\"margin:0px;padding:0px;height:460px;width:320px;visibility:visible;\">" >> main.html
echo "<img id=\"Default.png\" src=\"Default.png\"/>" >> main.html
echo "</div>" >> main.html
fi
echo "<div id=\"data\" style=\"margin:0px;padding:0px;height:0px;width:0px;visibility:hidden;\">" >> main.html
cd $dataPath
for file in *.jpg
do
#if [ $file != "*.jpg" ] ; then
echo "<img id=\"$file\" src=\"data/$file\"/>" >> $codePath/main.html
#fi
done
for file in *.png
do
if [ $file != "*.png" ] ; then
echo "<img id=\"$file\" src=\"data/$file\"/>" >> $codePath/main.html
fi
done
for file in *.gif
do
if [ $file != "*.gif" ] ; then
echo "<img id=\"$file\" src=\"data/$file\"/>" >> $codePath/main.html
fi
done
for file in *.tga
do
if [ $file != "*.tga" ] ; then
echo "<img id=\"$file\" src=\"data/$file\"/>" >> $codePath/main.html
fi
done
cd $codePath
echo "</div>" >> main.html
echo "<script id=\"platform\">${platform}</script>" >> main.html
echo "<script id=\"code\" type=\"application/processing\">" >> main.html
echo "<!-- ************** PROCOCESSING ***************************************************************************************************************************** -->" >> main.html
echo " " >> main.html
echo " " >> main.html
echo "$code" >> main.html
echo " " >> main.html
echo " " >> main.html
echo "<!-- ************** PROCOCESSING ***************************************************************************************************************************** -->" >> main.html
echo "</script><canvas id=\"canvas\"></canvas>" >> main.html
echo "<div id=\"debug\" style=\"font-family:courier;color:#FFFFFF;\"></div>" >> main.html
echo "</body>" >> main.html
echo "</html>" >> main.html
if [ $platform = "desktop" ] ; then
open main.html
elif [ $platform = "web" ] ; then
open main.html
fi