-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelper.h
85 lines (70 loc) · 1.49 KB
/
helper.h
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
#pragma once
#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>
#include "d3dx9.h"
#include <iostream>
#include <string>
#include <vector>
#include <stdint.h>
#include <stdlib.h>
#include <time.h>
#include <tchar.h>
#include "DemoClass.h"
typedef unsigned int uint;
#define xstr(a) str(a)
#define str(a) #a
#define RTN_ON_FAILURE(X) if(FAILED(X)) { return -1; }
#define MSG_ON_FAILURE(X) if(FAILED(X)) { msg_func(__FILE__, xstr(__LINE__)); }
struct dx_state
{
LPDIRECT3D9 d3d;
LPDIRECT3DDEVICE9 device;
HINSTANCE happ;
HWND hwindow;
UINT width;
UINT height;
FLOAT aspect_ratio;
bool windowed;
bool vsync;
bool wvisible;
WINDOWPLACEMENT wplacement;
D3DDISPLAYMODE desktop;
std::vector<D3DDISPLAYMODE> modes;
D3DFORMAT fmt_backbuffer;
D3DFORMAT fmt_depthstencil;
D3DADAPTER_IDENTIFIER9 adapter_info;
D3DCAPS9 caps;
};
extern struct dx_state dx_state1;
extern Demo *last_demo;
extern int last_selection;
void clear_last_demo();
struct mesh_obj
{
LPDIRECT3DVERTEXBUFFER9 v_buffer;
LPDIRECT3DINDEXBUFFER9 i_buffer;
int numvert, numprim;
D3DMATERIAL9 material;
};
int load_mesh(const char *file, const char *name, LPDIRECT3DDEVICE9 device, struct mesh_obj &out);
/**
* A hacky way to store keypresses
*/
union inputs
{
struct {
int horiz : 2;
int vert : 2;
int ctrl : 1;
int shift : 1;
uint t : 1;
uint f : 1;
uint v : 1;
uint p : 1;
};
uint all;
};
void store_keypress(union inputs val);
union inputs get_keypress();
int msg_func(const char *one, const char *two);