File tree 5 files changed +583
-11
lines changed
5 files changed +583
-11
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ let () =
62
62
add_executable " spritesheet" [ " spritesheet.png" ];
63
63
add_executable " draw" [ " colors.png" ];
64
64
add_executable " window_with_textbox" [] ;
65
+ add_executable " suncities" [] ;
65
66
66
67
add_executable " demo1" [] ;
67
68
add_executable " demo2" [] ;
Original file line number Diff line number Diff line change 175
175
(libraries ocaml - canvas react ))
176
176
177
177
178
+ (executable
179
+ (name suncities )
180
+ (public_name ocaml - canvas - suncities )
181
+ (modes byte_complete native js )
182
+ (modules suncities )
183
+ (libraries ocaml - canvas react ))
184
+
185
+
178
186
(executable
179
187
(name demo1 )
180
188
(public_name ocaml - canvas - demo1 )
Original file line number Diff line number Diff line change 1
1
2
2
let gen_sample_index file =
3
- let tl = open_in " sample_template.html" in
4
- let out = open_out (file ^ " .html" ) in
5
- try
6
- while true do
7
- let l = input_line tl in
8
- let l' = Str. global_replace (Str. regexp_string " %%FILE%%" ) file l in
9
- Printf. fprintf out " %s\n " l'
10
- done ;
11
- with End_of_file ->
12
- close_in tl;
13
- close_out out
3
+ let filename = file ^ " .html" in
4
+ if Sys. file_exists filename then () else
5
+ let tl = open_in " sample_template.html" in
6
+ let out = open_out filename in
7
+ try
8
+ while true do
9
+ let l = input_line tl in
10
+ let l' = Str. global_replace (Str. regexp_string " %%FILE%%" ) file l in
11
+ Printf. fprintf out " %s\n " l'
12
+ done ;
13
+ with End_of_file ->
14
+ close_in tl;
15
+ close_out out
14
16
15
17
let gen_global_index file files =
16
18
let tl = open_in " global_template.html" in
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="utf-8 ">
5
+ < meta name ="viewport " content ="width=device-width,initial-scale=1.0 ">
6
+ < title > Sun Empire</ title >
7
+ < style >
8
+ canvas {image-rendering : auto;}
9
+ </ style >
10
+ </ head >
11
+ < body >
12
+ < noscript > Sorry, you need to enable JavaScript to see this page.</ noscript >
13
+ < script type ="text/javascript " defer ="defer " src ="suncities.bc.js "> </ script >
14
+ < div style ="float:left ">
15
+ < h1 > Cities under the Sun</ h1 >
16
+ </ div >
17
+ < div style ="float:left ">
18
+ < ul >
19
+ < li > < b > Space</ b > to change city</ li >
20
+ < li > < b > Left-click</ b > drag to move viewpoint</ li >
21
+ < li > < b > Right-click</ b > drag to change daytime</ li >
22
+ </ ul >
23
+ </ div >
24
+ < div id ="can "> </ div >
25
+ </ body >
26
+ </ html >
You can’t perform that action at this time.
0 commit comments