0

Fancy icons for signposts and spawn, plus info windows for signposts

Thanks to gabrielcrowe for the signpost icon.
This commit is contained in:
Andrew Chin
2010-11-06 22:04:38 -04:00
parent 57a9e8123d
commit 16aca4c093
6 changed files with 51 additions and 8 deletions

View File

@@ -144,6 +144,10 @@ class QuadtreeGen(object):
if not os.path.exists(tileDir): os.mkdir(tileDir)
blank.save(os.path.join(tileDir, "blank."+self.imgformat))
# copy web assets into destdir:
for root, dirs, files in os.walk(os.path.join(util.get_program_path(), "web_assets")):
for f in files:
shutil.copy(os.path.join(root, f), self.destdir)
if skipjs:
return

View File

@@ -2,11 +2,7 @@
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px ; background-color: #000; }
#mcmap { height: 100% }
</style>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="markers.js"></script>
<script type="text/javascript" src="regions.js"></script>
<script type="text/javascript"
@@ -139,6 +135,18 @@
var markersInit = false;
function prepareSignMarker(marker, item) {
var c = "<div class=\"infoWindow\"><img src=\"signpost.png\" /><p>" + item.msg.replace(/\n/g,"<br/>") + "</p></div>";
var infowindow = new google.maps.InfoWindow({
content: c
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
function initMarkers() {
if (markersInit) { return; }
@@ -147,12 +155,25 @@
for (i in markerData) {
var item = markerData[i];
// a default:
var iconURL = '';
if (item.type == 'spawn') { iconURL = 'http://google-maps-icons.googlecode.com/files/home.png';}
if (item.type == 'sign') { iconURL = 'signpost_icon.png';}
var converted = fromWorldToLatLng(item.x, item.y, item.z);
var marker = new google.maps.Marker({
position: converted,
map: map,
title: item.msg
title: item.msg,
icon: iconURL
});
if (item.type == 'sign') {
prepareSignMarker(marker, item);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

BIN
web_assets/signpost.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

18
web_assets/style.css Normal file
View File

@@ -0,0 +1,18 @@
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px ; background-color: #000; }
#mcmap { height: 100% }
.infoWindow {
height: 100px;
}
.infoWindow>img {
width:80px;
float: left;
}
.infoWindow>p {
text-align: center;
font-family: monospace;
}