DI-Guy SDK Documentation  13.7
diguyView.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2022 MAK Technologies, Inc.
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************
8  **
9  *t diguyView
10  **
11  *b Link against: libdiguy
12  */
13 
14 #ifndef __diguyView_H
15 #define __diguyView_H
16 
17 #ifdef SWIG
18 %module diguyView
19 #else
20 #define CPLUSPLUS_ONLY
21 #endif
22 
23 #ifdef CPLUSPLUS_ONLY
24 
25 class bdiScenarioView;
26 class diguyView;
27 class diguyViewCamera;
28 class diguyViewFog;
29 class diguyViewLight;
30 
31 #include <stdio.h> // for NULL
32 #include <diguy_constants.h>
33 #include <diguy_typedefs.h>
34 
35 
36 #endif /* CPLUSPLUS_ONLY */
37 
38 
39 #include <declspec_diguy.h>
40 
50 /****************************************************************************/
51 class BDI_DECLSPEC_diguy diguyView
52 {
53 
54 public:
55 
56 /*****************************************************************************/
66  /*l
67  *b Description:
68  **
69  ** Returns the name of the object. This pointer will
70  ** never be NULL.
71  **
72  *b Returns:
73  **
74  ** name of the view
75  */
76  const char* get_name();
77 
78  /*l
79  *b Description:
80  **
81  ** Returns the type name of the object. This pointer will
82  ** never be NULL.
83  **
84  *b Returns:
85  **
86  ** type name of the object
87  */
88  const char* get_type_name();
89 
90  /*l
91  *b Description:
92  **
93  ** Shows the view.
94  **
95  *b Returns:
96  **
97  ** 0 on success, -1 on failure
98  **
99  *b Callable From:
100  **
101  *- - C++
102  *- - Script
103  *- - Decision Bead
104  */
105  int show();
106 
107  /*l
108  *b Description:
109  **
110  ** Hides the view.
111  **
112  *b Returns:
113  **
114  ** 0 on success, -1 on failure
115  **
116  *b Callable From:
117  **
118  *- - C++
119  *- - Script
120  *- - Decision Bead
121  */
122  int hide();
123 
124  /*l
125  *b Returns:
126  **
127  ** Returns 1 if the view is showing, 0 if not.
128  **
129  *b Callable From:
130  **
131  *- - C++
132  *- - Script
133  *- - Decision Bead
134  */
135  int is_showing();
136 
137  /*l
138  *b Description:
139  **
140  ** Returns the window title of the view. This pointer will
141  ** never be NULL.
142  **
143  *b Returns:
144  **
145  ** window title of the view
146  */
147  const char* get_window_title();
148 
149  /*l
150  *b Description:
151  **
152  ** This function sets the window title of the view.
153  **
154  *b Arguments:
155  **
156  *a window_title - new window title
157  **
158  *b Returns:
159  **
160  ** 0 on success, -1 on failure
161  */
162  int set_window_title(const char* window_title);
163 
164  /*l
165  *b Description:
166  **
167  ** This function returns a pointer to the view camera.
168  **
169  *b Returns:
170  **
171  ** pointer of type diguyViewCamera; should never be NULL
172  */
173  diguyViewCamera* get_camera();
174 
175  /*l
176  *b Description:
177  **
178  ** This function returns a pointer to the view fog.
179  **
180  *b Returns:
181  **
182  ** pointer of type diguyViewFog; should never be NULL
183  */
184  diguyViewFog* get_fog();
185 
186  /*l
187  *b Description:
188  **
189  ** This function returns a pointer to the view lights.
190  **
191  *b Arguments:
192  **
193  *a number - number of light to be found
194  **
195  *b Returns:
196  **
197  ** pointer of type diguyViewLight; can be NULL if light at
198  ** specified index doesn't exist
199  */
200  diguyViewLight* get_light(int number = 0);
201 
202 
203 /*****************************************************************************/
209  /*l
210  *b Description:
211  **
212  ** Sets the width of the view, in pixels.
213  **
214  *b Arguments:
215  **
216  *a width - new width of view, in pixels
217  **
218  *b Returns:
219  **
220  ** 0 on success, -1 on failure
221  */
222  int set_width(int width);
223 
224  /*l
225  *b Returns:
226  **
227  ** width in pixels of the view
228  */
229  int get_width();
230 
231  /*l
232  *b Description:
233  **
234  ** Sets the height of the view, in pixels. Increasing height value
235  ** moves the view window bottom edge lower.
236  **
237  *b Arguments:
238  **
239  *a width - new height of view, in pixels
240  **
241  *b Returns:
242  **
243  ** 0 on success, -1 on failure
244  */
245  int set_height(int height);
246 
247  /*l
248  *b Returns:
249  **
250  ** height in pixels of the view
251  */
252  int get_height();
253 
254  /*l
255  *b Description:
256  **
257  ** Sets the current x position of the view window relative to the
258  ** left-hand edge of the screen.
259  **
260  *b Arguments:
261  **
262  *a x - new x coordinate of view
263  **
264  *b Returns:
265  **
266  ** 0 on success, -1 on failure
267  */
268  int set_x(int x);
269 
270  /*l
271  *b Returns:
272  **
273  ** current x coordinate of the view window; see set_x()
274  */
275  int get_x();
276 
277  /*l
278  *b Description:
279  **
280  ** Sets the current y position of the view window relative to the
281  ** upper edge of the screen. Increasing y moves the view window
282  ** lower.
283  **
284  *b Arguments:
285  **
286  *a y - new y coordinate of view
287  **
288  *b Returns:
289  **
290  ** 0 on success, -1 on failure
291  */
292  int set_y(int y);
293 
294  /*l
295  *b Returns:
296  **
297  ** current y coordinate of the view window; see set_y()
298  */
299  int get_y();
300 
302  void set_quick_track_character(const char* name);
303 
304 
305 /*****************************************************************************/
311  /*l
312  *b Description:
313  **
314  ** This is an enumeration of the different callbacks
315  ** that can be registered with add_callback() and
316  ** add_callback_script().
317  **
318  *b Usable From:
319  **
320  *- - C++
321  *- - Script
322  */
323  enum {
324  CALLBACK_ID_SHOW = 1,
325  CALLBACK_ID_HIDE,
326  CALLBACK_ID_WINDOW_TITLE_CHANGED,
327  CALLBACK_ID_WINDOW_GEOMETRY_CHANGED
328  };
329 
330 #ifdef CPLUSPLUS_ONLY
331 
332  /*l
333  *b Description:
334  **
335  ** This function adds a user callback.
336  **
337  *b Arguments:
338  **
339  *a callback - pointer to function with prototype
340  *a diguyViewCallback (typedefed above)
341  *a callback_id - integer id of when this callback is to be called
342  *a callback_params - not currently used; pass NULL
343  *a callback_user_data - pointer for user's own use; DI-Guy will
344  *a do nothing to the contents of this pointer
345  *a beyond passing it back when the callback is
346  *a invoked
347  **
348  ** callback_id should be one of the following values:
349  **
350  *i CALLBACK_ID_SHOW
351  **
352  ** This callback will be called whenever the view is
353  ** to be shown, whether due to a call to the diguyView::show()
354  ** function above or due to the result of a decision
355  ** or script.
356  **
357  ** There are no parameters for this callback.
358  **
359  *i CALLBACK_ID_HIDE
360  **
361  ** This callback will be called whenever the view is
362  ** to be hidden, whether due to a call to the diguyView::hide()
363  ** function above or due to the result of a decision
364  ** or script.
365  **
366  ** There are no parameters for this callback.
367  **
368  *i CALLBACK_ID_WINDOW_TITLE_CHANGED
369  **
370  ** This callback will be called whenever the view's
371  ** window title has been changed.
372  **
373  ** There are no parameters for this callback.
374  **
375  *i Callback Return Values:
376  **
377  ** Callbacks return a value of type diguyCallbackReturn,
378  ** which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE.
379  ** If the callback returns DIGUY_CALLBACK_STOP, the default handler
380  ** of the function will not be called; the callback is asserting
381  ** that it has done everything necessary for the function call.
382  ** If the callback returns DIGUY_CALLBACK_CONTINUE, the default
383  ** handler for the function will be called after the callback.
384  **
385  *b Returns:
386  **
387  ** 0 on success, -1 on failure
388  **
389  *b Returns:
390  **
391  ** 0 on success, -1 on failure
392  **
393  *b Callable From:
394  **
395  *- - C++
396  */
397  int add_callback(int callback_id,
398  diguyViewCallback* callback,
399  void* callback_params = 0,
400  void* callback_user_data = 0);
401 
402  /*l
403  *b Description:
404  **
405  ** This function removes a user callback. All callbacks matching
406  ** the specified callback_id and callback function will be removed.
407  **
408  *b Arguments:
409  **
410  *a callback_id - integer id of when this callback is to be called
411  *a callback - pointer to function with prototype
412  *a diguyCharacterCallback (typedefed above)
413  **
414  *b Returns:
415  **
416  ** 0 on success, -1 on failure
417  */
418  int remove_callback(int callback_id,
419  diguyViewCallback* callback);
420 
421  /*l
422  *b Description:
423  **
424  ** This function removes a user callback. All callbacks matching
425  ** the specified callback_id and callback_user_data pointer will
426  ** be removed.
427  **
428  *b Arguments:
429  **
430  *a callback_id - integer id of when this callback is to be called
431  *a callback_user_data - pointer for user's own use
432  **
433  *b Returns:
434  **
435  ** 0 on success, -1 on failure
436  */
437  int remove_callback_with_user_data(int callback_id,
438  void* callback_user_data);
439 
440 #endif /* CPLUSPLUS_ONLY */
441 
442  /*l
443  *b Description:
444  **
445  ** This function adds a user callback script. Callback scripts can
446  ** be removed with remove_callback_script().
447  **
448  ** See diguyCharacter::add_callback_script() for an example
449  ** of use.
450  **
451  *b Arguments:
452  **
453  *a callback_id - integer id of the callback
454  *a callback_script - script text of callback to be added
455  *a callback_script_type - the type of script contained in
456  *a callback_script
457  **
458  ** If NULL is passed for callback_script_type, a default script type
459  ** will be derived based on the default script interpreter of the
460  ** scenario.
461  **
462  *i Lua specific:
463  **
464  ** When the script is called, the object for which it is being called
465  ** will be in the callback_object global.
466  **
467  ** To pass NULL when calling from a lua script, use nil.
468  **
469  *b Returns:
470  **
471  ** 0 on success, -1 on failure
472  **
473  *b Callable From:
474  **
475  *- - C++
476  *- - Script
477  */
478  int add_callback_script(int callback_id,
479  const char* callback_script,
480  const char* callback_script_type = NULL);
481 
482  /*l
483  *b Description:
484  **
485  ** This function removes a user callback script previously added with
486  ** add_callback_script().
487  **
488  ** See diguyCharacter::remove_callback_script() for an example
489  ** of use.
490  **
491  *b Arguments:
492  **
493  *a callback_id - integer id of the callback
494  *a callback_script - script text of callback previously added
495  *a callback_script_type - the type of script contained in
496  *a callback_script
497  **
498  ** If NULL is passed for callback_script, all callback
499  ** scripts whose ids match callback_id and whose types match
500  ** callback_script_type will be removed.
501  **
502  ** If NULL is passed for callback_script_type, a default script type
503  ** will be derived based on the default script interpreter of the
504  ** scenario.
505  **
506  *i Lua specific:
507  **
508  ** To pass NULL when calling from a lua script, use nil.
509  **
510  *b Returns:
511  **
512  ** 0 on success, -1 on failure
513  **
514  *b Callable From:
515  **
516  *- - C++
517  *- - Script
518  */
519  int remove_callback_script(int callback_id,
520  const char* callback_script,
521  const char* callback_script_type = NULL);
522 
523 
529 #ifdef CPLUSPLUS_ONLY
530 
531  bdiScenarioView* get_scripted_object() {return m_scripted_object;}
532 
533 private:
534 
535  /*l
536  ** A private constructor.
537  */
538  diguyView(bdiScenarioView* view);
539 
540  /*l
541  ** A pointer to internal data.
542  */
543  bdiScenarioView* m_scripted_object;
544 
545  friend class bdiScenarioView;
546 
547 #endif /* CPLUSPLUS_ONLY */
548 
549 };
550 
551 #endif /* __diguyView_H */
552 
The diguyViewLight provides a interface around a scene light useful in diguy scenario and the opengl ...
Definition: diguyViewLight.h:60
A view is a graphics window wherein the scenario and its characters are animated. Note that views hav...
Definition: diguyView.h:48
diguyCallbackReturn diguyViewCallback(diguyView *view, int callback_id, void *callback_params, void *callback_user_data)
Definition: diguy_typedefs.h:211
The class that represents a camera in the world.
Definition: diguyViewCamera.h:260
Describes basic fog model that is used by DI-Guy Scenario and our default ogl renderer Most users wil...
Definition: diguyViewFog.h:42