]> Pileus Git - ~andy/ct/blob - knot/html.ct
40fbe44c88be7bad8d379559aed257b6a633caad
[~andy/ct] / knot / html.ct
1 <% #include "knot.h" %>
2
3 <% static void print_img(int ptrn) { %>
4         <% if (ptrn) { %>
5         <img src="img/<% if (ptrn & LEFT ) printf("l"); %>
6                       <% if (ptrn & RIGHT) printf("r"); %>
7                       <% if (ptrn & UP   ) printf("u"); %>
8                       <% if (ptrn & DOWN ) printf("d"); %>.png">
9         <% } %>
10 <% } %>
11
12 <% void print_index(tile_t **tiles) { %>
13 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
14   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
15 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
16         <title>Knot</title>
17         <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
18         <head>
19                 <style type="text/css">
20                         *   { border:0; margin:0; padding:0; }
21                         table { border-collapse:separate; margin:auto; width:1800px;}
22                         td  { width:64px; height:64px; border-spacing:0px 0px;}
23                         img { position:absolute; }
24                 </style>
25         </head>
26         <body>
27         <table cellpadding="0" cellspacing="0">
28                 <% for (int row = 1; row < 10; row++) { %>
29                 <tr>
30                         <% for (int col = 1; col < 30; col++) { %>
31                         <td>
32                         <% print_img(tiles[row][col].bot); %>
33                         <% print_img(tiles[row][col].top); %>
34                         </td>
35                         <% } %>
36                 </tr>
37                 <% } %>
38                 </table>
39         </body>
40 </html>
41 <% } %>