rev |
line source |
nuclear@1
|
1 /*
|
nuclear@1
|
2 D3DUT - Simple window creation and event handling for Direct3D 11 applications.
|
nuclear@1
|
3 Copyright (C) 2013 John Tsiombikas <nuclear@member.fsf.org>
|
nuclear@1
|
4
|
nuclear@1
|
5 This program is free software: you can redistribute it and/or modify
|
nuclear@1
|
6 it under the terms of the GNU Lesser General Public License as published by
|
nuclear@1
|
7 the Free Software Foundation, either version 3 of the License, or
|
nuclear@1
|
8 (at your option) any later version.
|
nuclear@1
|
9
|
nuclear@1
|
10 This program is distributed in the hope that it will be useful,
|
nuclear@1
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
nuclear@1
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
nuclear@1
|
13 GNU Lesser General Public License for more details.
|
nuclear@1
|
14
|
nuclear@1
|
15 You should have received a copy of the GNU Lesser General Public License
|
nuclear@1
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
|
nuclear@1
|
17 */
|
nuclear@0
|
18 #ifndef D3DUT_H_
|
nuclear@0
|
19 #define D3DUT_H_
|
nuclear@0
|
20
|
nuclear@0
|
21 #ifdef _MSC_VER
|
nuclear@0
|
22 #pragma comment(lib, "d3d11.lib")
|
nuclear@0
|
23 #pragma comment(lib, "d3dx11.lib")
|
nuclear@0
|
24 #pragma comment(lib, "winmm.lib")
|
nuclear@0
|
25
|
nuclear@0
|
26 #ifndef D3DUT_IMPLEMENTATION
|
nuclear@0
|
27 #pragma comment(lib, "d3dut.lib")
|
nuclear@0
|
28 #endif
|
nuclear@0
|
29 #endif
|
nuclear@0
|
30
|
nuclear@0
|
31 #ifdef D3DUT_IMPLEMENTATION
|
nuclear@0
|
32 #define D3DUTAPI __declspec(dllexport)
|
nuclear@0
|
33 #else
|
nuclear@0
|
34 #define D3DUTAPI __declspec(dllimport)
|
nuclear@0
|
35 #endif
|
nuclear@0
|
36
|
nuclear@0
|
37 #include <d3d11.h>
|
nuclear@0
|
38 #include <d3dx11.h>
|
nuclear@0
|
39
|
nuclear@0
|
40 #define D3DUT_RGB 0
|
nuclear@0
|
41 #define D3DUT_RGBA 0
|
nuclear@0
|
42 #define D3DUT_SINGLE 0
|
nuclear@0
|
43
|
nuclear@0
|
44 #define D3DUT_DOUBLE 1
|
nuclear@0
|
45 #define D3DUT_DEPTH 2
|
nuclear@0
|
46 #define D3DUT_STENCIL 4
|
nuclear@0
|
47 #define D3DUT_STEREO 8
|
nuclear@0
|
48 #define D3DUT_MULTISAMPLE 16
|
nuclear@0
|
49
|
nuclear@0
|
50 enum {
|
nuclear@0
|
51 D3DUT_WINDOW_WIDTH,
|
nuclear@0
|
52 D3DUT_WINDOW_HEIGHT,
|
nuclear@0
|
53 D3DUT_ELAPSED_TIME
|
nuclear@0
|
54 };
|
nuclear@0
|
55
|
nuclear@0
|
56 enum {
|
nuclear@0
|
57 D3DUT_LEFT_BUTTON,
|
nuclear@0
|
58 D3DUT_MIDDLE_BUTTON,
|
nuclear@0
|
59 D3DUT_RIGHT_BUTTON,
|
nuclear@0
|
60
|
nuclear@0
|
61 D3DUT_WHEELDOWN_BUTTON,
|
nuclear@0
|
62 D3DUT_WHEELUP_BUTTON
|
nuclear@0
|
63 };
|
nuclear@0
|
64
|
nuclear@0
|
65 enum {D3DUT_DOWN = 0, D3DUT_UP = 1};
|
nuclear@0
|
66
|
nuclear@0
|
67 typedef void (*D3DUT_DisplayFunc)();
|
nuclear@0
|
68 typedef void (*D3DUT_IdleFunc)();
|
nuclear@0
|
69 typedef void (*D3DUT_ReshapeFunc)(int, int);
|
nuclear@0
|
70 typedef void (*D3DUT_KeyboardFunc)(unsigned char, int, int);
|
nuclear@0
|
71 typedef void (*D3DUT_KeyboardUpFunc)(unsigned char, int, int);
|
nuclear@0
|
72 typedef void (*D3DUT_SpecialFunc)(int, int, int);
|
nuclear@0
|
73 typedef void (*D3DUT_SpecialUpFunc)(int, int, int);
|
nuclear@0
|
74 typedef void (*D3DUT_MouseFunc)(int, int, int, int);
|
nuclear@0
|
75 typedef void (*D3DUT_MotionFunc)(int, int);
|
nuclear@0
|
76 typedef void (*D3DUT_PassiveMotionFunc)(int, int);
|
nuclear@0
|
77
|
nuclear@0
|
78 extern D3DUTAPI ID3D11Device *d3dut_dev;
|
nuclear@0
|
79 extern D3DUTAPI ID3D11DeviceContext *d3dut_ctx;
|
nuclear@0
|
80 extern D3DUTAPI ID3D11RenderTargetView *d3dut_rtview;
|
nuclear@0
|
81
|
nuclear@0
|
82 void D3DUTAPI d3dut_init(int *argc, char **argv);
|
nuclear@0
|
83 void D3DUTAPI d3dut_init_display_mode(unsigned int dmflags);
|
nuclear@0
|
84 void D3DUTAPI d3dut_init_window_size(int xsz, int ysz);
|
nuclear@0
|
85
|
nuclear@0
|
86 int D3DUTAPI d3dut_create_window(const char *title);
|
nuclear@0
|
87 void D3DUTAPI d3dut_destroy_window(int win);
|
nuclear@0
|
88 void D3DUTAPI d3dut_set_window(int idx);
|
nuclear@0
|
89 int D3DUTAPI d3dut_get_window();
|
nuclear@0
|
90
|
nuclear@0
|
91 void D3DUTAPI d3dut_display_func(D3DUT_DisplayFunc func);
|
nuclear@0
|
92 void D3DUTAPI d3dut_idle_func(D3DUT_IdleFunc func);
|
nuclear@0
|
93 void D3DUTAPI d3dut_reshape_func(D3DUT_ReshapeFunc func);
|
nuclear@0
|
94 void D3DUTAPI d3dut_keyboard_func(D3DUT_KeyboardFunc func);
|
nuclear@0
|
95 void D3DUTAPI d3dut_keyboard_up_func(D3DUT_KeyboardUpFunc func);
|
nuclear@0
|
96 void D3DUTAPI d3dut_special_func(D3DUT_SpecialFunc func);
|
nuclear@0
|
97 void D3DUTAPI d3dut_special_up_func(D3DUT_SpecialUpFunc func);
|
nuclear@0
|
98 void D3DUTAPI d3dut_mouse_func(D3DUT_MouseFunc func);
|
nuclear@0
|
99 void D3DUTAPI d3dut_motion_func(D3DUT_MotionFunc func);
|
nuclear@0
|
100 void D3DUTAPI d3dut_passive_motion_func(D3DUT_PassiveMotionFunc func);
|
nuclear@0
|
101
|
nuclear@0
|
102 void D3DUTAPI d3dut_post_redisplay();
|
nuclear@0
|
103 void D3DUTAPI d3dut_swap_buffers();
|
nuclear@0
|
104
|
nuclear@0
|
105 void D3DUTAPI d3dut_main_loop();
|
nuclear@0
|
106
|
nuclear@0
|
107 int D3DUTAPI d3dut_get(unsigned int what);
|
nuclear@0
|
108
|
nuclear@0
|
109 void D3DUTAPI d3dut_solid_sphere(double radius, int slices, int stacks);
|
nuclear@0
|
110 // TODO ... more stuff
|
nuclear@0
|
111
|
nuclear@1
|
112 #endif // D3DUT_H_
|