source: golgotha/src/maxtool/animate.cc @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.8 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "lisp/li_init.hh"
10#include "m1_info.hh"
11#include "max_object.hh"
12#include "render.hh"
13#include "st_edit.hh"
14#include "math/pi.hh"
15
16li_object *m1_frame_add(li_object *o, li_environment *env)
17//{{{
18{
19  m1_poly_object_class *obj = m1_info.obj;
20  obj->add_frame(m1_info.current_animation, m1_info.current_frame);
21  m1_render_window->request_redraw();
22  return 0;
23}
24//}}}
25
26li_object *m1_frame_remove(li_object *o, li_environment *env)
27//{{{
28{
29  m1_poly_object_class *obj = m1_info.obj;
30  obj->remove_frame(m1_info.current_animation, m1_info.current_frame);
31  m1_render_window->request_redraw();
32  return 0;
33}
34//}}}
35
36li_object *m1_frame_rewind(li_object *o, li_environment *env)
37//{{{
38{
39  m1_info.current_frame = 0;
40  m1_info.time = 0;
41  m1_render_window->update_object(m1_info.time);
42  m1_st_edit->edit_poly_changed();
43  m1_render_window->request_redraw();
44
45  return 0;
46}
47//}}}
48
49li_object *m1_frame_advance(li_object *o, li_environment *env)
50//{{{
51{
52  m1_poly_object_class *obj = m1_info.obj;
53
54  if (++m1_info.current_frame==obj->animation[m1_info.current_animation].num_frames)
55    m1_info.current_frame = 0;
56
57  m1_info.time += 1.0;
58  m1_render_window->update_object(m1_info.time);
59  m1_st_edit->edit_poly_changed();
60  m1_render_window->request_redraw();
61
62  return 0;
63}
64//}}}
65
66li_object *m1_frame_back(li_object *o, li_environment *env)
67//{{{
68{
69  m1_poly_object_class *obj = m1_info.obj;
70
71  if (--m1_info.current_frame<0)
72    m1_info.current_frame = obj->animation[m1_info.current_animation].num_frames - 1;
73
74  m1_info.time -= 1.0;
75
76  m1_render_window->update_object(m1_info.time);
77  m1_st_edit->edit_poly_changed();
78  m1_render_window->request_redraw();
79
80  return 0;
81}
82//}}}
83
84li_object *m1_toggle_animation(li_object *o, li_environment *env)
85//{{{
86{
87  m1_render_window->set_animation(!m1_render_window->is_animating());
88  m1_st_edit->edit_poly_changed();
89  return 0;
90}
91//}}}
92
93li_automatic_add_function(m1_frame_add, "frame_add");
94li_automatic_add_function(m1_frame_remove, "frame_remove");
95li_automatic_add_function(m1_frame_rewind, "frame_rewind");
96li_automatic_add_function(m1_frame_advance, "frame_advance");
97li_automatic_add_function(m1_frame_back, "frame_back");
98li_automatic_add_function(m1_toggle_animation, "toggle_animation");
99
100//{{{ Emacs Locals
101// Local Variables:
102// folded-file: t
103// End:
104//}}}
Note: See TracBrowser for help on using the repository browser.