-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindows.h
More file actions
149 lines (130 loc) · 3.97 KB
/
Copy pathwindows.h
File metadata and controls
149 lines (130 loc) · 3.97 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
* windows.h - X-Plane window handler
* Copyright 2026 Ian Ward
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef XPDRAW_WINDOWS_H
#define XPDRAW_WINDOWS_H
#include <XPLMDisplay.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
XPLMCreateWindow_t params;
XPLMWindowID windowID;
int texNum;
unsigned char *buffer;
int width;
int height;
XPLMDrawWindow_f drawFunc;
XPLMHandleMouseClick_f clickFunc;
XPLMHandleMouseWheel_f wheelFunc;
XPLMHandleKey_f keyFunc;
XPLMHandleCursor_f cursorFunc;
} xpd_win_t;
// Dummy callbacks adapted from https://developer.x-plane.com/code-sample/hello-world-sdk-3/
/**
* @brief DO NOT USE
*/
void base_draw(XPLMWindowID in_window_id, void *in_refcon);
/**
* @brief DO NOT USE
*/
int base_mouse(XPLMWindowID in_window_id, int x, int y, int is_down, void *in_refcon);
/**
* @brief DO NOT USE
*/
XPLMCursorStatus base_cursor(XPLMWindowID in_window_id, int x, int y, void *in_refcon);
/**
* @brief DO NOT USE
*/
int base_wheel(XPLMWindowID in_window_id, int x, int y, int wheel, int clicks, void *in_refcon);
/**
* @brief DO NOT USE
*/
void base_key(XPLMWindowID in_window_id, char key, XPLMKeyFlags flags, char virtual_key, void *in_refcon,
int losing_focus);
/**
* @brief Create a new window
*
* @param inWindow Window to create
* @param width Width of the window's framebuffer
* @param height Height of the window's framebuffer
*/
void xpd_win_new(xpd_win_t *inWindow, int width, int height);
/**
* @brief Register a callback to render the window
*
* @param inWindow Window to update
* @param new_cb New callback
*/
void xpd_win_set_draw_cb(xpd_win_t *inWindow, XPLMDrawWindow_f new_cb);
/**
* @brief Register a callback to handle clicks in the window
*
* @param inWindow Window to update
* @param new_cb New callback
*/
void xpd_win_set_click_cb(xpd_win_t *inWindow, XPLMHandleMouseClick_f new_cb);
/**
* @brief Register a callback to handle the cursor style (how it looks on the screen)
*
* @param inWindow Window to update
* @param new_cb New callback
*/
void xpd_win_set_cursor_cb(xpd_win_t *inWindow, XPLMHandleCursor_f new_cb);
/**
* @brief Register a callback to handle scrolling in a window
*
* @param inWindow Window to update
* @param new_cb New callback
*/
void xpd_win_set_wheel_cb(xpd_win_t *inWindow, XPLMHandleMouseWheel_f new_cb);
/**
* @brief Register a callback to handle keyboard presses in a window
*
* @param inWindow
* @param new_cb
*/
void xpd_win_set_key_cb(xpd_win_t *inWindow, XPLMHandleKey_f new_cb);
/**
* @brief Display a window created with xpd_win_new
*
* @param inWindow Window to start rendering
* @param title Title of the window
*/
void xpd_win_create(xpd_win_t *inWindow, const char *title);
/**
* @brief Display a window created with xpd_win_new
*
* @param inWindow Window to start rendering
* @param title Title of the window
* @param winLeft Position of the left edge of the window
* @param winDown Position of the bottom edge of the window
*/
void xpd_win_create2(xpd_win_t *inWindow, const char *title, int winLeft, int winDown);
/**
* @brief Set the minimum & maximum sizes of a window
*
* @param inWindow Window to update
* @param minWidth New minimum width of the window
* @param minHeight New minimum height of the window
* @param maxWidth New maximum width of the window
* @param maxHeight New maximum height of the window
*/
void xpd_win_resize_lims(xpd_win_t *inWindow, int minWidth, int minHeight, int maxWidth, int maxHeight);
#ifdef __cplusplus
}
#endif
#endif