//デフォルトコンストラクタ Object::Object() { // ポイントスプライトのバッファの初期化 if (FAILED(d3dDevice->CreateVertexBuffer(10000 * sizeof(Vertex3), D3DUSAGE_WRITEONLY, VERTEX3_FVF, D3DPOOL_MANAGED, &pointBuffer, nullptr))) DebugAlert("頂点バッファが\n作成できませんでした。"); // フォントの初期化 D3DXCreateFont(d3dDevice, 32, // 文字の高さ 16, // フォントの文字の幅 FW_NORMAL, // フォントのウェイト 0, // 要求されるミップレベルの数 false, // 斜体フォントの場合はtrue 0, // 文字セット 0, //出力精度 DEFAULT_QUALITY, //出力品質 DEFAULT_PITCH || FF_DONTCARE, //フォントのピッチとファミリ "", //フォントの書体 &font); DebugLog("オブジェクトを生成しました\n"); Initialize(); }
//メッシュを読み込む bool Model::LoadMesh(const TCHAR *meshFileName) { if (FAILED(D3DXLoadMeshFromX(meshFileName, D3DXMESH_SYSTEMMEM, d3dDevice, nullptr, &buffer, nullptr, &numMaterial, &mesh))) { DebugAlert("%sを\n読み込めませんでした。\nファイル名やディレクトリを間違えていないかご確認ください。", meshFileName); return false; } return true; }
void Application::Initialize(char* win_title, RECT win_rect, bool win_fullscreen, HINSTANCE hInst, int cmdShow) { // 引数をメンバー変数に保存する Application::win_title = win_title; Application::win_rect = win_rect; Application::win_fullscreen = win_fullscreen; //ウィンドウの初期化 if (!InitWindow(hInst, cmdShow)) DebugAlert("ウィンドウを\nしょきかできませんでした"); //Direct3Dの初期化 if (!InitDirect3d()) DebugAlert("Direct3Dを\n初期化できませんでした。"); //プレゼンテーションパラメータの初期化 if (!InitPresentParam()) DebugAlert("プレゼンテーションパラメータを\n初期化できませんでした。"); //Direct3Dデバイスの初期化 if (!InitD3dDevice()) DebugAlert("Direct3Dデバイスを\n初期化できませんでした。"); //DirectInputの初期化 if (!InitDirectInput(hInst)) DebugAlert("DirectInputを\n初期化できませんでした。"); //DirectInputデバイスの初期化 if (!InitDinputDevice()) DebugAlert("DirectInputデバイスを\n初期化できませんでした。"); DebugLog("アプリケーションを初期化しました。\n"); }