d3dut

view src/win.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_WIN_H_
19 #define D3DUT_WIN_H_
21 #include <vector>
22 #include <d3d11.h>
24 #define WINCLASSNAME "d3dutwindow"
26 struct Window {
27 HWND win;
28 int width, height;
30 IDXGISwapChain *swap;
31 ID3D11RenderTargetView *rtarg_view;
33 bool must_redisplay, changed_size;
34 int mousex, mousey;
36 D3DUT_DisplayFunc display_func;
37 D3DUT_ReshapeFunc reshape_func;
38 D3DUT_KeyboardFunc keyboard_func;
39 D3DUT_KeyboardUpFunc keyboard_up_func;
40 D3DUT_SpecialFunc special_func;
41 D3DUT_SpecialUpFunc special_up_func;
42 D3DUT_MouseFunc mouse_func;
43 D3DUT_MotionFunc motion_func;
44 D3DUT_PassiveMotionFunc passive_motion_func;
45 };
47 extern std::vector<Window*> windows;
49 int create_window(const char *title, int xsz, int ysz, unsigned int dmflags);
50 void destroy_window(int idx);
52 void set_active_win(int idx);
53 int get_active_win();
55 Window *get_window(int idx = -1);
57 long CALLBACK win_handle_event(HWND syswin, unsigned int msg, unsigned int wparam, long lparam);
59 #endif // D3DUT_WIN_H_