24 const std::shared_ptr<const ApplicationSettingRecord> setting_ptr) :
25 setting_ptr_(setting_ptr),
26 fps_controller_{ setting_ptr != nullptr ? setting_ptr->window_fps : 60 }
28 assert(setting_ptr_ !=
nullptr);
35 if (!setting_ptr_->do_gui_display)
55 while (ProcessMessage() >= 0)
69 std::unique_ptr<IGraphicMain>&& graphic_main_ptr)
73 boost::mutex::scoped_lock lock(mutex_);
76 if (graphic_main_ptr_)
78 graphic_main_ptr_.reset();
81 graphic_main_ptr_ = std::move(graphic_main_ptr);
85bool GraphicSystem::MyDxlibInit()
90 SetOutApplicationLogValidFlag(FALSE);
96 SetWindowSizeChangeEnableFlag(FALSE);
99 SetAlwaysRunFlag(TRUE);
102 SetWaitVSyncFlag(FALSE);
105 ChangeWindowMode(TRUE);
109 SetUseDirectInputFlag(TRUE);
115 if (DxLib_Init() < 0)
122 SetDrawScreen(DX_SCREEN_BACK);
141bool GraphicSystem::Loop()
157 boost::mutex::scoped_lock lock(mutex_);
164 if (graphic_main_ptr_ !=
nullptr)
166 if (!graphic_main_ptr_->Update()) {
return false; }
173 if (ClearDrawScreen() < 0) {
return false; }
177 if (graphic_main_ptr_ !=
nullptr)
179 graphic_main_ptr_->Draw();
185 if (ScreenFlip() < 0)
192 fps_controller_.
Wait();
197void GraphicSystem::MyDxlibFinalize()
const
void Wait()
処理が早すぎる場合,FPSを一定にするために待つ.
bool SkipDrawScene()
60Hz以上のモニター使用時に処理が詰まって画面がちらつかないように, 描画処理をスキップするかどうかを判定する.
static const int kBackColorBlue
ウィンドウ背景色. 青色成分.0~255の範囲で指定.
static const int kBackColorGreen
ウィンドウ背景色. 緑色成分.0~255の範囲で指定.
static const char kWindowName[]
ウィンドウの名前.
static const int kBackColorRed
ウィンドウ背景色. 赤色成分.0~255の範囲で指定.
static const int kColorBit
色を表現するビット数.通常32で良いが軽くするなら16にする.
GraphicSystem(const std::shared_ptr< const ApplicationSettingRecord > setting_ptr)
void ChangeGraphicMain(std::unique_ptr< IGraphicMain > &&graphic_main_ptr)
グラフィックの表示を行うクラスを変更する.
void Main()
ウィンドウの表示を行う関数. boost::thread にこの関数を渡して並列処理を行う. メンバ関数の MyDxlibInit 関数に失敗した場合,終了する.
void InitDxlib3DSetting(const bool high_quality)
3D処理を行う上で必要な初期化処理をまとめたもの.