Skip to content

Commit

Permalink
Map button on login screen, fix map settings init (#191)
Browse files Browse the repository at this point in the history
* Map button on login screen, fix map settings init

* Don't show on creation/recovery screens
  • Loading branch information
conker-rsc authored Dec 24, 2023
1 parent 1d9c8d9 commit ec9b0a6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 6 deletions.
Binary file added assets/map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/map_inactive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions src/Client/WorldMapWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public CameraPoint(float x, float y) {
private static Image pointImage;
private static Image waypointImage;
private static int planeIndex;
public static boolean renderChunkGrid;
public static boolean renderChunkLabelling;
private static boolean showLegend;
public static boolean showLabels;
public static boolean showScenery;
public static boolean showIcons;
public static boolean showOtherFloors;
public static boolean showOtherFloors = true;
public static boolean showIcons = true;
public static boolean showScenery = true;
public static boolean showLabels = true;
public static boolean renderChunkGrid = false;
public static boolean renderChunkLabelling = false;
private static boolean followPlayer;
private static String searchText;
private static int searchNumber;
Expand Down
34 changes: 34 additions & 0 deletions src/Game/Renderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public class Renderer {
public static Image image_cursor;
public static Image image_gear;
public static Image image_gear_gold;
public static Image image_map_inactive;
public static Image image_map;
public static Image image_wiki_hbar_inactive_system;
public static Image image_wiki_hbar_active_system;
public static Image image_wiki_hbar_inactive_jf;
Expand Down Expand Up @@ -254,6 +256,8 @@ public static void init() {
image_cursor = ImageIO.read(Launcher.getResource("/assets/cursor.png"));
image_gear = ImageIO.read(Launcher.getResource("/assets/gear.png"));
image_gear_gold = ImageIO.read(Launcher.getResource("/assets/gear_gold.png"));
image_map_inactive = ImageIO.read(Launcher.getResource("/assets/map_inactive.png"));
image_map = ImageIO.read(Launcher.getResource("/assets/map.png"));
SpecialStar.initializeSpecialStars();
image_small_skull = ImageIO.read(Launcher.getResource("/assets/small_skull.png"));
} catch (Exception e) {
Expand Down Expand Up @@ -1605,6 +1609,36 @@ public static void present(Image image) {
Launcher.getConfigWindow().toggleConfigWindow();
}

// Draw map icon
if (Client.login_screen == Client.SCREEN_CLICK_TO_LOGIN
|| Client.login_screen == Client.SCREEN_USERNAME_PASSWORD_LOGIN) {
int mapX = width - 10 - image_map_inactive.getWidth(null);
int mapY = 45;

Rectangle mapBounds =
new Rectangle(
mapX, mapY, image_map_inactive.getWidth(null), image_map_inactive.getHeight(null));

// Draw coloured version on hover, de-saturated otherwise
if (MouseHandler.x >= mapBounds.x
&& MouseHandler.x <= mapBounds.x + mapBounds.width
&& MouseHandler.y >= mapBounds.y
&& MouseHandler.y <= mapBounds.y + mapBounds.height) {
g2.drawImage(image_map, mapX, mapY, null);
} else {
g2.drawImage(image_map_inactive, mapX, mapY, null);
}

// Handle map icon click
if (bufferedMouseClick.getX() >= mapBounds.x
&& bufferedMouseClick.getX() <= mapBounds.x + mapBounds.width
&& bufferedMouseClick.getY() >= mapBounds.y
&& bufferedMouseClick.getY() <= mapBounds.y + mapBounds.height
&& bufferedMouseClick.isMouseClicked()) {
Launcher.getWorldMapWindow().toggleWorldMapWindow();
}
}

// Draw world list
drawShadowText(g2, "World (Click to change): ", 80, height - 8, color_text, true, false);
for (int i = 1; i <= Settings.WORLDS_TO_DISPLAY; i++) {
Expand Down

0 comments on commit ec9b0a6

Please sign in to comment.