Update move buttons to old compass graphic

This commit is contained in:
Sky Johnson 2024-12-13 12:40:13 -06:00
parent 67cacf7882
commit 2b53868f52
9 changed files with 70 additions and 20 deletions

View File

@ -117,3 +117,49 @@ a:hover {
background-color: #eeeeee;
font: 10px verdana;
}
.move-compass {
width: 128px;
height: 128px;
display: flex;
flex-direction: column;
background-image: url('/img/compass.webp');
margin: 0.5rem auto;
}
.move-compass div.mid {
display: flex;
}
.move-compass button {
background-color: transparent;
border: none;
color: transparent; /* Hide the text */
background-size: cover; /* Ensure the background image fills the button */
cursor: pointer;
}
.move-compass button:hover {
background-color: rgba(225, 16, 16, 0.5);
}
.move-compass button.north {
width: 128px;
height: 40px;
}
.move-compass button.west {
width: 63px;
height: 50px;
}
.move-compass button.east {
width: 63px;
height: 50px;
}
.move-compass button.south {
width: 128px;
height: 38px;
}

BIN
public/img/compass.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -10,10 +10,17 @@ function move()
$latitude = $userrow["latitude"];
$longitude = $userrow["longitude"];
if (isset($_POST["north"])) { $latitude++; if ($latitude > $controlrow["gamesize"]) { $latitude = $controlrow["gamesize"]; } }
if (isset($_POST["south"])) { $latitude--; if ($latitude < ($controlrow["gamesize"]*-1)) { $latitude = ($controlrow["gamesize"]*-1); } }
if (isset($_POST["east"])) { $longitude++; if ($longitude > $controlrow["gamesize"]) { $longitude = $controlrow["gamesize"]; } }
if (isset($_POST["west"])) { $longitude--; if ($longitude < ($controlrow["gamesize"]*-1)) { $longitude = ($controlrow["gamesize"]*-1); } }
$form = validate($_POST, [
'direction' => ['in:north,west,east,south']
]);
if (!$form['valid']) display(ul_from_validate_errors($form['errors']), 'Move Error');
$d = $form['data']['direction'];
if ($d === 'north') { $latitude++; if ($latitude > $controlrow["gamesize"]) { $latitude = $controlrow["gamesize"]; } }
if ($d === 'south') { $latitude--; if ($latitude < ($controlrow["gamesize"]*-1)) { $latitude = ($controlrow["gamesize"]*-1); } }
if ($d === 'east') { $longitude++; if ($longitude > $controlrow["gamesize"]) { $longitude = $controlrow["gamesize"]; } }
if ($d === 'west') { $longitude--; if ($longitude < ($controlrow["gamesize"]*-1)) { $longitude = ($controlrow["gamesize"]*-1); } }
$town = get_town_by_xy($longitude, $latitude);
if ($town !== false) {

View File

@ -2,8 +2,8 @@
require_once __DIR__ . '/database.php';
define('VERSION', '1.1.11');
define('BUILD', '');
define('VERSION', '1.2.3');
define('BUILD', 'Reawaken');
define('START', microtime(true));
/**

View File

@ -1,23 +1,20 @@
<?php
$template = <<<HTML
<table width="100%">
<tr><td class="title"><img src="/img/button_location.gif" alt="Location" title="Location" /></td></tr>
<tr><td>
<section>
<div class="title"><img src="/img/button_location.gif" alt="Location" title="Location"></div>
Currently: {{currentaction}}<br>
Latitude: {{latitude}}<br>
Longitude: {{longitude}}<br>
<a href="javascript:openmappopup()">View Map</a><br><br>
<form action="/move" method="post">
<center>
<input name="north" type="submit" value="North" /><br>
<input name="west" type="submit" value="West" /><input name="east" type="submit" value="East" /><br>
<input name="south" type="submit" value="South" />
</center>
<a href="javascript:openmappopup()">View Map</a><br>
<form action="/move" method="post" class="move-compass">
<button type="submit" name="direction" value="north" class="north">North</button>
<div class="mid">
<button type="submit" name="direction" value="west" class="west">West</button>
<button type="submit" name="direction" value="east" class="east">East</button>
</div>
<button type="submit" name="direction" value="south" class="south">South</button>
</form>
</td></tr>
</table>
<br>
</section>
<table width="100%">
<tr><td class="title"><img src="/img/button_towns.gif" alt="Towns" title="Towns" /></td></tr>