Skip to content

Commit

Permalink
endの軽量化
Browse files Browse the repository at this point in the history
  • Loading branch information
yumetodo committed Feb 13, 2016
1 parent eea0260 commit 8210037
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Don't_push/Don't_push/source/end.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "end.h"
#include "DxLib.h"
#include "Dxkeystate.h"
#include <chrono>
#include <thread>

#ifdef _MSC_VER
#pragma warning (push)
Expand All @@ -9,16 +11,17 @@
Status end(const img_arr_t&, const sound_arr_t& sound, const config_info::lang_table_t& lang_table) {
for (auto& s : sound) s.second.stop();//BGM全部停止
//フォントの定義
const int Font_title = CreateFontToHandle(nullptr, 100, 5, DX_FONTTYPE_EDGE);//タイトルロゴ
const int Font_1 = CreateFontToHandle(nullptr, 30, 1, DX_FONTTYPE_ANTIALIASING);//「Xキーを押してね」の奴
const int font_title = CreateFontToHandle(nullptr, 100, 5, DX_FONTTYPE_EDGE);//タイトルロゴ
const int font_1 = CreateFontToHandle(nullptr, 30, 1, DX_FONTTYPE_ANTIALIASING);//「Xキーを押してね」の奴
keystate state;
auto normal_con_f = []() -> bool { return -1 != ProcessMessage() && 0 == ScreenFlip() && 0 == ClearDrawScreen(); };
volatile bool is_normal_state;
while ((is_normal_state = normal_con_f()) && state.update() && !state[KEY_INPUT_X] && !state.esc()) {
DrawBox(0, 0, WINDOW.width, WINDOW.height, GetColor(200, 200, 100), TRUE); //背景

DrawStringToHandle(180, WINDOW.height / 4, (L"- " + lang_table.at(L"I did it!") + L" -").c_str(), GetColor(250, 0, 0), Font_title); //タイトル
DrawStringToHandle(260, WINDOW.height - (WINDOW.height / 3), (L"- " + lang_table.at(L"Press X") + L" -").c_str(), GetColor(0, 0, 0), Font_1);//Xキー押してね
bool is_normal_state = normal_con_f();
DrawBox(0, 0, WINDOW.width, WINDOW.height, GetColor(200, 200, 100), TRUE); //背景
DrawStringToHandle(WINDOW.width * 37 / 320, WINDOW.height / 4, (L"- " + lang_table.at(L"I did it!") + L" -").c_str(), GetColor(250, 0, 0), font_title);
DrawStringToHandle(WINDOW.width * 13 / 40, WINDOW.height / 4 + 250, (L"- " + lang_table.at(L"Press X") + L" -").c_str(), GetColor(0, 0, 0), font_1);
is_normal_state = normal_con_f();
while ((is_normal_state = -1 != ProcessMessage()) && state.update() && !state[KEY_INPUT_X] && !state.esc()) {
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
if (!is_normal_state) throw std::runtime_error("ProcessMessage() return -1.");
if (state.esc()) throw normal_exit();
Expand Down

0 comments on commit 8210037

Please sign in to comment.