mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add right-click context menu to focus frame
Shows Target, Clear Focus, and player-only actions (Whisper, Invite, Trade) when right-clicking the focus name.
This commit is contained in:
parent
d3221ff253
commit
109b0a984a
1 changed files with 32 additions and 1 deletions
|
|
@ -2882,7 +2882,38 @@ void GameScreen::renderFocusFrame(game::GameHandler& gameHandler) {
|
|||
ImGui::SameLine();
|
||||
|
||||
std::string focusName = getEntityName(focus);
|
||||
ImGui::TextColored(focusColor, "%s", focusName.c_str());
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, focusColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0,0,0,0));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(1,1,1,0.08f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(1,1,1,0.12f));
|
||||
ImGui::Selectable(focusName.c_str(), false, ImGuiSelectableFlags_DontClosePopups,
|
||||
ImVec2(ImGui::CalcTextSize(focusName.c_str()).x, 0));
|
||||
ImGui::PopStyleColor(4);
|
||||
|
||||
if (ImGui::BeginPopupContextItem("##FocusNameCtx")) {
|
||||
const bool focusIsPlayer = (focus->getType() == game::ObjectType::PLAYER);
|
||||
const uint64_t fGuid = focus->getGuid();
|
||||
ImGui::TextDisabled("%s", focusName.c_str());
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("Target"))
|
||||
gameHandler.setTarget(fGuid);
|
||||
if (ImGui::MenuItem("Clear Focus"))
|
||||
gameHandler.clearFocus();
|
||||
if (focusIsPlayer) {
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("Whisper")) {
|
||||
selectedChatType = 4;
|
||||
strncpy(whisperTargetBuffer, focusName.c_str(), sizeof(whisperTargetBuffer) - 1);
|
||||
whisperTargetBuffer[sizeof(whisperTargetBuffer) - 1] = '\0';
|
||||
refocusChatInput = true;
|
||||
}
|
||||
if (ImGui::MenuItem("Invite to Group"))
|
||||
gameHandler.inviteToGroup(focusName);
|
||||
if (ImGui::MenuItem("Trade"))
|
||||
gameHandler.initiateTrade(fGuid);
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if (focus->getType() == game::ObjectType::UNIT ||
|
||||
focus->getType() == game::ObjectType::PLAYER) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue