<commit_before>
#include"stdafx.h"
#include"DDevice.h"
#include"debug.h"

#include"Resource.h"

namespace espoir{

//ComPtr<IDirect3D9>::type DDevice::direct3D_;
//ComPtr<IDirect3DDevice9>::type DDevice::d3Device_;
//SPForm DDevice::form_;
//HWND espoir::DDevice::hWnd_ = NULL;



//void espoir::DDevice::SetHWND(HWND hWnd){

	//ݒ肵悤ƂEBhEnhNULLǂ
//	if(hWnd == NULL){
//		DOut dout;
//		dout << _T("Hwnd is null") << std::endl;
//	}

	//EBhEnh̐ݒ
	//this->hWnd_ = hWnd;
//}
bool espoir::DDevice::Init(){
		//߂l@ɐ=true : s=false
		bool result = true;

		//DirectX̊֐sɔG[R[h
		HRESULT err_code;

		//IDirect3DIuWFNgCX^X̎擾
		direct3D_.Attach( Direct3DCreate9(D3D_SDK_VERSION) );


		::D3DPRESENT_PARAMETERS d3dpp;
		ZeroMemory(&d3dpp, sizeof(d3dpp));
		
		//fBXvC[h\
		::D3DDISPLAYMODE d3ddm;
		ZeroMemory(&d3ddm, sizeof(d3ddm));

		//fBXvC[h̎擾
		err_code = direct3D_->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm);

		//fBXvC[h擾̃G[`FbN
		if(FAILED(err_code)){
			espoir::DOut dout;
			dout << _T("GetAdapterDisplayModes܂") << std::endl;
		}
		d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;//d3ddm.Format;
		d3dpp.BackBufferCount = 1;
		d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
		d3dpp.Windowed = TRUE;

		this->form_.reset(new Form(DirectX));
		this->form_->Show();

		//HEL(\tgEFAG~[V)ŃfoCX
		HRESULT hResult;
		hResult = direct3D_->CreateDevice(
			D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, this->form_->GetHandle(),
			D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3Device_);
		
		//foCX̃G[`FbN
		if(FAILED(hResult))
		{
			espoir::DOut dout;
			dout << _T("Error: HELł̏Ɏs܂") << std::endl;
			switch(hResult){
				case D3DERR_INVALIDCALL:
					dout << _T("\bȟĂяoBp[^Ɉُ킩`FbNĂ") << std::endl;
					break;
				case D3DERR_NOTAVAILABLE:
					dout << _T("̃foCX́A₢킹eNjbNT|[gĂ܂") << std::endl;
					break;
				case D3DERR_OUTOFVIDEOMEMORY:
					dout << _T("Direct3D ŝɏ\ȃfBXvC ܂") << std::endl;
					break;
			}
		}

		//DirectX̏ɎsĂfalseԂ
		if(espoir::DDevice::direct3D_ == 0)
			result = false;


		//Grahpcs̏

		SPGraphicInfo gInfo(new GraphicInfo());
		gInfo->d3Device = this->d3Device_;
		gInfo->direct3D = this->direct3D_;

		SPDXInfo dxInfo(new DXInfo);
		if(dxInfo->g.get() == NULL)
			dxInfo->g.reset(new Graphic(gInfo));

		//GameWindow̏
		if(this->gm_.get() == NULL)
			this->gm_.reset(new GameMain(dxInfo));

		return result;
}

//LRESULT CALLBACK espoir::DWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){
//	switch(message){
//
		//EBhEjꂽ
//		case WM_DESTROY:
//			PostQuitMessage(0);
//			break;

		//EBhEĕ`悳ꂽ
//		case WM_PAINT:
		
//			break;
//		default:
//			return DefWindowProc(hWnd, message, wParam, lParam);
//			break;
//	}
//	return 0;
//}

void espoir::DDevice::DMainLoop(){
	
	//bZ[W
	MSG msg;
	
	//CX^Xnh̎擾
	HINSTANCE hInst = GetModuleHandle(NULL);
	
	//ANZ[^iV[gJbgL[je[u擾
	HACCEL hAccelTable = LoadAccelerators(hInst, MAKEINTRESOURCE(IDC_ESPOIR));

	while(TRUE){
		if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)){
			if(!GetMessage(&msg, NULL, 0, 0))
				break;
			if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
		else{
			if(this->gm_ != NULL){
				this->gm_->Render();
				this->gm_->Update();
			}
			else{
				DOut dout;
				dout << _T("GameMainĂ܂") << " at: " << __LINE__ << " " << __FILE__ << std::endl;
			}
		}
	}
	// C bZ[W [v:
	//while (GetMessage(&msg, NULL, 0, 0))
	//{
	//	if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
	//	{
	//		TranslateMessage(&msg);
	//		DispatchMessage(&msg);
	//	}
	//}
}






}<commit_msg>Delete some unnecessary comments.<commit_after>
#include"stdafx.h"
#include"DDevice.h"
#include"debug.h"

#include"Resource.h"

namespace espoir{

bool espoir::DDevice::Init(){
		//߂l@ɐ=true : s=false
		bool result = true;

		//DirectX̊֐sɔG[R[h
		HRESULT err_code;

		//IDirect3DIuWFNgCX^X̎擾
		direct3D_.Attach( Direct3DCreate9(D3D_SDK_VERSION) );


		::D3DPRESENT_PARAMETERS d3dpp;
		ZeroMemory(&d3dpp, sizeof(d3dpp));
		
		//fBXvC[h\
		::D3DDISPLAYMODE d3ddm;
		ZeroMemory(&d3ddm, sizeof(d3ddm));

		//fBXvC[h̎擾
		err_code = direct3D_->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm);

		//fBXvC[h擾̃G[`FbN
		if(FAILED(err_code)){
			espoir::DOut dout;
			dout << _T("GetAdapterDisplayModes܂") << std::endl;
		}
		d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;//d3ddm.Format;
		d3dpp.BackBufferCount = 1;
		d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
		d3dpp.Windowed = TRUE;

		this->form_.reset(new Form(DirectX));
		this->form_->Show();

		//HEL(\tgEFAG~[V)ŃfoCX
		HRESULT hResult;
		hResult = direct3D_->CreateDevice(
			D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, this->form_->GetHandle(),
			D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3Device_);
		
		//foCX̃G[`FbN
		if(FAILED(hResult))
		{
			espoir::DOut dout;
			dout << _T("Error: HELł̏Ɏs܂") << std::endl;
			switch(hResult){
				case D3DERR_INVALIDCALL:
					dout << _T("\bȟĂяoBp[^Ɉُ킩`FbNĂ") << std::endl;
					break;
				case D3DERR_NOTAVAILABLE:
					dout << _T("̃foCX́A₢킹eNjbNT|[gĂ܂") << std::endl;
					break;
				case D3DERR_OUTOFVIDEOMEMORY:
					dout << _T("Direct3D ŝɏ\ȃfBXvC ܂") << std::endl;
					break;
			}
		}

		//DirectX̏ɎsĂfalseԂ
		if(espoir::DDevice::direct3D_ == 0)
			result = false;


		//Grahpcs̏

		SPGraphicInfo gInfo(new GraphicInfo());
		gInfo->d3Device = this->d3Device_;
		gInfo->direct3D = this->direct3D_;

		SPDXInfo dxInfo(new DXInfo);
		if(dxInfo->g.get() == NULL)
			dxInfo->g.reset(new Graphic(gInfo));

		//GameWindow̏
		if(this->gm_.get() == NULL)
			this->gm_.reset(new GameMain(dxInfo));

		return result;
}

void espoir::DDevice::DMainLoop(){
	
	//bZ[W
	MSG msg;
	
	//CX^Xnh̎擾
	HINSTANCE hInst = GetModuleHandle(NULL);
	
	//ANZ[^iV[gJbgL[je[u擾
	HACCEL hAccelTable = LoadAccelerators(hInst, MAKEINTRESOURCE(IDC_ESPOIR));

	while(TRUE){
		if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)){
			if(!GetMessage(&msg, NULL, 0, 0))
				break;
			if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
		else{
			if(this->gm_ != NULL){
				this->gm_->Render();
				this->gm_->Update();
			}
			else{
				DOut dout;
				dout << _T("GameMainĂ܂") << " at: " << __LINE__ << " " << __FILE__ << std::endl;
			}
		}
	}

}






}
{'fraction_non_alphanumeric': 0.18069187449718424, 'fraction_numerical': 0.016090104585679808, 'mean_word_length': 3.709090909090909, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3348118', 'n_tokens_mistral': 3260, 'n_tokens_neox': 2875, 'n_words': 397}