-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
101 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "ending_animation.h" | ||
#include "define.h" | ||
#include <dxlibex/Graph2D.h> | ||
#include <chrono> | ||
#include <thread> | ||
|
||
//#include <fstream> | ||
#ifdef _MSC_VER | ||
#pragma warning (push) | ||
#pragma warning (disable: 4706) //warning C4706: 条件式の比較値は、代入の結果になっています。 | ||
#endif | ||
|
||
void ending(const DxSHandle& sound) | ||
{ | ||
sound.play(DxSoundMode::BACK); | ||
DXLE_STATIC_CONSTEXPR int test_height = 20; | ||
static const TCHAR* plain_text = _T("Thank you for playing"); | ||
const int font = CreateFontToHandle(nullptr, test_height, 1, DX_FONTTYPE_ANTIALIASING);//「Xキーを押してね」の奴 | ||
auto text = dxle::MakeScreen(GetDrawStringWidthToHandle(plain_text, static_cast<int>(dxle::tstrlen(plain_text)), font), test_height); | ||
text.drawn_on([font]() { | ||
DxLib::DrawStringToHandle(0, 0, plain_text, DxLib::GetColor(255, 255, 255), font); | ||
}); | ||
auto normal_con_f = []() -> bool { | ||
bool re = -1 != ProcessMessage() && 0 == ScreenFlip() && 0 == ClearDrawScreen(); | ||
if (!re) throw std::runtime_error("ProcessMessage() return -1."); | ||
return re; | ||
}; | ||
bool is_normal_state; | ||
DXLE_STATIC_CONSTEXPR int v = WINDOW.width / 170; | ||
//std::ofstream log("log.txt"); | ||
//log << "text.size():" << text.size() << " v:" << v << std::endl; | ||
for (int text_pos = WINDOW.width; | ||
(is_normal_state = normal_con_f()) && 0 <= text_pos + text.size().width + v + 1; | ||
text_pos -= v | ||
) { | ||
DxLib::DrawBox(0, 0, WINDOW.width, WINDOW.height, DxLib::GetColor(0, 0, 0), true); | ||
text.DrawGraph(text_pos, WINDOW.height / 3, true); | ||
//log << "text_pos:" << text_pos << " text_pos + text.size().width:" << text_pos + text.size().width << std::endl; | ||
} | ||
while (1 == sound.is_during_playback() && (is_normal_state = -1 != ProcessMessage())) std::this_thread::sleep_for(std::chrono::milliseconds(50)); | ||
if(!is_normal_state) throw std::runtime_error("ProcessMessage() return -1."); | ||
} | ||
#ifdef _MSC_VER | ||
#pragma warning (pop) | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pragma once | ||
#include "DxSoundHandle.h" | ||
void ending(const DxSHandle& sound); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters