Skip to content

Commit

Permalink
Improve console
Browse files Browse the repository at this point in the history
  • Loading branch information
Reputeless committed Dec 23, 2024
1 parent 20816bf commit fb51576
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# include <cstdio>
# include <iostream>
# include <Siv3D/Common.hpp>
# include <Siv3D/Windows/MinWindows.hpp>
# include <Siv3D/Windows/Windows.hpp>
# include "CConsole.hpp"
# include <Siv3D/EngineLog.hpp>
# include <Siv3D/Error.hpp>
Expand Down Expand Up @@ -126,6 +126,27 @@ namespace s3d
}
}

////////////////////////////////////////////////////////////////
//
// clearSelection
//
////////////////////////////////////////////////////////////////

void CConsole::clearSelection()
{
if (not m_isOpen)
{
return;
}

if (HWND hConsoleWindow = ::GetConsoleWindow())
{
// ESC キーを送信
::SendMessage(hConsoleWindow, WM_KEYDOWN, VK_ESCAPE, 0);
::SendMessage(hConsoleWindow, WM_KEYUP, VK_ESCAPE, 0);
}
}

////////////////////////////////////////////////////////////////
//
// close
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ namespace s3d

bool attach() override;

void clearSelection() override;

void close() override;

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# include <Siv3D/Error/InternalEngineError.hpp>
# include <Siv3D/UserAction/IUserAction.hpp>
# include <Siv3D/Renderer/IRenderer.hpp>
# include <Siv3D/Console/IConsole.hpp>
# include <Siv3D/UserAction.hpp>
# include <Siv3D/Engine/Siv3DEngine.hpp>
# include <Siv3D/EngineLog.hpp>
Expand Down Expand Up @@ -538,6 +539,11 @@ namespace s3d
SIV3D_ENGINE(UserAction)->reportUserActions(UserAction::WindowDeactivated);
}

if (focused)
{
SIV3D_ENGINE(Console)->clearSelection();
}

m_state.focused = focused;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ namespace s3d
return true;
}

void CConsole::clearSelection() {}

void CConsole::close() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ namespace s3d

bool attach() override;

void clearSelection() override;

void close() override;
};
}
2 changes: 2 additions & 0 deletions Siv3D/src/Siv3D/Console/IConsole.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ namespace s3d

virtual bool attach() = 0;

virtual void clearSelection() = 0;

virtual void close() = 0;
};
}

0 comments on commit fb51576

Please sign in to comment.