d3dut

view include/d3dut.h @ 1:242535442d04

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