mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-14 00:23:50 +00:00
Break the monolithic 1360-line world_map.cpp into 16 focused modules under src/rendering/world_map/: Architecture: - world_map_facade: public API composing all components (PIMPL) - world_map_types: Vulkan-free domain types (Zone, ViewLevel, etc.) - data_repository: DBC zone loading, ZMP pixel map, POI/overlay storage - coordinate_projection: UV projection, zone/continent lookups - composite_renderer: Vulkan tile pipeline + off-screen compositing - exploration_state: server mask + local exploration tracking - view_state_machine: COSMIC→WORLD→CONTINENT→ZONE navigation - input_handler: keyboard/mouse input → InputAction mapping - overlay_renderer: layer-based ImGui overlay system (OCP) - map_resolver: cross-map navigation (Outland, Northrend, etc.) - zone_metadata: level ranges and faction data Overlay layers (each an IOverlayLayer): - player_marker, party_dot, taxi_node, poi_marker, quest_poi, corpse_marker, zone_highlight, coordinate_display, subzone_tooltip Fixes: - Player marker no longer bleeds across continents (only shown when player is in a zone belonging to the displayed continent) - Zone hover uses DBC-projected AABB rectangles (restored from original working behavior) - Exploration overlay rendering for zone view subzones Tests: - 6 new test files covering coordinate projection, exploration state, map resolver, view state machine, zone metadata, and integration Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
57 lines
1.6 KiB
C++
57 lines
1.6 KiB
C++
// input_handler.cpp — Input processing for the world map.
|
|
// Extracted from WorldMap::render (Phase 9 of refactoring plan).
|
|
#include "rendering/world_map/input_handler.hpp"
|
|
#include "core/input.hpp"
|
|
#include <imgui.h>
|
|
#include <cmath>
|
|
|
|
namespace wowee {
|
|
namespace rendering {
|
|
namespace world_map {
|
|
|
|
InputResult InputHandler::process(ViewLevel currentLevel,
|
|
int hoveredZoneIdx,
|
|
bool cosmicEnabled) {
|
|
InputResult result;
|
|
auto& input = core::Input::getInstance();
|
|
|
|
// ESC closes the map
|
|
if (input.isKeyJustPressed(SDL_SCANCODE_ESCAPE)) {
|
|
result.action = InputAction::CLOSE;
|
|
return result;
|
|
}
|
|
|
|
// Scroll wheel zoom
|
|
auto& io = ImGui::GetIO();
|
|
float wheelDelta = io.MouseWheel;
|
|
if (std::abs(wheelDelta) < 0.001f)
|
|
wheelDelta = input.getMouseWheelDelta();
|
|
|
|
if (wheelDelta > 0.0f) {
|
|
result.action = InputAction::ZOOM_IN;
|
|
return result;
|
|
} else if (wheelDelta < 0.0f) {
|
|
result.action = InputAction::ZOOM_OUT;
|
|
return result;
|
|
}
|
|
|
|
// Continent view: left-click on hovered zone (from previous frame)
|
|
if (currentLevel == ViewLevel::CONTINENT && hoveredZoneIdx >= 0 &&
|
|
input.isMouseButtonJustPressed(1)) {
|
|
result.action = InputAction::CLICK_ZONE;
|
|
result.targetIdx = hoveredZoneIdx;
|
|
return result;
|
|
}
|
|
|
|
// Right-click to go back (zone → continent; continent → world)
|
|
if (io.MouseClicked[1]) {
|
|
result.action = InputAction::RIGHT_CLICK_BACK;
|
|
return result;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
} // namespace world_map
|
|
} // namespace rendering
|
|
} // namespace wowee
|