mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 20:38:07 +01:00
Modified a bit overlay and added comments
This commit is contained in:
parent
2c74abd6ab
commit
3eeca9b50e
1 changed files with 59 additions and 45 deletions
|
@ -339,10 +339,30 @@ void Steam_Overlay::BuildFriendWindow(Friend const& frd, friend_window_state& st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PushItemWidth(-1.0f);
|
ImGui::PushItemWidth(-1.0f); // Make the chat history widget fill the window
|
||||||
ImGui::ColoredInputTextMultiline("##chat_history", &state.chat_history[0], state.chat_history.length(), { -1.0f, 0 }, ImGuiInputTextFlags_ReadOnly);
|
ImGui::ColoredInputTextMultiline("##chat_history", &state.chat_history[0], state.chat_history.length(), { -1.0f, 0 }, ImGuiInputTextFlags_ReadOnly);
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
|
// TODO: Fix the layout of the chat line + send button.
|
||||||
|
// It should be like this: chat input should fill the window size minus send button size (button size is fixed)
|
||||||
|
// |------------------------------|
|
||||||
|
// | /--------------------------\ |
|
||||||
|
// | | | |
|
||||||
|
// | | chat history | |
|
||||||
|
// | | | |
|
||||||
|
// | \--------------------------/ |
|
||||||
|
// | [____chat line______] [send] |
|
||||||
|
// |------------------------------|
|
||||||
|
//
|
||||||
|
// And it is like this
|
||||||
|
// |------------------------------|
|
||||||
|
// | /--------------------------\ |
|
||||||
|
// | | | |
|
||||||
|
// | | chat history | |
|
||||||
|
// | | | |
|
||||||
|
// | \--------------------------/ |
|
||||||
|
// | [__chat line__] [send] |
|
||||||
|
// |------------------------------|
|
||||||
if (ImGui::InputText("##chat_line", state.chat_input, max_chat_len, ImGuiInputTextFlags_EnterReturnsTrue))
|
if (ImGui::InputText("##chat_line", state.chat_input, max_chat_len, ImGuiInputTextFlags_EnterReturnsTrue))
|
||||||
{
|
{
|
||||||
send_chat_msg = true;
|
send_chat_msg = true;
|
||||||
|
@ -371,13 +391,13 @@ void Steam_Overlay::BuildFriendWindow(Friend const& frd, friend_window_state& st
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to make this function as short as possible or it might affect game's fps.
|
||||||
void Steam_Overlay::OverlayProc( int width, int height )
|
void Steam_Overlay::OverlayProc( int width, int height )
|
||||||
{
|
{
|
||||||
if (!show_overlay)
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
|
if (show_overlay)
|
||||||
|
{
|
||||||
int friend_size = friends.size();
|
int friend_size = friends.size();
|
||||||
|
|
||||||
// Set the overlay windows to the size of the game window
|
// Set the overlay windows to the size of the game window
|
||||||
|
@ -387,7 +407,7 @@ void Steam_Overlay::OverlayProc( int width, int height )
|
||||||
|
|
||||||
ImGui::SetNextWindowBgAlpha(0.50);
|
ImGui::SetNextWindowBgAlpha(0.50);
|
||||||
ImGuiStyle& style = ImGui::GetStyle();
|
ImGuiStyle& style = ImGui::GetStyle();
|
||||||
style.WindowRounding = 0.0;
|
style.WindowRounding = 0.0; // Disable round window
|
||||||
|
|
||||||
if (ImGui::Begin("SteamOverlay", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus))
|
if (ImGui::Begin("SteamOverlay", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus))
|
||||||
{
|
{
|
||||||
|
@ -416,16 +436,10 @@ void Steam_Overlay::OverlayProc( int width, int height )
|
||||||
BuildFriendWindow(i.first, i.second);
|
BuildFriendWindow(i.first, i.second);
|
||||||
});
|
});
|
||||||
ImGui::ListBoxFooter();
|
ImGui::ListBoxFooter();
|
||||||
|
|
||||||
//RECT rect;
|
|
||||||
//GetWindowRect(game_hwnd, &rect);
|
|
||||||
//auto pos = ImGui::GetMousePos();
|
|
||||||
//ImGui::LabelText("", "Window pos: %dx%d %dx%d", rect.left, rect.top, rect.right, rect.bottom);
|
|
||||||
//ImGui::LabelText("", "Mouse pos: %dx%d", (int)pos.x, (int)pos.y);
|
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
}// if(show_overlay)
|
||||||
|
|
||||||
//ImGui::ShowDemoWindow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Overlay::Callback(Common_Message *msg)
|
void Steam_Overlay::Callback(Common_Message *msg)
|
||||||
|
@ -439,7 +453,7 @@ void Steam_Overlay::Callback(Common_Message *msg)
|
||||||
{
|
{
|
||||||
Steam_Messages const& steam_message = msg->steam_messages();
|
Steam_Messages const& steam_message = msg->steam_messages();
|
||||||
// Change color to cyan for friend
|
// Change color to cyan for friend
|
||||||
friend_info->second.chat_history.append("\x1", 1).append("00FFFFFF", 8).append(steam_message.message()).append("\n", 1);
|
friend_info->second.chat_history.append("\x1""00FFFFFF", 9).append(steam_message.message()).append("\n", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,7 +499,7 @@ void Steam_Overlay::RunCallbacks()
|
||||||
msg.set_dest_id(friend_id);
|
msg.set_dest_id(friend_id);
|
||||||
network->sendTo(&msg, true);
|
network->sendTo(&msg, true);
|
||||||
|
|
||||||
friend_info->second.chat_history.append("\x1", 1).append("00FF00FF", 8).append(input).append("\n", 1);
|
friend_info->second.chat_history.append("\x1""00FF00FF", 9).append(input).append("\n", 1);
|
||||||
}
|
}
|
||||||
*input = 0; // Reset the input field
|
*input = 0; // Reset the input field
|
||||||
friend_info->second.window_state &= ~window_state_send_message;
|
friend_info->second.window_state &= ~window_state_send_message;
|
||||||
|
|
Loading…
Reference in a new issue