Skip to content

Commit

Permalink
feat(nui): convert MapScreen and WaypointCreationScreen to NUI
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminAmos committed Nov 1, 2022
1 parent 0dc412d commit ccb2cbf
Show file tree
Hide file tree
Showing 14 changed files with 771 additions and 366 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void drawFactionNames(SolGame game, UiDrawer uiDrawer, SolInputManager in
isPressed = !isPressed;
}
// angle must be zero as the camera angles on planets mess up the text display
if (isPressed && camera.getAngle() == 0 && !inputManager.isScreenOn(game.getScreens().mapScreen)) {
if (isPressed && camera.getAngle() == 0 && !game.getSolApplication().getNuiManager().hasScreen(game.getScreens().mapScreen)) {
for (SolObject obj : objManager.getObjects()) {
if (obj instanceof SolShip) {
SolShip ship = (SolShip) obj;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.destinationsol.ui.nui.screens.MenuScreen;
import org.destinationsol.ui.nui.screens.TalkScreen;
import org.destinationsol.ui.nui.screens.InventoryScreen;
import org.destinationsol.ui.nui.screens.MapScreen;
import org.destinationsol.ui.nui.screens.WaypointCreationScreen;

import javax.inject.Inject;

Expand All @@ -45,14 +47,15 @@ public GameScreens(SolApplication cmp, Context context) {
boolean isMobile = cmp.isMobile();
if (!isMobile) {
mainGameScreen = (org.destinationsol.ui.nui.screens.MainGameScreen) cmp.getNuiManager().createScreen(NUI_MAIN_GAME_SCREEN_DESKTOP_URI);
mapScreen = (MapScreen) cmp.getNuiManager().createScreen("engine:mapScreen_desktop");
} else {
mainGameScreen = (org.destinationsol.ui.nui.screens.MainGameScreen) cmp.getNuiManager().createScreen(NUI_MAIN_GAME_SCREEN_MOBILE_URI);
mapScreen = (MapScreen) cmp.getNuiManager().createScreen("engine:mapScreen_mobile");
}
mapScreen = new MapScreen(rightPaneLayout, cmp.isMobile(), cmp.getOptions());
menuScreen = (MenuScreen) cmp.getNuiManager().createScreen("engine:menuScreen");
inventoryScreen = (InventoryScreen) cmp.getNuiManager().createScreen("engine:inventoryScreen");
talkScreen = (TalkScreen) cmp.getNuiManager().createScreen("engine:talkScreen");
waypointCreationScreen = new WaypointCreationScreen(layouts.menuLayout, cmp.getOptions(), mapScreen);
waypointCreationScreen = (WaypointCreationScreen) cmp.getNuiManager().createScreen("engine:waypointCreationScreen");
consoleScreen = new ConsoleScreen(context.get(Console.class));
}

Expand Down
226 changes: 0 additions & 226 deletions engine/src/main/java/org/destinationsol/game/screens/MapScreen.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void update(SolApplication solApplication, boolean enabled) {
game.getCam().screenToWorld(myMouseWorldPos);
SolInputManager im = solApplication.getInputManager();
boolean clicked = im.getPtrs()[0].pressed;
boolean onMap = im.isScreenOn(game.getScreens().mapScreen);
boolean onMap = solApplication.getNuiManager().hasScreen(game.getScreens().mapScreen);
BeaconHandler.Action a = game.getBeaconHandler().processMouse(game, myMouseWorldPos, clicked, onMap);
if (a == BeaconHandler.Action.ATTACK) {
myCursor = myAttackCursor;
Expand Down

This file was deleted.

Loading

0 comments on commit ccb2cbf

Please sign in to comment.