OSDN Git Service

fix build system ofmoflib1 and saisei1
[moflib/moflib.git] / moflib-1.0 / src / mof / private / FileTextureBuilder.cpp
1
2 #include "mof/private/FileTextureBuilder.hpp"
3 #include <d3dx9.h>
4 #include <DxErr.h>
5 #include "mof/private/GraphicsDeviceImpl.hpp"
6 #include "mof/ConsoleIO.hpp"
7
8 mof::FileTextureBuilder::FileTextureBuilder( const mof::tstring& path)
9 {
10         m_path = path;
11         
12 }
13
14 mof::FileTextureBuilder::~FileTextureBuilder(void)
15 {
16 }
17
18
19 LPDIRECT3DTEXTURE9 mof::FileTextureBuilder::create(){
20         LPDIRECT3DTEXTURE9 texture;
21         LPDIRECT3DDEVICE9 pDevice = mof::GraphicsDevice::getRawDevice();
22         HRESULT hr = D3DXCreateTextureFromFileEx(pDevice , m_path.c_str() , 
23                         0 , 0 , 1 , 0/*RENDER*/ , D3DFMT_UNKNOWN , D3DPOOL_MANAGED ,
24                         D3DX_DEFAULT , D3DX_DEFAULT , mof::createColor(0 , 0 , 0) , NULL , NULL , &texture);
25
26         if(FAILED(hr))throw std::runtime_error("Failed --- CreateTextureFromFileEx");
27                 
28         return texture; 
29
30         
31
32 }