#include "Render/DX9/D3DX9Runtime.h" #include D3DX9Runtime::D3DX9Runtime() : m_module(LoadLibraryA("D3DX9_43.dll")) { if (!this->m_module) { throw std::system_error(GetLastError(), std::system_category(), "D3DX9_43.dll"); } this->filterTexture = reinterpret_castfilterTexture)>(GetProcAddress(this->m_module, "D3DXFilterTexture")); this->loadSurfaceFromMemory = reinterpret_castloadSurfaceFromMemory)>(GetProcAddress(this->m_module, "D3DXLoadSurfaceFromMemory")); this->loadSurfaceFromSurface = reinterpret_castloadSurfaceFromSurface)>(GetProcAddress(this->m_module, "D3DXLoadSurfaceFromSurface")); this->perspectiveFovLH = reinterpret_castperspectiveFovLH)>(GetProcAddress(this->m_module, "D3DXMatrixPerspectiveFovLH")); this->saveSurfaceToFileA = reinterpret_castsaveSurfaceToFileA)>(GetProcAddress(this->m_module, "D3DXSaveSurfaceToFileA")); if (!this->filterTexture || !this->loadSurfaceFromMemory || !this->loadSurfaceFromSurface || !this->perspectiveFovLH || !this->saveSurfaceToFileA) { FreeLibrary(this->m_module); throw std::system_error(ERROR_PROC_NOT_FOUND, std::system_category(), "D3DX9_43 exports"); } } D3DX9Runtime::~D3DX9Runtime() { FreeLibrary(this->m_module); }