Windows only part

merge-requests/28/head
Nemirtingas 2019-08-31 20:49:07 +02:00
parent 495bc957cd
commit 0573c4eb94
1 changed files with 15 additions and 8 deletions

View File

@ -120,12 +120,13 @@ bool Steam_Overlay::ShowOverlay() const
void Steam_Overlay::ShowOverlay(bool state) void Steam_Overlay::ShowOverlay(bool state)
{ {
if (!Ready() || show_overlay == state)
return;
#ifdef STEAM_WIN32
static RECT old_clip; static RECT old_clip;
static BOOL show_cursor = FALSE; static BOOL show_cursor = FALSE;
if (!Ready() || show_overlay == state)
return;
if (state) if (state)
{ {
HWND game_hwnd = Windows_Hook::Inst()->GetGameHwnd(); HWND game_hwnd = Windows_Hook::Inst()->GetGameHwnd();
@ -173,8 +174,12 @@ void Steam_Overlay::ShowOverlay(bool state)
if (!show_cursor) if (!show_cursor)
while (ShowCursor(FALSE) >= 0); while (ShowCursor(FALSE) >= 0);
} }
#else
#endif
show_overlay = state; show_overlay = state;
overlay_state_changed = true; overlay_state_changed = true;
} }
@ -260,7 +265,7 @@ bool Steam_Overlay::IHaveLobby()
Steam_Friends* steamFriends = get_steam_client()->steam_friends; Steam_Friends* steamFriends = get_steam_client()->steam_friends;
if (std::string(steamFriends->GetFriendRichPresence(settings->get_local_steam_id(), "connect")).length() > 0) if (std::string(steamFriends->GetFriendRichPresence(settings->get_local_steam_id(), "connect")).length() > 0)
return true; return true;
if (settings->get_lobby().IsValid()) if (settings->get_lobby().IsValid())
return true; return true;
@ -312,7 +317,9 @@ void Steam_Overlay::BuildFriendWindow(Friend const& frd, friend_window_state& st
{ {
if (state.window_state & window_state_need_attention && ImGui::IsWindowFocused()) if (state.window_state & window_state_need_attention && ImGui::IsWindowFocused())
{ {
#ifdef STEAM_WIN32
PlaySound((LPCSTR)notif_invite_wav, NULL, SND_ASYNC | SND_MEMORY); PlaySound((LPCSTR)notif_invite_wav, NULL, SND_ASYNC | SND_MEMORY);
#endif
state.window_state &= ~window_state_need_attention; state.window_state &= ~window_state_need_attention;
} }
@ -335,7 +342,7 @@ void Steam_Overlay::BuildFriendWindow(Friend const& frd, friend_window_state& st
ImGui::PushItemWidth(-1.0f); // Make the chat history widget fill the window 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. // 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) // It should be like this: chat input should fill the window size minus send button size (button size is fixed)
// |------------------------------| // |------------------------------|
@ -432,7 +439,7 @@ void Steam_Overlay::OverlayProc( int width, int height )
if (!friends.empty()) if (!friends.empty())
{ {
ImGui::ListBoxHeader("##label", friend_size); ImGui::ListBoxHeader("##label", friend_size);
std::for_each(friends.begin(), friends.end(), [this](auto& i) std::for_each(friends.begin(), friends.end(), [this](std::pair<Friend const, friend_window_state> &i)
{ {
ImGui::PushID(i.first.id()); ImGui::PushID(i.first.id());
@ -578,4 +585,4 @@ void Steam_Overlay::RunCallbacks()
} }
} }
#endif #endif