aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/modules/engines/direct3d/evas_direct3d_device.h
blob: c5a4b49b66d17885d6f82a10ce4e92092556dbb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef __EVAS_DIRECT3D_DEVICE_H__
#define __EVAS_DIRECT3D_DEVICE_H__

#include "evas_engine.h"

#include <assert.h>

#include "ref.h"
#include "array.h"


class D3DDevice : virtual public Referenc
{
public:
   D3DDevice();

   bool Init(HWND window, int depth, bool fullscreen = false);
   bool Reset(int width, int height, int fullscreen);
   void Destroy();
   bool Begin();
   bool End();

   inline LPDIRECT3DDEVICE9 GetDevice();
   inline int GetWidth();
   inline int GetHeight();
   inline HWND GetWindow();
   inline bool GetFullscreen();

   TArray<DWORD> &GetRenderData();

   HRESULT SetTexture(DWORD stage, LPDIRECT3DTEXTURE9 tex);

private:
   HRESULT RestoreDevice();
   HRESULT ResetDevice();
   void ResetParams();

   HRESULT CreateRenderTarget();

private:
   HWND _window;
   LPDIRECT3D9 _object;
   LPDIRECT3DDEVICE9 _device;
   int _width;
   int _height;
   int _rot;
   int _depth;
   bool _device_lost;
   bool _scene_rendering;
   D3DPRESENT_PARAMETERS _d3dpp;
   D3DSURFACE_DESC _backbuffer_desc;
   //LPDIRECT3DSURFACE9 _render_target;
   LPDIRECT3DSURFACE9 _render_target_data;
   //LPDIRECT3DSURFACE9 _original_render_target;
   //bool _render_to_texture;
   TArray<DWORD> _render_data;
   bool _render_data_updated;

   TArray<LPDIRECT3DTEXTURE9> _textures;
};

LPDIRECT3DDEVICE9 D3DDevice::GetDevice()
{
   return _device;
}

int D3DDevice::GetWidth()
{
   return _width;
}

int D3DDevice::GetHeight()
{
   return _height;
}

HWND D3DDevice::GetWindow()
{
   return _window;
}

bool D3DDevice::GetFullscreen()
{
   return (_d3dpp.Windowed == 0);
}

#endif  // __EVAS_DIRECT3D_DEVICE_H__